summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-05-10 22:25:14 -0400
committerRich Felker <dalias@aerifal.cx>2012-05-10 22:25:14 -0400
commit9cfa3065c576e83949d659df0bba59e901671bc3 (patch)
treee694573164b6ca1a2123cc2bc4b429a62f3acaa2
parent47c2a22fd6adcaf3f27b093df49bd97e3fdc16e7 (diff)
parent3738a96e052603403e085e9a1024289ba3e09188 (diff)
downloadmusl-9cfa3065c576e83949d659df0bba59e901671bc3.tar.gz
musl-9cfa3065c576e83949d659df0bba59e901671bc3.tar.bz2
musl-9cfa3065c576e83949d659df0bba59e901671bc3.tar.xz
musl-9cfa3065c576e83949d659df0bba59e901671bc3.zip
Merge remote-tracking branch 'nsz/master'
-rw-r--r--src/math/remquo.c7
-rw-r--r--src/math/remquof.c3
-rw-r--r--src/math/remquol.c3
3 files changed, 8 insertions, 5 deletions
diff --git a/src/math/remquo.c b/src/math/remquo.c
index e92984ed..085466e6 100644
--- a/src/math/remquo.c
+++ b/src/math/remquo.c
@@ -44,7 +44,7 @@ double remquo(double x, double y, int *quo)
goto fixup;
}
if (lx == ly) { /* |x| = |y| return x*0 */
- *quo = 1;
+ *quo = sxy ? -1 : 1;
return Zero[(uint32_t)sx>>31];
}
}
@@ -127,6 +127,7 @@ double remquo(double x, 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[(uint32_t)sx>>31];
}
@@ -144,10 +145,10 @@ double remquo(double x, double y, int *quo)
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:
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];
}
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];
}