am 6bc18fa5
: Merge "libm: fix invalid result of function remquo/remquof"
* commit '6bc18fa58849a4307cf6ddcfd526d9258e8175fc': libm: fix invalid result of function remquo/remquof
This commit is contained in:
commit
cebc8fb086
@ -49,7 +49,7 @@ remquo(double x, double y, int *quo)
|
||||
goto fixup; /* |x|<|y| return x or x-y */
|
||||
}
|
||||
if(lx==ly) {
|
||||
*quo = 1;
|
||||
*quo = (sxy ? -1 : 1);
|
||||
return Zero[(u_int32_t)sx>>31]; /* |x|=|y| return x*0*/
|
||||
}
|
||||
}
|
||||
@ -112,7 +112,8 @@ remquo(double x, double y, int *quo)
|
||||
|
||||
/* convert back to floating value and restore the sign */
|
||||
if((hx|lx)==0) { /* return sign(x)*0 */
|
||||
*quo = (sxy ? -q : q);
|
||||
q &= 0x7fffffff;
|
||||
*quo = (sxy ? -q : q);
|
||||
return Zero[(u_int32_t)sx>>31];
|
||||
}
|
||||
while(hx<0x00100000) { /* normalize x */
|
||||
@ -127,9 +128,9 @@ remquo(double x, double y, int *quo)
|
||||
lx = (lx>>n)|((u_int32_t)hx<<(32-n));
|
||||
hx >>= n;
|
||||
} else if (n<=31) {
|
||||
lx = (hx<<(32-n))|(lx>>n); hx = sx;
|
||||
lx = (hx<<(32-n))|(lx>>n); hx = 0;
|
||||
} else {
|
||||
lx = hx>>(n-32); hx = sx;
|
||||
lx = hx>>(n-32); hx = 0;
|
||||
}
|
||||
}
|
||||
fixup:
|
||||
|
@ -46,7 +46,7 @@ remquof(float x, float y, int *quo)
|
||||
q = 0;
|
||||
goto fixup; /* |x|<|y| return x or x-y */
|
||||
} else if(hx==hy) {
|
||||
*quo = 1;
|
||||
*quo = (sxy ? -1 : 1);
|
||||
return Zero[(u_int32_t)sx>>31]; /* |x|=|y| return x*0*/
|
||||
}
|
||||
|
||||
@ -88,7 +88,8 @@ remquof(float x, float y, int *quo)
|
||||
|
||||
/* convert back to floating value and restore the sign */
|
||||
if(hx==0) { /* return sign(x)*0 */
|
||||
*quo = (sxy ? -q : q);
|
||||
q &= 0x7fffffff;
|
||||
*quo = (sxy ? -q : q);
|
||||
return Zero[(u_int32_t)sx>>31];
|
||||
}
|
||||
while(hx<0x00800000) { /* normalize x */
|
||||
|
Loading…
Reference in New Issue
Block a user