diff options
author | das <das@FreeBSD.org> | 2012-04-07 03:59:12 +0000 |
---|---|---|
committer | das <das@FreeBSD.org> | 2012-04-07 03:59:12 +0000 |
commit | 5d2625f37f906b2187ea184cba9c2cc28f46d988 (patch) | |
tree | e8eaea781c54d66892fb03412a3054c69976c30c /lib/msun/src/s_remquol.c | |
parent | 89f805c29a4e922e5a7d624cd548006901e33ee7 (diff) | |
download | FreeBSD-src-5d2625f37f906b2187ea184cba9c2cc28f46d988.zip FreeBSD-src-5d2625f37f906b2187ea184cba9c2cc28f46d988.tar.gz |
Fix a bug in remquo{,f,l}, in which the quotient didn't always have the
correct sign when the remainder was 0.
Fix a separate bug in remquo alone, in which the remainder and
quotient were both off by a bit in certain cases involving subnormal
remainders.
The bugs affected all platforms except amd64 and i386, on which the
routines are implemented in assembly.
PR: 166463
Submitted by: Ilya Burylov
MFC after: 2 weeks
Diffstat (limited to 'lib/msun/src/s_remquol.c')
-rw-r--r-- | lib/msun/src/s_remquol.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/msun/src/s_remquol.c b/lib/msun/src/s_remquol.c index 9f5b578..712651c 100644 --- a/lib/msun/src/s_remquol.c +++ b/lib/msun/src/s_remquol.c @@ -96,7 +96,7 @@ remquol(long double x, long double y, int *quo) 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*/ } } @@ -138,6 +138,7 @@ remquol(long double x, long double y, int *quo) /* 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]; } |