aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/ieee754/ldbl-128ibm/s_remquol.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2016-02-19 00:55:46 +0000
committerJoseph Myers <joseph@codesourcery.com>2016-02-19 00:55:46 +0000
commit9120a57f4819965fa976d5de3b1d27b284319ed1 (patch)
tree3b5cc8cad1e09a47f23d9072009fb8545de34cfd /sysdeps/ieee754/ldbl-128ibm/s_remquol.c
parent0fed79a8279bb4d4483895a742457946faf89594 (diff)
downloadglibc-9120a57f4819965fa976d5de3b1d27b284319ed1.zip
glibc-9120a57f4819965fa976d5de3b1d27b284319ed1.tar.gz
glibc-9120a57f4819965fa976d5de3b1d27b284319ed1.tar.bz2
Fix ldbl-128ibm remainderl, remquol equality tests (bug 19603).
The ldbl-128ibm implementations of remainderl and remquol have logic resulting in incorrect tests for equality of the absolute values of the arguments. Equality is tested based on the integer representations of the high and low parts, with the sign bit masked off the high part - but when this changes the sign of the high part, the sign of the low part needs to be changed as well, and failure to do this means arguments are wrongly treated as equal when they are not. This patch fixes the logic to adjust signs of low parts as needed. Tested for powerpc. [BZ #19603] * sysdeps/ieee754/ldbl-128ibm/e_remainderl.c (__ieee754_remainderl): Adjust sign of integer version of low part when taking absolute value of high part. * sysdeps/ieee754/ldbl-128ibm/s_remquol.c (__remquol): Likewise. * math/libm-test.inc (remainder_test_data): Add another test. (remquo_test_data): Likewise.
Diffstat (limited to 'sysdeps/ieee754/ldbl-128ibm/s_remquol.c')
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_remquol.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_remquol.c b/sysdeps/ieee754/ldbl-128ibm/s_remquol.c
index 20e17cc..14b27ca 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_remquol.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_remquol.c
@@ -43,7 +43,9 @@ __remquol (long double x, long double y, int *quo)
EXTRACT_WORDS64 (ly, ylo);
sx = hx & 0x8000000000000000ULL;
qs = sx ^ (hy & 0x8000000000000000ULL);
+ ly ^= hy & 0x8000000000000000ULL;
hy &= 0x7fffffffffffffffLL;
+ lx ^= sx;
hx &= 0x7fffffffffffffffLL;
/* Purge off exception values. */