summaryrefslogtreecommitdiff
path: root/src/math/remquol.c
diff options
context:
space:
mode:
authornsz <nsz@port70.net>2012-05-08 00:22:56 +0200
committernsz <nsz@port70.net>2012-05-08 00:22:56 +0200
commit3738a96e052603403e085e9a1024289ba3e09188 (patch)
treefb183fb5fc9f79797bd38f87aa7f51261ef9da44 /src/math/remquol.c
parent0e195dfaa4902a73179f7ab296d47f01d3518ad3 (diff)
downloadmusl-3738a96e052603403e085e9a1024289ba3e09188.tar.gz
math: fix remquo.c when x==-y and a subnormal remainder bug as well
backported fix from freebsd: http://svnweb.FreeBSD.org/base?view=revision&revision=233973
Diffstat (limited to 'src/math/remquol.c')
-rw-r--r--src/math/remquol.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/math/remquol.c b/src/math/remquol.c
index 721231b4..a2e11728 100644
--- a/src/math/remquol.c
+++ b/src/math/remquol.c
@@ -94,7 +94,7 @@ long double 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*/
}
}
@@ -152,6 +152,7 @@ long double 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];
}