aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/ieee754
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2015-05-19 23:44:28 +0000
committerJoseph Myers <joseph@codesourcery.com>2015-05-19 23:44:28 +0000
commit3ce2232efb008e129908b9f35c4266991d9361de (patch)
treea479c93a0470a331434f1c96b0f365151e7bbd95 /sysdeps/ieee754
parent526af54142db14c1edcd2d80dc1b56d33ff4e8ce (diff)
downloadglibc-3ce2232efb008e129908b9f35c4266991d9361de.zip
glibc-3ce2232efb008e129908b9f35c4266991d9361de.tar.gz
glibc-3ce2232efb008e129908b9f35c4266991d9361de.tar.bz2
Fix ldbl-96 remquol (finite, Inf) (bug 18244).
ldbl-96 remquol wrongly handles the case where the first argument is finite and the second infinite, because the check for the second argument being a NaN fails to disregard the explicit high mantissa bit and so wrongly interprets an infinity as being a NaN. This patch fixes this by masking off that bit, and improves test coverage for both remainder and remquo (various cases were missing tests, or, as in the case of the bug, were tested only for one of the two functions). Tested for x86_64 and x86. [BZ #18244] * sysdeps/ieee754/ldbl-96/s_remquol.c (__remquol): Ignore explicit high mantissa bit when testing whether P is a NaN. * math/libm-test.inc (remainder_test_data): Add more tests. (remquo_test_data): Likewise.
Diffstat (limited to 'sysdeps/ieee754')
-rw-r--r--sysdeps/ieee754/ldbl-96/s_remquol.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sysdeps/ieee754/ldbl-96/s_remquol.c b/sysdeps/ieee754/ldbl-96/s_remquol.c
index 8d6b10e..230d0fa 100644
--- a/sysdeps/ieee754/ldbl-96/s_remquol.c
+++ b/sysdeps/ieee754/ldbl-96/s_remquol.c
@@ -44,7 +44,7 @@ __remquol (long double x, long double p, int *quo)
return (x * p) / (x * p); /* p = 0 */
if ((ex == 0x7fff) /* x not finite */
|| ((ep == 0x7fff) /* p is NaN */
- && ((hp | lp) != 0)))
+ && (((hp & 0x7fffffff) | lp) != 0)))
return (x * p) / (x * p);
if (ep <= 0x7ffb)