Mail Archives: djgpp-workers/2002/06/14/14:24:15
Eric Rudd wrote:
> Richard Dawe wrote:
>
> > After applying the patch I get:
> >
> > bash-2.04$ ./pow-bug
> > pow(1.0000000000000002e+00 4.5035996273704970e+15) = 2.7182818284590455e+00
> > pow(-1.0000000000000002e+00 4.5035996273704970e+15) = 2.7182818284590455e+00
> > pow(9.9999999999999978e-01 4.5035996273704970e+15) = 3.6787944117144222e-01
> > pow(-9.9999999999999978e-01 4.5035996273704970e+15) = 3.6787944117144222e-01
> > bash-2.04$ ./pow-bug-m
> > pow(1.0000000000000002e+00 4.5035996273704970e+15) = 2.7182818284590455e+00
> > pow(-1.0000000000000002e+00 4.5035996273704970e+15) = -2.7182818284590455e+00
> > pow(9.9999999999999978e-01 4.5035996273704970e+15) = 3.6787944117144222e-01
> > pow(-9.9999999999999978e-01 4.5035996273704970e+15) = -3.6787944117144222e-01
> >
> > Note that the results are not consistent - the sign differs in libc vs. libm.
>
Here's a patch for pow.s in libc:
*** powold.s Fri Mar 3 13:07:04 2000
--- pow.s Fri Jun 14 10:29:00 2002
***************
*** 145,155 ****
jmp badresult
yisint:
! fistl 8(%esp)
fxch %st(1)
fyl2x
call Lpow2
! andl $1,8(%esp)
jz yeven
fchs
yeven:
--- 145,156 ----
jmp badresult
yisint:
! fld %st
! fistpq (%esp)
fxch %st(1)
fyl2x
call Lpow2
! andl $1,(%esp)
jz yeven
fchs
yeven:
-Eric Rudd
rudd AT cyberoptics DOT com
- Raw text -