• Sam Lantinga's avatar
    http://sources.redhat.com/ml/newlib/2002/msg00230.html · 5f94466c
    Sam Lantinga authored
    Stephen L Moshier wrote:
    >
    > pow(x,y) returns 0 when x is very close to -1.0 and y is very large.
    > The following test program prints
    >
    > pow(1.0000000000000002e+00 4.5035996273704970e+15) = 2.7182818284590455e+00
    > pow(-1.0000000000000002e+00 4.5035996273704970e+15) =0.0000000000000000e+00
    > pow(9.9999999999999978e-01 4.5035996273704970e+15) = 3.6787944117144222e-01
    > pow(-9.9999999999999978e-01 4.5035996273704970e+15) = 0.0000000000000000e+00
    >
    > which is incorrect for the negative arguments raised to an odd integer
    > power.
    >
    > -----
    > double pow (double, double);
    >
    > int
    > main ()
    > {
    >   double x, y, z;
    >
    >   x = 1.0 + pow (2.0, -52.0);
    >   y = 1.0 + pow (2.0, 52.0);
    >   z = pow (x, y);
    >   printf ("pow(%.16e %.16e) = %.16e\n", x, y, z);
    >   x = -x;
    >   z = pow (x, y);
    >   printf ("pow(%.16e %.16e) = %.16e\n", x, y, z);
    >   x = 1.0 - pow (2.0, -52.0);
    >   z = pow (x, y);
    >   printf ("pow(%.16e %.16e) = %.16e\n", x, y, z);
    >   x = -x;
    >   z = pow (x, y);
    >   printf ("pow(%.16e %.16e) = %.16e\n", x, y, z);
    > }
    > -----
    >
    > Here is a patch for newlib/libm/math/epow.c:
    
    Patch checked in and duplicated for ef_pow.c.  Thanks.
    
    -- Jeff J.
    
    --HG--
    extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403207
    5f94466c
Name
Last commit
Last update
VisualC Loading commit data...
VisualCE Loading commit data...
Xcode Loading commit data...
build-scripts Loading commit data...
docs Loading commit data...
include Loading commit data...
src Loading commit data...
test Loading commit data...
.indent.pro Loading commit data...
BUGS Loading commit data...
Borland.html Loading commit data...
Borland.zip Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
INSTALL Loading commit data...
Makefile.dc Loading commit data...
Makefile.ds Loading commit data...
Makefile.in Loading commit data...
Makefile.minimal Loading commit data...
NOTES Loading commit data...
README Loading commit data...
README-SDL.txt Loading commit data...
README.BeOS Loading commit data...
README.CVS Loading commit data...
README.DC Loading commit data...
README.DirectFB Loading commit data...
README.MacOSX Loading commit data...
README.MiNT Loading commit data...
README.NanoX Loading commit data...
README.OS2 Loading commit data...
README.Porting Loading commit data...
README.QNX Loading commit data...
README.RISCOS Loading commit data...
README.SVN Loading commit data...
README.Watcom Loading commit data...
README.WinCE Loading commit data...
README.wscons Loading commit data...
SDL.qpg.in Loading commit data...
SDL.spec.in Loading commit data...
TODO Loading commit data...
UNDER_CONSTRUCTION.txt Loading commit data...
VisualC.html Loading commit data...
Watcom-OS2.zip Loading commit data...
Watcom-Win32.zip Loading commit data...
WhatsNew Loading commit data...
acinclude.m4 Loading commit data...
autogen.sh Loading commit data...
configure.in Loading commit data...
docs.html Loading commit data...
sdl-config.in Loading commit data...
sdl.m4 Loading commit data...
sdl.pc.in Loading commit data...