aboutsummaryrefslogtreecommitdiff
path: root/math
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2014-06-24 21:00:08 +0000
committerJoseph Myers <joseph@codesourcery.com>2014-06-24 21:00:08 +0000
commit4060283decf711ed95a6c4993ffeaba39f8cd40a (patch)
treed303f8bcf7bd9fafbbb5edddc48c7c2be827f84e /math
parente7dd3c8c1db8c6d293abb995e033893b7328ad19 (diff)
downloadglibc-4060283decf711ed95a6c4993ffeaba39f8cd40a.tar
glibc-4060283decf711ed95a6c4993ffeaba39f8cd40a.tar.gz
glibc-4060283decf711ed95a6c4993ffeaba39f8cd40a.tar.bz2
glibc-4060283decf711ed95a6c4993ffeaba39f8cd40a.zip
Fix x86/x86_64 expm1l spurious underflow exceptions (bug 16539).
This patch fixes bug 16539, spurious underflow exceptions from x86 / x86-64 expm1l. The problem is that the computation of a base-2 exponent with extra precision involves spurious underflows for arguments that are small but not subnormal, so a check is added to just return the argument in those cases. (If the argument *is* subnormal, underflowing is correct and the existing code will always underflow, so it suffices to keep using the existing code in that case; some expm1 implementations have a bug (bug 16353) with missing underflow exceptions, but I don't think there's such a bug in this particular version.) Tested x86_64 and x86; no ulps updates needed. (auto-libm-test-out diffs omitted below.) [BZ #16539] * sysdeps/i386/fpu/e_expl.S (IEEE754_EXPL) [USE_AS_EXPM1L]: Just return the argument for normal arguments with exponent below -64. * sysdeps/x86_64/fpu/e_expl.S (IEEE754_EXPL) [USE_AS_EXPM1L]: Likewise. * math/auto-libm-test-in: Add another test of expm1. * math/auto-libm-test-out: Regenerated.
Diffstat (limited to 'math')
-rw-r--r--math/auto-libm-test-in2
-rw-r--r--math/auto-libm-test-out81
2 files changed, 83 insertions, 0 deletions
diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in
index 79d276ce99..f36d200df5 100644
--- a/math/auto-libm-test-in
+++ b/math/auto-libm-test-in
@@ -970,6 +970,8 @@ expm1 0x1p-64
expm1 -0x1p-64
expm1 0x1p-100
expm1 -0x1p-100
+# Bug 16353: underflow exception may be missing
+expm1 0x4.0000000000000028p-16384 missing-underflow
fma 1.0 2.0 3.0
fma 1.25 0.75 0.0625
diff --git a/math/auto-libm-test-out b/math/auto-libm-test-out
index d1ec2be279..ced5283ab2 100644
--- a/math/auto-libm-test-out
+++ b/math/auto-libm-test-out
@@ -93045,6 +93045,87 @@ expm1 -0x1p-100
= expm1 tonearest ldbl-128ibm -0x1p-100L : -0xf.ffffffffffffffffffffffff8p-104L : inexact-ok
= expm1 towardzero ldbl-128ibm -0x1p-100L : -0xf.ffffffffffffffffffffffff8p-104L : inexact-ok
= expm1 upward ldbl-128ibm -0x1p-100L : -0xf.ffffffffffffffffffffffff8p-104L : inexact-ok
+expm1 0x4.0000000000000028p-16384 missing-underflow
+= expm1 downward flt-32 0x8p-152f : 0x8p-152f : inexact-ok underflow underflow-ok errno-erange-ok
+= expm1 tonearest flt-32 0x8p-152f : 0x8p-152f : inexact-ok underflow underflow-ok errno-erange-ok
+= expm1 towardzero flt-32 0x8p-152f : 0x8p-152f : inexact-ok underflow underflow-ok errno-erange-ok
+= expm1 upward flt-32 0x8p-152f : 0x1p-148f : inexact-ok underflow underflow-ok errno-erange-ok
+= expm1 downward dbl-64 0x8p-152 : 0x8p-152 : inexact-ok
+= expm1 tonearest dbl-64 0x8p-152 : 0x8p-152 : inexact-ok
+= expm1 towardzero dbl-64 0x8p-152 : 0x8p-152 : inexact-ok
+= expm1 upward dbl-64 0x8p-152 : 0x8.0000000000008p-152 : inexact-ok
+= expm1 downward ldbl-96-intel 0x8p-152L : 0x8p-152L : inexact-ok
+= expm1 tonearest ldbl-96-intel 0x8p-152L : 0x8p-152L : inexact-ok
+= expm1 towardzero ldbl-96-intel 0x8p-152L : 0x8p-152L : inexact-ok
+= expm1 upward ldbl-96-intel 0x8p-152L : 0x8.000000000000001p-152L : inexact-ok
+= expm1 downward ldbl-96-m68k 0x8p-152L : 0x8p-152L : inexact-ok
+= expm1 tonearest ldbl-96-m68k 0x8p-152L : 0x8p-152L : inexact-ok
+= expm1 towardzero ldbl-96-m68k 0x8p-152L : 0x8p-152L : inexact-ok
+= expm1 upward ldbl-96-m68k 0x8p-152L : 0x8.000000000000001p-152L : inexact-ok
+= expm1 downward ldbl-128 0x8p-152L : 0x8p-152L : inexact-ok
+= expm1 tonearest ldbl-128 0x8p-152L : 0x8p-152L : inexact-ok
+= expm1 towardzero ldbl-128 0x8p-152L : 0x8p-152L : inexact-ok
+= expm1 upward ldbl-128 0x8p-152L : 0x8.0000000000000000000000000008p-152L : inexact-ok
+= expm1 downward ldbl-128ibm 0x8p-152L : 0x8p-152L : inexact-ok
+= expm1 tonearest ldbl-128ibm 0x8p-152L : 0x8p-152L : inexact-ok
+= expm1 towardzero ldbl-128ibm 0x8p-152L : 0x8p-152L : inexact-ok
+= expm1 upward ldbl-128ibm 0x8p-152L : 0x8.00000000000000000000000004p-152L : inexact-ok
+= expm1 downward flt-32 0x0p+0f : 0x0p+0f : inexact-ok
+= expm1 tonearest flt-32 0x0p+0f : 0x0p+0f : inexact-ok
+= expm1 towardzero flt-32 0x0p+0f : 0x0p+0f : inexact-ok
+= expm1 upward flt-32 0x0p+0f : 0x0p+0f : inexact-ok
+= expm1 downward dbl-64 0x0p+0 : 0x0p+0 : inexact-ok
+= expm1 tonearest dbl-64 0x0p+0 : 0x0p+0 : inexact-ok
+= expm1 towardzero dbl-64 0x0p+0 : 0x0p+0 : inexact-ok
+= expm1 upward dbl-64 0x0p+0 : 0x0p+0 : inexact-ok
+= expm1 downward ldbl-96-intel 0x0p+0L : 0x0p+0L : inexact-ok
+= expm1 tonearest ldbl-96-intel 0x0p+0L : 0x0p+0L : inexact-ok
+= expm1 towardzero ldbl-96-intel 0x0p+0L : 0x0p+0L : inexact-ok
+= expm1 upward ldbl-96-intel 0x0p+0L : 0x0p+0L : inexact-ok
+= expm1 downward ldbl-96-m68k 0x0p+0L : 0x0p+0L : inexact-ok
+= expm1 tonearest ldbl-96-m68k 0x0p+0L : 0x0p+0L : inexact-ok
+= expm1 towardzero ldbl-96-m68k 0x0p+0L : 0x0p+0L : inexact-ok
+= expm1 upward ldbl-96-m68k 0x0p+0L : 0x0p+0L : inexact-ok
+= expm1 downward ldbl-128 0x0p+0L : 0x0p+0L : inexact-ok
+= expm1 tonearest ldbl-128 0x0p+0L : 0x0p+0L : inexact-ok
+= expm1 towardzero ldbl-128 0x0p+0L : 0x0p+0L : inexact-ok
+= expm1 upward ldbl-128 0x0p+0L : 0x0p+0L : inexact-ok
+= expm1 downward ldbl-128ibm 0x0p+0L : 0x0p+0L : inexact-ok
+= expm1 tonearest ldbl-128ibm 0x0p+0L : 0x0p+0L : inexact-ok
+= expm1 towardzero ldbl-128ibm 0x0p+0L : 0x0p+0L : inexact-ok
+= expm1 upward ldbl-128ibm 0x0p+0L : 0x0p+0L : inexact-ok
+= expm1 downward dbl-64 0x4p-1076 : 0x4p-1076 : inexact-ok underflow underflow-ok errno-erange-ok
+= expm1 tonearest dbl-64 0x4p-1076 : 0x4p-1076 : inexact-ok underflow underflow-ok errno-erange-ok
+= expm1 towardzero dbl-64 0x4p-1076 : 0x4p-1076 : inexact-ok underflow underflow-ok errno-erange-ok
+= expm1 upward dbl-64 0x4p-1076 : 0x8p-1076 : inexact-ok underflow underflow-ok errno-erange-ok
+= expm1 downward ldbl-96-intel 0x4p-1076L : 0x4p-1076L : inexact-ok
+= expm1 tonearest ldbl-96-intel 0x4p-1076L : 0x4p-1076L : inexact-ok
+= expm1 towardzero ldbl-96-intel 0x4p-1076L : 0x4p-1076L : inexact-ok
+= expm1 upward ldbl-96-intel 0x4p-1076L : 0x4.0000000000000008p-1076L : inexact-ok
+= expm1 downward ldbl-96-m68k 0x4p-1076L : 0x4p-1076L : inexact-ok
+= expm1 tonearest ldbl-96-m68k 0x4p-1076L : 0x4p-1076L : inexact-ok
+= expm1 towardzero ldbl-96-m68k 0x4p-1076L : 0x4p-1076L : inexact-ok
+= expm1 upward ldbl-96-m68k 0x4p-1076L : 0x4.0000000000000008p-1076L : inexact-ok
+= expm1 downward ldbl-128 0x4p-1076L : 0x4p-1076L : inexact-ok
+= expm1 tonearest ldbl-128 0x4p-1076L : 0x4p-1076L : inexact-ok
+= expm1 towardzero ldbl-128 0x4p-1076L : 0x4p-1076L : inexact-ok
+= expm1 upward ldbl-128 0x4p-1076L : 0x4.0000000000000000000000000004p-1076L : inexact-ok
+= expm1 downward ldbl-128ibm 0x4p-1076L : 0x4p-1076L : inexact-ok underflow underflow-ok errno-erange-ok
+= expm1 tonearest ldbl-128ibm 0x4p-1076L : 0x4p-1076L : inexact-ok underflow underflow-ok errno-erange-ok
+= expm1 towardzero ldbl-128ibm 0x4p-1076L : 0x4p-1076L : inexact-ok underflow underflow-ok errno-erange-ok
+= expm1 upward ldbl-128ibm 0x4p-1076L : 0x8p-1076L : inexact-ok underflow underflow-ok errno-erange-ok
+= expm1 downward ldbl-96-intel 0x4.0000000000000028p-16384L : 0x4.0000000000000028p-16384L : inexact-ok
+= expm1 tonearest ldbl-96-intel 0x4.0000000000000028p-16384L : 0x4.0000000000000028p-16384L : inexact-ok
+= expm1 towardzero ldbl-96-intel 0x4.0000000000000028p-16384L : 0x4.0000000000000028p-16384L : inexact-ok
+= expm1 upward ldbl-96-intel 0x4.0000000000000028p-16384L : 0x4.000000000000003p-16384L : inexact-ok
+= expm1 downward ldbl-96-m68k 0x4.0000000000000028p-16384L : 0x4.0000000000000028p-16384L : inexact-ok
+= expm1 tonearest ldbl-96-m68k 0x4.0000000000000028p-16384L : 0x4.0000000000000028p-16384L : inexact-ok
+= expm1 towardzero ldbl-96-m68k 0x4.0000000000000028p-16384L : 0x4.0000000000000028p-16384L : inexact-ok
+= expm1 upward ldbl-96-m68k 0x4.0000000000000028p-16384L : 0x4.000000000000003p-16384L : inexact-ok
+= expm1 downward ldbl-128 0x4.0000000000000028p-16384L : 0x4.0000000000000028p-16384L : inexact-ok
+= expm1 tonearest ldbl-128 0x4.0000000000000028p-16384L : 0x4.0000000000000028p-16384L : inexact-ok
+= expm1 towardzero ldbl-128 0x4.0000000000000028p-16384L : 0x4.0000000000000028p-16384L : inexact-ok
+= expm1 upward ldbl-128 0x4.0000000000000028p-16384L : 0x4.0000000000000028000000000004p-16384L : inexact-ok
fma 1.0 2.0 3.0
= fma downward flt-32 0x1p+0f 0x2p+0f 0x3p+0f : 0x5p+0f :
= fma tonearest flt-32 0x1p+0f 0x2p+0f 0x3p+0f : 0x5p+0f :