summaryrefslogtreecommitdiff
path: root/src/math/remquof.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/remquof.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/remquof.c')
-rw-r--r--src/math/remquof.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/math/remquof.c b/src/math/remquof.c
index 11569ce8..536a050a 100644
--- a/src/math/remquof.c
+++ b/src/math/remquof.c
@@ -41,7 +41,7 @@ float remquof(float x, float y, int *quo)
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];
}
@@ -92,6 +92,7 @@ float remquof(float x, float y, int *quo)
/* 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];
}