Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Brunie <nbrunie@kalray.eu>2020-02-14 12:12:25 +0300
committerCorinna Vinschen <corinna@vinschen.de>2020-02-14 12:12:25 +0300
commitbb25dd1b0f39f343b764fd0db861cb9a30441407 (patch)
treea54b3806db7120c7ec74b4980670ca36295c88ef
parent8cb20fa5d3d3b8ee4d61360390e5192c1eba0a1c (diff)
pow: fix pow(-1.0, NaN)
I think I may have encountered a bug in the implementation of pow: pow(-1.0, NaN) returns 1.0 when it should return NaN. Because ix is used to check input vs 1.0 rather than hx, -1.0 is mistaken for 1.0
-rw-r--r--newlib/libm/math/e_pow.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/newlib/libm/math/e_pow.c b/newlib/libm/math/e_pow.c
index 6d2a501a1..5fd28e65f 100644
--- a/newlib/libm/math/e_pow.c
+++ b/newlib/libm/math/e_pow.c
@@ -122,7 +122,7 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/
/* x|y==NaN return NaN unless x==1 then return 1 */
if(ix > 0x7ff00000 || ((ix==0x7ff00000)&&(lx!=0)) ||
iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0))) {
- if(((ix-0x3ff00000)|lx)==0) return one;
+ if(((hx-0x3ff00000)|lx)==0) return one;
else return nan("");
}