diff -Naur --exclude='*.orig' cygwin-1.5.25-5/newlib/libm/math/e_pow.c cygwin-1.5.24-2/newlib/libm/math/e_pow.c --- cygwin-1.5.25-5/newlib/libm/math/e_pow.c 2003-10-20 11:46:37.001000000 -0700 +++ cygwin-1.5.24-2/newlib/libm/math/e_pow.c 2007-04-30 13:39:18.609375000 -0700 @@ -25,13 +25,14 @@ * Special cases: * 1. (anything) ** 0 is 1 * 2. (anything) ** 1 is itself - * 3. (anything) ** NAN is NAN + * 3a. (anything) ** NAN is NAN except + * 3b. +1 ** NAN is 1 * 4. NAN ** (anything except 0) is NAN * 5. +-(|x| > 1) ** +INF is +INF * 6. +-(|x| > 1) ** -INF is +0 * 7. +-(|x| < 1) ** +INF is +0 * 8. +-(|x| < 1) ** -INF is +INF - * 9. +-1 ** +-INF is NAN + * 9. +-1 ** +-INF is 1 * 10. +0 ** (+anything except 0, NAN) is +0 * 11. -0 ** (+anything except 0, NAN, odd integer) is +0 * 12. +0 ** (-anything except 0, NAN) is +INF @@ -117,10 +118,11 @@ /* y==zero: x**0 = 1 */ if((iy|ly)==0) return one; - /* +-NaN return x+y */ + /* x|y==NaN return NaN unless x==1 then return 1 */ if(ix > 0x7ff00000 || ((ix==0x7ff00000)&&(lx!=0)) || iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0))) - return x+y; + if(((ix-0x3ff00000)|lx)==0) return one; + else return nan(""); /* determine if y is an odd int when x < 0 * yisint = 0 ... y is not an integer @@ -146,7 +148,7 @@ if(ly==0) { if (iy==0x7ff00000) { /* y is +-inf */ if(((ix-0x3ff00000)|lx)==0) - return y - y; /* inf**+-1 is NaN */ + return one; /* +-1**+-inf = 1 */ else if (ix >= 0x3ff00000)/* (|x|>1)**+-inf = inf,0 */ return (hy>=0)? y: zero; else /* (|x|<1)**-,+inf = inf,0 */ diff -Naur --exclude='*.orig' cygwin-1.5.25-5/newlib/libm/math/ef_pow.c cygwin-1.5.24-2/newlib/libm/math/ef_pow.c --- cygwin-1.5.25-5/newlib/libm/math/ef_pow.c 2002-06-13 16:03:01.001000000 -0700 +++ cygwin-1.5.24-2/newlib/libm/math/ef_pow.c 2007-04-30 13:39:45.234375000 -0700 @@ -75,10 +75,11 @@ /* y==zero: x**0 = 1 */ if(FLT_UWORD_IS_ZERO(iy)) return one; - /* +-NaN return x+y */ + /* x|y==NaN return NaN unless x==1 then return 1 */ if(FLT_UWORD_IS_NAN(ix) || FLT_UWORD_IS_NAN(iy)) - return x+y; + if(ix==0x3f800000) return one; + else return nanf(""); /* determine if y is an odd int when x < 0 * yisint = 0 ... y is not an integer @@ -98,7 +99,7 @@ /* special value of y */ if (FLT_UWORD_IS_INFINITE(iy)) { /* y is +-inf */ if (ix==0x3f800000) - return y - y; /* inf**+-1 is NaN */ + return one; /* +-1**+-inf = 1 */ else if (ix > 0x3f800000)/* (|x|>1)**+-inf = inf,0 */ return (hy>=0)? y: zero; else /* (|x|<1)**-,+inf = inf,0 */ diff -Naur --exclude='*.orig' cygwin-1.5.25-5/newlib/libm/math/w_acos.c cygwin-1.5.24-2/newlib/libm/math/w_acos.c --- cygwin-1.5.25-5/newlib/libm/math/w_acos.c 2003-10-20 11:46:37.001000000 -0700 +++ cygwin-1.5.24-2/newlib/libm/math/w_acos.c 2007-04-24 18:22:15.659250000 -0700 @@ -101,7 +101,7 @@ exc.name = "acos"; exc.err = 0; exc.arg1 = exc.arg2 = x; - exc.retval = 0.0; + exc.retval = nan(""); if (_LIB_VERSION == _POSIX_) errno = EDOM; else if (!matherr(&exc)) { diff -Naur --exclude='*.orig' cygwin-1.5.25-5/newlib/libm/math/w_asin.c cygwin-1.5.24-2/newlib/libm/math/w_asin.c --- cygwin-1.5.25-5/newlib/libm/math/w_asin.c 2003-10-20 11:46:37.001000000 -0700 +++ cygwin-1.5.24-2/newlib/libm/math/w_asin.c 2007-04-24 18:09:58.034250000 -0700 @@ -104,7 +104,7 @@ exc.name = "asin"; exc.err = 0; exc.arg1 = exc.arg2 = x; - exc.retval = 0.0; + exc.retval = nan(""); if(_LIB_VERSION == _POSIX_) errno = EDOM; else if (!matherr(&exc)) { diff -Naur --exclude='*.orig' cygwin-1.5.25-5/newlib/libm/math/w_atan2.c cygwin-1.5.24-2/newlib/libm/math/w_atan2.c --- cygwin-1.5.25-5/newlib/libm/math/w_atan2.c 2003-10-20 11:46:37.001000000 -0700 +++ cygwin-1.5.24-2/newlib/libm/math/w_atan2.c 2007-05-07 11:41:43.890625000 -0700 @@ -60,8 +60,6 @@ $-\pi$ to $\pi$. @end tex -If both <[x]> and <[y]> are 0.0, <> causes a <> error. - You can modify error handling for these functions using <>. PORTABILITY @@ -86,32 +84,7 @@ double y,x; #endif { -#ifdef _IEEE_LIBM return __ieee754_atan2(y,x); -#else - double z; - struct exception exc; - z = __ieee754_atan2(y,x); - if(_LIB_VERSION == _IEEE_||isnan(x)||isnan(y)) return z; - if(x==0.0&&y==0.0) { - /* atan2(+-0,+-0) */ - exc.arg1 = y; - exc.arg2 = x; - exc.type = DOMAIN; - exc.name = "atan2"; - exc.err = 0; - exc.retval = 0.0; - if(_LIB_VERSION == _POSIX_) - errno = EDOM; - else if (!matherr(&exc)) { - errno = EDOM; - } - if (exc.err != 0) - errno = exc.err; - return exc.retval; - } else - return z; -#endif } #endif /* defined(_DOUBLE_IS_32BITS) */ diff -Naur --exclude='*.orig' cygwin-1.5.25-5/newlib/libm/math/w_log.c cygwin-1.5.24-2/newlib/libm/math/w_log.c --- cygwin-1.5.25-5/newlib/libm/math/w_log.c 2005-10-28 14:21:08.001000000 -0700 +++ cygwin-1.5.24-2/newlib/libm/math/w_log.c 2007-04-24 18:33:35.893625000 -0700 @@ -44,7 +44,7 @@ RETURNS Normally, returns the calculated value. When <[x]> is zero, the returned value is <<-HUGE_VAL>> and <> is set to <>. -When <[x]> is negative, the returned value is <<-HUGE_VAL>> and +When <[x]> is negative, the returned value is NaN (not a number) and <> is set to <>. You can control the error behavior via <>. @@ -105,6 +105,7 @@ else if (!matherr(&exc)) { errno = EDOM; } + exc.retval = nan(""); } if (exc.err != 0) errno = exc.err; diff -Naur --exclude='*.orig' cygwin-1.5.25-5/newlib/libm/math/w_log10.c cygwin-1.5.24-2/newlib/libm/math/w_log10.c --- cygwin-1.5.25-5/newlib/libm/math/w_log10.c 2000-02-17 11:39:51.001000000 -0800 +++ cygwin-1.5.24-2/newlib/libm/math/w_log10.c 2007-04-24 18:29:28.799875000 -0700 @@ -103,6 +103,7 @@ else if (!matherr(&exc)) { errno = EDOM; } + exc.retval = nan(""); } if (exc.err != 0) errno = exc.err; diff -Naur --exclude='*.orig' cygwin-1.5.25-5/newlib/libm/math/w_pow.c cygwin-1.5.24-2/newlib/libm/math/w_pow.c --- cygwin-1.5.25-5/newlib/libm/math/w_pow.c 2003-10-20 11:46:37.001000000 -0700 +++ cygwin-1.5.24-2/newlib/libm/math/w_pow.c 2007-04-24 19:13:19.503000000 -0700 @@ -93,7 +93,7 @@ exc.err = 0; exc.arg1 = x; exc.arg2 = y; - exc.retval = x; + exc.retval = 1.0; if (_LIB_VERSION == _IEEE_ || _LIB_VERSION == _POSIX_) exc.retval = 1.0; else if (!matherr(&exc)) { diff -Naur --exclude='*.orig' cygwin-1.5.25-5/newlib/libm/math/wf_acos.c cygwin-1.5.24-2/newlib/libm/math/wf_acos.c --- cygwin-1.5.25-5/newlib/libm/math/wf_acos.c 2000-02-17 11:39:51.001000000 -0800 +++ cygwin-1.5.24-2/newlib/libm/math/wf_acos.c 2007-04-24 18:22:38.331125000 -0700 @@ -40,7 +40,7 @@ exc.name = "acosf"; exc.err = 0; exc.arg1 = exc.arg2 = (double)x; - exc.retval = 0.0; + exc.retval = nan(""); if (_LIB_VERSION == _POSIX_) errno = EDOM; else if (!matherr(&exc)) { diff -Naur --exclude='*.orig' cygwin-1.5.25-5/newlib/libm/math/wf_asin.c cygwin-1.5.24-2/newlib/libm/math/wf_asin.c --- cygwin-1.5.25-5/newlib/libm/math/wf_asin.c 2000-02-17 11:39:51.001000000 -0800 +++ cygwin-1.5.24-2/newlib/libm/math/wf_asin.c 2007-04-24 18:11:11.315500000 -0700 @@ -42,7 +42,7 @@ exc.name = "asinf"; exc.err = 0; exc.arg1 = exc.arg2 = (double)x; - exc.retval = 0.0; + exc.retval = nan(""); if(_LIB_VERSION == _POSIX_) errno = EDOM; else if (!matherr(&exc)) { diff -Naur --exclude='*.orig' cygwin-1.5.25-5/newlib/libm/math/wf_atan2.c cygwin-1.5.24-2/newlib/libm/math/wf_atan2.c --- cygwin-1.5.25-5/newlib/libm/math/wf_atan2.c 2000-02-17 11:39:51.001000000 -0800 +++ cygwin-1.5.24-2/newlib/libm/math/wf_atan2.c 2007-05-07 11:43:15.125000000 -0700 @@ -28,32 +28,7 @@ float y,x; #endif { -#ifdef _IEEE_LIBM return __ieee754_atan2f(y,x); -#else - float z; - struct exception exc; - z = __ieee754_atan2f(y,x); - if(_LIB_VERSION == _IEEE_||isnanf(x)||isnanf(y)) return z; - if(x==(float)0.0&&y==(float)0.0) { - /* atan2f(+-0,+-0) */ - exc.arg1 = y; - exc.arg2 = x; - exc.err = 0; - exc.type = DOMAIN; - exc.name = "atan2f"; - exc.retval = 0.0; - if(_LIB_VERSION == _POSIX_) - errno = EDOM; - else if (!matherr(&exc)) { - errno = EDOM; - } - if (exc.err != 0) - errno = exc.err; - return (float)exc.retval; - } else - return z; -#endif } #ifdef _DOUBLE_IS_32BITS diff -Naur --exclude='*.orig' cygwin-1.5.25-5/newlib/libm/math/wf_log.c cygwin-1.5.24-2/newlib/libm/math/wf_log.c --- cygwin-1.5.25-5/newlib/libm/math/wf_log.c 2000-02-17 11:39:51.001000000 -0800 +++ cygwin-1.5.24-2/newlib/libm/math/wf_log.c 2007-04-24 18:29:37.284250000 -0700 @@ -63,6 +63,7 @@ else if (!matherr(&exc)) { errno = EDOM; } + exc.retval = nan(""); } if (exc.err != 0) errno = exc.err; diff -Naur --exclude='*.orig' cygwin-1.5.25-5/newlib/libm/math/wf_log10.c cygwin-1.5.24-2/newlib/libm/math/wf_log10.c --- cygwin-1.5.25-5/newlib/libm/math/wf_log10.c 2000-02-17 11:39:51.001000000 -0800 +++ cygwin-1.5.24-2/newlib/libm/math/wf_log10.c 2007-04-24 18:29:46.596750000 -0700 @@ -64,6 +64,7 @@ else if (!matherr(&exc)) { errno = EDOM; } + exc.retval = nan(""); } if (exc.err != 0) errno = exc.err; diff -Naur --exclude='*.orig' cygwin-1.5.25-5/newlib/libm/math/wf_pow.c cygwin-1.5.24-2/newlib/libm/math/wf_pow.c --- cygwin-1.5.25-5/newlib/libm/math/wf_pow.c 2000-02-17 11:39:51.001000000 -0800 +++ cygwin-1.5.24-2/newlib/libm/math/wf_pow.c 2007-04-24 19:14:46.346750000 -0700 @@ -43,7 +43,7 @@ exc.err = 0; exc.arg1 = (double)x; exc.arg2 = (double)y; - exc.retval = x; + exc.retval = 1.0; if (_LIB_VERSION == _IEEE_ || _LIB_VERSION == _POSIX_) exc.retval = 1.0; else if (!matherr(&exc)) {