backported fix from freebsd:
http://svnweb.FreeBSD.org/base?view=revision&revision=233973
goto fixup;
}
if (lx == ly) { /* |x| = |y| return x*0 */
- *quo = 1;
+ *quo = sxy ? -1 : 1;
return Zero[(uint32_t)sx>>31];
}
}
/* convert back to floating value and restore the sign */
if ((hx|lx) == 0) { /* return sign(x)*0 */
+ q &= 0x7fffffff;
*quo = sxy ? -q : q;
return Zero[(uint32_t)sx>>31];
}
hx >>= n;
} else if (n <= 31) {
lx = (hx<<(32-n))|(lx>>n);
- hx = sx;
+ hx = 0;
} else {
lx = hx>>(n-32);
- hx = sx;
+ hx = 0;
}
}
fixup:
q = 0;
goto fixup;
} else if(hx==hy) { /* |x| = |y| return x*0*/
- *quo = 1;
+ *quo = sxy ? -1 : 1;
return Zero[(uint32_t)sx>>31];
}
/* convert back to floating value and restore the sign */
if (hx == 0) { /* return sign(x)*0 */
+ q &= 0x7fffffff;
*quo = sxy ? -q : q;
return Zero[(uint32_t)sx>>31];
}
goto fixup; /* |x|<|y| return x or x-y */
}
if (ux.bits.manh == uy.bits.manh && ux.bits.manl == uy.bits.manl) {
- *quo = 1;
+ *quo = sxy ? -1 : 1;
return Zero[sx]; /* |x|=|y| return x*0*/
}
}
/* convert back to floating value and restore the sign */
if ((hx|lx) == 0) { /* return sign(x)*0 */
+ q &= 0x7fffffff;
*quo = sxy ? -q : q;
return Zero[sx];
}