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
This commit is contained in:
Nicolas Brunie 2020-02-14 10:12:25 +01:00 committed by Corinna Vinschen
parent 8cb20fa5d3
commit bb25dd1b0f
1 changed files with 1 additions and 1 deletions

View File

@ -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("");
}