aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/i386
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2016-06-03 21:30:12 +0000
committerJoseph Myers <joseph@codesourcery.com>2016-06-03 21:30:12 +0000
commit8cbd1453ec1c59e54652edcd88256f4023ff77b9 (patch)
treefd75adff737c0b9172a5e59d2307d36e5190afe8 /sysdeps/i386
parentcfac4de69cc70fbd6364e58cf77891a7a30f2e09 (diff)
downloadglibc-8cbd1453ec1c59e54652edcd88256f4023ff77b9.tar
glibc-8cbd1453ec1c59e54652edcd88256f4023ff77b9.tar.gz
glibc-8cbd1453ec1c59e54652edcd88256f4023ff77b9.tar.bz2
glibc-8cbd1453ec1c59e54652edcd88256f4023ff77b9.zip
Fix x86/x86_64 nextafterl incrementing negative subnormals (bug 20205).
The x86 / x86_64 implementation of nextafterl (also used for nexttowardl) produces incorrect results (NaNs) when negative subnormals, the low 32 bits of whose mantissa are zero, are incremented towards zero. This patch fixes this by disabling the logic to decrement the exponent in that case. Tested for x86_64 and x86. [BZ #20205] * sysdeps/i386/fpu/s_nextafterl.c (__nextafterl): Do not adjust exponent when incrementing negative subnormal with low mantissa word zero. * math/libm-test.inc (nextafter_test_data) [TEST_COND_intel96]: Add another test.
Diffstat (limited to 'sysdeps/i386')
-rw-r--r--sysdeps/i386/fpu/s_nextafterl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sysdeps/i386/fpu/s_nextafterl.c b/sysdeps/i386/fpu/s_nextafterl.c
index 188dc2129a..600ad7a8d3 100644
--- a/sysdeps/i386/fpu/s_nextafterl.c
+++ b/sysdeps/i386/fpu/s_nextafterl.c
@@ -86,7 +86,7 @@ long double __nextafterl(long double x, long double y)
if(esy>=0||(esx>esy||((esx==esy)&&(hx>hy||((hx==hy)&&(lx>ly)))))){
/* x < y, x -= ulp */
if(lx==0) {
- if (hx <= 0x80000000) {
+ if (hx <= 0x80000000 && esx != 0xffff8000) {
esx -= 1;
hx = hx - 1;
if ((esx&0x7fff) > 0)