aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2013-12-18 11:38:27 +0000
committerJoseph Myers <joseph@codesourcery.com>2013-12-18 11:38:27 +0000
commit2dec468fd82c6d968f622c2c519fcb8dc09bddac (patch)
treeebc7e3f72a6474d7aa3f6a042bb01a2917562bc3 /sysdeps
parent4d84e6addd62bdc256627af334ba85489112e008 (diff)
downloadglibc-2dec468fd82c6d968f622c2c519fcb8dc09bddac.zip
glibc-2dec468fd82c6d968f622c2c519fcb8dc09bddac.tar.gz
glibc-2dec468fd82c6d968f622c2c519fcb8dc09bddac.tar.bz2
Fix ldbl-128 logl for subnormals (bug 16338).
This patch fixes bug 16338, ldbl-128 logl not handling subnormals (with consequent inaccuracy for lgammal as well). The fix is simply to use __frexpl when determining the exponent, as done already in log2l and log10l. Given the lack of testing of small arguments to any of the log* functions, appropriate tests are added for all of them. Tested x86_64 and x86 and ulps updated accordingly, and spot tests also run for mips64 to confirm the ldbl-128 fix. Note that while this fixes lgammal inaccuracy for small positive arguments, I suspect that there will still be problems with spurious underflows in that case. * sysdeps/ieee754/ldbl-128/e_logl.c (__ieee754_logl): Use __frexpl to determine exponent and adjust argument to have exponent of -1. * math/auto-libm-test-in: Add more tests of log, log10, log1p and log2. * math/auto-libm-test-out: Regenerated. * sysdeps/x86_64/fpu/libm-test-ulps: Update.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/i386/fpu/libm-test-ulps3
-rw-r--r--sysdeps/ieee754/ldbl-128/e_logl.c5
-rw-r--r--sysdeps/x86_64/fpu/libm-test-ulps3
3 files changed, 8 insertions, 3 deletions
diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps
index ce4e631..5ed3fee 100644
--- a/sysdeps/i386/fpu/libm-test-ulps
+++ b/sysdeps/i386/fpu/libm-test-ulps
@@ -6684,6 +6684,9 @@ ldouble: 1
Test "log10 (0x2.b7e151628aed2p+0)":
ildouble: 1
ldouble: 1
+Test "log10 (0x4p-128)":
+ildouble: 1
+ldouble: 1
Test "log10 (0xcp-4)":
ildouble: 1
ldouble: 1
diff --git a/sysdeps/ieee754/ldbl-128/e_logl.c b/sysdeps/ieee754/ldbl-128/e_logl.c
index 395a763..3d1034d 100644
--- a/sysdeps/ieee754/ldbl-128/e_logl.c
+++ b/sysdeps/ieee754/ldbl-128/e_logl.c
@@ -212,9 +212,8 @@ __ieee754_logl(long double x)
}
/* Extract exponent and reduce domain to 0.703125 <= u < 1.40625 */
- e = (int) (m >> 16) - (int) 0x3ffe;
- m &= 0xffff;
- u.parts32.w0 = m | 0x3ffe0000;
+ u.value = __frexpl (x, &e);
+ m = u.parts32.w0 & 0xffff;
m |= 0x10000;
/* Find lookup table index k from high order bits of the significand. */
if (m < 0x16800)
diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
index 3985945..d36b76a 100644
--- a/sysdeps/x86_64/fpu/libm-test-ulps
+++ b/sysdeps/x86_64/fpu/libm-test-ulps
@@ -7675,6 +7675,9 @@ ldouble: 1
Test "log10 (0x2.b7e154p+0)":
float: 1
ifloat: 1
+Test "log10 (0x4p-128)":
+ildouble: 1
+ldouble: 1
Test "log10 (0xcp-4)":
double: 1
float: 2