mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Fix pow and powf undefined behavior in libm.
This commit is contained in:
parent
a43c89650f
commit
0eeb9d1e56
2 changed files with 2 additions and 2 deletions
|
@ -296,7 +296,7 @@ __ieee754_pow(double x, double y)
|
|||
r = (z*t1)/(t1-two)-(w+z*w);
|
||||
z = one-(r-z);
|
||||
GET_HIGH_WORD(j,z);
|
||||
j += (n<<20);
|
||||
j = (int32_t)((uint32_t)j + ((uint32_t)u<<20));
|
||||
if((j>>20)<=0) z = scalbn(z,n); /* subnormal output */
|
||||
else SET_HIGH_WORD(z,j);
|
||||
return s*z;
|
||||
|
|
|
@ -240,7 +240,7 @@ __ieee754_powf(float x, float y)
|
|||
r = (z*t1)/(t1-two)-(w+z*w);
|
||||
z = one-(r-z);
|
||||
GET_FLOAT_WORD(j,z);
|
||||
j += (n<<23);
|
||||
j = (int32_t)((uint32_t)j + ((uint32_t)u<<23));
|
||||
if((j>>23)<=0) z = scalbnf(z,n); /* subnormal output */
|
||||
else SET_FLOAT_WORD(z,j);
|
||||
return s*z;
|
||||
|
|
Loading…
Add table
Reference in a new issue