about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2015-09-15 16:50:02 +0000
committerJoseph Myers <joseph@codesourcery.com>2015-09-15 16:50:02 +0000
commit828bf6828b048b1482e95f84ca92e5fe0edcdc0c (patch)
treeeb047446bae21ae21674f282ec3970a75dbb9362
parent333ceaa54bc27de48fc6eecc7b0a3e75a0c5ce50 (diff)
downloadglibc-828bf6828b048b1482e95f84ca92e5fe0edcdc0c.tar.gz
glibc-828bf6828b048b1482e95f84ca92e5fe0edcdc0c.tar.xz
glibc-828bf6828b048b1482e95f84ca92e5fe0edcdc0c.zip
Fix i386 exp10 missing underflows (bug 18966).
On i386, the double version of exp10 can miss underflow exceptions if
the result is in the subnormal range for double but the last 11 bits
of the 64-bit extended-precision mantissa happen to be zero.  This
patch forces the exception in a similar way to previous fixes.

As with the exp2 and exp fixes, the exp10f changes may in fact not be
needed to ensure underflow exceptions, but are included for
consistency and to fix the exp10 part of bug 18875 by ensuring that
excess range and precision is removed from underflowing return values.

Tested for x86_64 and x86.

	[BZ #18875]
	[BZ #18966]
	* sysdeps/i386/fpu/e_exp10.S (dbl_min): New object.
	(MO): New macro.
	(__ieee754_exp10): For small results, force underflow exception
	and remove excess range and precision from return value.
	* sysdeps/i386/fpu/e_exp10f.S (flt_min): New object.
	(MO): New macro.
	(__ieee754_exp10f): For small results, force underflow exception
	and remove excess range and precision from return value.
	* math/auto-libm-test-in: Add more tests of exp10.
	* math/auto-libm-test-out: Regenerated.
-rw-r--r--ChangeLog15
-rw-r--r--NEWS3
-rw-r--r--math/auto-libm-test-in3
-rw-r--r--math/auto-libm-test-out163
-rw-r--r--sysdeps/i386/fpu/e_exp10.S34
-rw-r--r--sysdeps/i386/fpu/e_exp10f.S34
6 files changed, 249 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 0db4f569e5..4d6f2bb313 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2015-09-15  Joseph Myers  <joseph@codesourcery.com>
+
+	[BZ #18875]
+	[BZ #18966]
+	* sysdeps/i386/fpu/e_exp10.S (dbl_min): New object.
+	(MO): New macro.
+	(__ieee754_exp10): For small results, force underflow exception
+	and remove excess range and precision from return value.
+	* sysdeps/i386/fpu/e_exp10f.S (flt_min): New object.
+	(MO): New macro.
+	(__ieee754_exp10f): For small results, force underflow exception
+	and remove excess range and precision from return value.
+	* math/auto-libm-test-in: Add more tests of exp10.
+	* math/auto-libm-test-out: Regenerated.
+
 2015-09-14  Joseph Myers  <joseph@codesourcery.com>
 
 	[BZ #18875]
diff --git a/NEWS b/NEWS
index 4ad8ab734e..f782af359e 100644
--- a/NEWS
+++ b/NEWS
@@ -13,7 +13,8 @@ Version 2.23
   16521, 16734, 16973, 16985, 17787, 17905, 18084, 18086, 18240, 18265,
   18370, 18421, 18480, 18525, 18610, 18618, 18647, 18661, 18674, 18675,
   18681, 18757, 18778, 18781, 18787, 18789, 18790, 18795, 18796, 18820,
-  18823, 18824, 18863, 18870, 18873, 18887, 18921, 18952, 18961.
+  18823, 18824, 18863, 18870, 18873, 18875, 18887, 18921, 18952, 18961,
+  18966.
 
 * The obsolete header <regexp.h> has been removed.  Programs that require
   this header must be updated to use <regex.h> instead.
diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in
index 9da01fb1fa..4a8017c49a 100644
--- a/math/auto-libm-test-in
+++ b/math/auto-libm-test-in
@@ -1458,6 +1458,9 @@ exp10 -max
 exp10 0.75
 # GCC bug 59666: results on directed rounding may be incorrect.
 exp10 0x1.348e45573a1dd72cp+8 xfail-rounding:ldbl-128ibm
+exp10 -0x1.33aa03p+8
+exp10 -0x1.33ad17p+8
+exp10 -0x1.33afcap+8
 exp10 0x1p-10
 exp10 -0x1p-10
 exp10 0x1p-20
diff --git a/math/auto-libm-test-out b/math/auto-libm-test-out
index c539498295..a93b7c432f 100644
--- a/math/auto-libm-test-out
+++ b/math/auto-libm-test-out
@@ -116962,6 +116962,169 @@ exp10 0x1.348e45573a1dd72cp+8 xfail-rounding:ldbl-128ibm
 = exp10 tonearest ldbl-128ibm 0x1.348e45573a1dd72cp+8L : plus_infty : inexact-ok overflow errno-erange
 = exp10 towardzero ldbl-128ibm 0x1.348e45573a1dd72cp+8L : 0xf.ffffffffffffbffffffffffffcp+1020L : xfail:ldbl-128ibm inexact-ok overflow errno-erange-ok
 = exp10 upward ldbl-128ibm 0x1.348e45573a1dd72cp+8L : plus_infty : xfail:ldbl-128ibm inexact-ok overflow errno-erange
+exp10 -0x1.33aa03p+8
+= exp10 downward flt-32 -0x1.33aa02p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp10 tonearest flt-32 -0x1.33aa02p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp10 towardzero flt-32 -0x1.33aa02p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp10 upward flt-32 -0x1.33aa02p+8f : 0x8p-152f : inexact-ok underflow errno-erange-ok
+= exp10 downward dbl-64 -0x1.33aa02p+8 : 0x3.e5625e7a42198p-1024 : inexact-ok underflow errno-erange-ok
+= exp10 tonearest dbl-64 -0x1.33aa02p+8 : 0x3.e5625e7a4219cp-1024 : inexact-ok underflow errno-erange-ok
+= exp10 towardzero dbl-64 -0x1.33aa02p+8 : 0x3.e5625e7a42198p-1024 : inexact-ok underflow errno-erange-ok
+= exp10 upward dbl-64 -0x1.33aa02p+8 : 0x3.e5625e7a4219cp-1024 : inexact-ok underflow errno-erange-ok
+= exp10 downward ldbl-96-intel -0x1.33aa02p+8L : 0x3.e5625e7a4219b1fp-1024L : inexact-ok
+= exp10 tonearest ldbl-96-intel -0x1.33aa02p+8L : 0x3.e5625e7a4219b1f4p-1024L : inexact-ok
+= exp10 towardzero ldbl-96-intel -0x1.33aa02p+8L : 0x3.e5625e7a4219b1fp-1024L : inexact-ok
+= exp10 upward ldbl-96-intel -0x1.33aa02p+8L : 0x3.e5625e7a4219b1f4p-1024L : inexact-ok
+= exp10 downward ldbl-96-m68k -0x1.33aa02p+8L : 0x3.e5625e7a4219b1fp-1024L : inexact-ok
+= exp10 tonearest ldbl-96-m68k -0x1.33aa02p+8L : 0x3.e5625e7a4219b1f4p-1024L : inexact-ok
+= exp10 towardzero ldbl-96-m68k -0x1.33aa02p+8L : 0x3.e5625e7a4219b1fp-1024L : inexact-ok
+= exp10 upward ldbl-96-m68k -0x1.33aa02p+8L : 0x3.e5625e7a4219b1f4p-1024L : inexact-ok
+= exp10 downward ldbl-128 -0x1.33aa02p+8L : 0x3.e5625e7a4219b1f23b7f41e1933cp-1024L : inexact-ok
+= exp10 tonearest ldbl-128 -0x1.33aa02p+8L : 0x3.e5625e7a4219b1f23b7f41e1933ep-1024L : inexact-ok
+= exp10 towardzero ldbl-128 -0x1.33aa02p+8L : 0x3.e5625e7a4219b1f23b7f41e1933cp-1024L : inexact-ok
+= exp10 upward ldbl-128 -0x1.33aa02p+8L : 0x3.e5625e7a4219b1f23b7f41e1933ep-1024L : inexact-ok
+= exp10 downward ldbl-128ibm -0x1.33aa02p+8L : 0x3.e5625e7a42198p-1024L : inexact-ok underflow errno-erange-ok
+= exp10 tonearest ldbl-128ibm -0x1.33aa02p+8L : 0x3.e5625e7a4219cp-1024L : inexact-ok underflow errno-erange-ok
+= exp10 towardzero ldbl-128ibm -0x1.33aa02p+8L : 0x3.e5625e7a42198p-1024L : inexact-ok underflow errno-erange-ok
+= exp10 upward ldbl-128ibm -0x1.33aa02p+8L : 0x3.e5625e7a4219cp-1024L : inexact-ok underflow errno-erange-ok
+= exp10 downward flt-32 -0x1.33aa04p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp10 tonearest flt-32 -0x1.33aa04p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp10 towardzero flt-32 -0x1.33aa04p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp10 upward flt-32 -0x1.33aa04p+8f : 0x8p-152f : inexact-ok underflow errno-erange-ok
+= exp10 downward dbl-64 -0x1.33aa04p+8 : 0x3.e5506d83c44ecp-1024 : inexact-ok underflow errno-erange-ok
+= exp10 tonearest dbl-64 -0x1.33aa04p+8 : 0x3.e5506d83c44fp-1024 : inexact-ok underflow errno-erange-ok
+= exp10 towardzero dbl-64 -0x1.33aa04p+8 : 0x3.e5506d83c44ecp-1024 : inexact-ok underflow errno-erange-ok
+= exp10 upward dbl-64 -0x1.33aa04p+8 : 0x3.e5506d83c44fp-1024 : inexact-ok underflow errno-erange-ok
+= exp10 downward ldbl-96-intel -0x1.33aa04p+8L : 0x3.e5506d83c44ee174p-1024L : inexact-ok
+= exp10 tonearest ldbl-96-intel -0x1.33aa04p+8L : 0x3.e5506d83c44ee174p-1024L : inexact-ok
+= exp10 towardzero ldbl-96-intel -0x1.33aa04p+8L : 0x3.e5506d83c44ee174p-1024L : inexact-ok
+= exp10 upward ldbl-96-intel -0x1.33aa04p+8L : 0x3.e5506d83c44ee178p-1024L : inexact-ok
+= exp10 downward ldbl-96-m68k -0x1.33aa04p+8L : 0x3.e5506d83c44ee174p-1024L : inexact-ok
+= exp10 tonearest ldbl-96-m68k -0x1.33aa04p+8L : 0x3.e5506d83c44ee174p-1024L : inexact-ok
+= exp10 towardzero ldbl-96-m68k -0x1.33aa04p+8L : 0x3.e5506d83c44ee174p-1024L : inexact-ok
+= exp10 upward ldbl-96-m68k -0x1.33aa04p+8L : 0x3.e5506d83c44ee178p-1024L : inexact-ok
+= exp10 downward ldbl-128 -0x1.33aa04p+8L : 0x3.e5506d83c44ee174a1cd22369ecep-1024L : inexact-ok
+= exp10 tonearest ldbl-128 -0x1.33aa04p+8L : 0x3.e5506d83c44ee174a1cd22369ecep-1024L : inexact-ok
+= exp10 towardzero ldbl-128 -0x1.33aa04p+8L : 0x3.e5506d83c44ee174a1cd22369ecep-1024L : inexact-ok
+= exp10 upward ldbl-128 -0x1.33aa04p+8L : 0x3.e5506d83c44ee174a1cd22369edp-1024L : inexact-ok
+= exp10 downward ldbl-128ibm -0x1.33aa04p+8L : 0x3.e5506d83c44ecp-1024L : inexact-ok underflow errno-erange-ok
+= exp10 tonearest ldbl-128ibm -0x1.33aa04p+8L : 0x3.e5506d83c44fp-1024L : inexact-ok underflow errno-erange-ok
+= exp10 towardzero ldbl-128ibm -0x1.33aa04p+8L : 0x3.e5506d83c44ecp-1024L : inexact-ok underflow errno-erange-ok
+= exp10 upward ldbl-128ibm -0x1.33aa04p+8L : 0x3.e5506d83c44fp-1024L : inexact-ok underflow errno-erange-ok
+= exp10 downward dbl-64 -0x1.33aa03p+8 : 0x3.e55965f4af484p-1024 : inexact-ok underflow errno-erange-ok
+= exp10 tonearest dbl-64 -0x1.33aa03p+8 : 0x3.e55965f4af484p-1024 : inexact-ok underflow errno-erange-ok
+= exp10 towardzero dbl-64 -0x1.33aa03p+8 : 0x3.e55965f4af484p-1024 : inexact-ok underflow errno-erange-ok
+= exp10 upward dbl-64 -0x1.33aa03p+8 : 0x3.e55965f4af488p-1024 : inexact-ok underflow errno-erange-ok
+= exp10 downward ldbl-96-intel -0x1.33aa03p+8L : 0x3.e55965f4af4844bp-1024L : inexact-ok
+= exp10 tonearest ldbl-96-intel -0x1.33aa03p+8L : 0x3.e55965f4af4844bp-1024L : inexact-ok
+= exp10 towardzero ldbl-96-intel -0x1.33aa03p+8L : 0x3.e55965f4af4844bp-1024L : inexact-ok
+= exp10 upward ldbl-96-intel -0x1.33aa03p+8L : 0x3.e55965f4af4844b4p-1024L : inexact-ok
+= exp10 downward ldbl-96-m68k -0x1.33aa03p+8L : 0x3.e55965f4af4844bp-1024L : inexact-ok
+= exp10 tonearest ldbl-96-m68k -0x1.33aa03p+8L : 0x3.e55965f4af4844bp-1024L : inexact-ok
+= exp10 towardzero ldbl-96-m68k -0x1.33aa03p+8L : 0x3.e55965f4af4844bp-1024L : inexact-ok
+= exp10 upward ldbl-96-m68k -0x1.33aa03p+8L : 0x3.e55965f4af4844b4p-1024L : inexact-ok
+= exp10 downward ldbl-128 -0x1.33aa03p+8L : 0x3.e55965f4af4844b0187da80e25ep-1024L : inexact-ok
+= exp10 tonearest ldbl-128 -0x1.33aa03p+8L : 0x3.e55965f4af4844b0187da80e25ep-1024L : inexact-ok
+= exp10 towardzero ldbl-128 -0x1.33aa03p+8L : 0x3.e55965f4af4844b0187da80e25ep-1024L : inexact-ok
+= exp10 upward ldbl-128 -0x1.33aa03p+8L : 0x3.e55965f4af4844b0187da80e25e2p-1024L : inexact-ok
+= exp10 downward ldbl-128ibm -0x1.33aa03p+8L : 0x3.e55965f4af484p-1024L : inexact-ok underflow errno-erange-ok
+= exp10 tonearest ldbl-128ibm -0x1.33aa03p+8L : 0x3.e55965f4af484p-1024L : inexact-ok underflow errno-erange-ok
+= exp10 towardzero ldbl-128ibm -0x1.33aa03p+8L : 0x3.e55965f4af484p-1024L : inexact-ok underflow errno-erange-ok
+= exp10 upward ldbl-128ibm -0x1.33aa03p+8L : 0x3.e55965f4af488p-1024L : inexact-ok underflow errno-erange-ok
+exp10 -0x1.33ad17p+8
+= exp10 downward flt-32 -0x1.33ad16p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp10 tonearest flt-32 -0x1.33ad16p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp10 towardzero flt-32 -0x1.33ad16p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp10 upward flt-32 -0x1.33ad16p+8f : 0x8p-152f : inexact-ok underflow errno-erange-ok
+= exp10 downward dbl-64 -0x1.33ad16p+8 : 0x3.ca263994bd44p-1024 : inexact-ok underflow errno-erange-ok
+= exp10 tonearest dbl-64 -0x1.33ad16p+8 : 0x3.ca263994bd44p-1024 : inexact-ok underflow errno-erange-ok
+= exp10 towardzero dbl-64 -0x1.33ad16p+8 : 0x3.ca263994bd44p-1024 : inexact-ok underflow errno-erange-ok
+= exp10 upward dbl-64 -0x1.33ad16p+8 : 0x3.ca263994bd444p-1024 : inexact-ok underflow errno-erange-ok
+= exp10 downward ldbl-96-intel -0x1.33ad16p+8L : 0x3.ca263994bd441e7cp-1024L : inexact-ok
+= exp10 tonearest ldbl-96-intel -0x1.33ad16p+8L : 0x3.ca263994bd441e7cp-1024L : inexact-ok
+= exp10 towardzero ldbl-96-intel -0x1.33ad16p+8L : 0x3.ca263994bd441e7cp-1024L : inexact-ok
+= exp10 upward ldbl-96-intel -0x1.33ad16p+8L : 0x3.ca263994bd441e8p-1024L : inexact-ok
+= exp10 downward ldbl-96-m68k -0x1.33ad16p+8L : 0x3.ca263994bd441e7cp-1024L : inexact-ok
+= exp10 tonearest ldbl-96-m68k -0x1.33ad16p+8L : 0x3.ca263994bd441e7cp-1024L : inexact-ok
+= exp10 towardzero ldbl-96-m68k -0x1.33ad16p+8L : 0x3.ca263994bd441e7cp-1024L : inexact-ok
+= exp10 upward ldbl-96-m68k -0x1.33ad16p+8L : 0x3.ca263994bd441e8p-1024L : inexact-ok
+= exp10 downward ldbl-128 -0x1.33ad16p+8L : 0x3.ca263994bd441e7c46ea7c3f2962p-1024L : inexact-ok
+= exp10 tonearest ldbl-128 -0x1.33ad16p+8L : 0x3.ca263994bd441e7c46ea7c3f2964p-1024L : inexact-ok
+= exp10 towardzero ldbl-128 -0x1.33ad16p+8L : 0x3.ca263994bd441e7c46ea7c3f2962p-1024L : inexact-ok
+= exp10 upward ldbl-128 -0x1.33ad16p+8L : 0x3.ca263994bd441e7c46ea7c3f2964p-1024L : inexact-ok
+= exp10 downward ldbl-128ibm -0x1.33ad16p+8L : 0x3.ca263994bd44p-1024L : inexact-ok underflow errno-erange-ok
+= exp10 tonearest ldbl-128ibm -0x1.33ad16p+8L : 0x3.ca263994bd44p-1024L : inexact-ok underflow errno-erange-ok
+= exp10 towardzero ldbl-128ibm -0x1.33ad16p+8L : 0x3.ca263994bd44p-1024L : inexact-ok underflow errno-erange-ok
+= exp10 upward ldbl-128ibm -0x1.33ad16p+8L : 0x3.ca263994bd444p-1024L : inexact-ok underflow errno-erange-ok
+= exp10 downward flt-32 -0x1.33ad18p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp10 tonearest flt-32 -0x1.33ad18p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp10 towardzero flt-32 -0x1.33ad18p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp10 upward flt-32 -0x1.33ad18p+8f : 0x8p-152f : inexact-ok underflow errno-erange-ok
+= exp10 downward dbl-64 -0x1.33ad18p+8 : 0x3.ca14c60907b7p-1024 : inexact-ok underflow errno-erange-ok
+= exp10 tonearest dbl-64 -0x1.33ad18p+8 : 0x3.ca14c60907b7p-1024 : inexact-ok underflow errno-erange-ok
+= exp10 towardzero dbl-64 -0x1.33ad18p+8 : 0x3.ca14c60907b7p-1024 : inexact-ok underflow errno-erange-ok
+= exp10 upward dbl-64 -0x1.33ad18p+8 : 0x3.ca14c60907b74p-1024 : inexact-ok underflow errno-erange-ok
+= exp10 downward ldbl-96-intel -0x1.33ad18p+8L : 0x3.ca14c60907b717acp-1024L : inexact-ok
+= exp10 tonearest ldbl-96-intel -0x1.33ad18p+8L : 0x3.ca14c60907b717bp-1024L : inexact-ok
+= exp10 towardzero ldbl-96-intel -0x1.33ad18p+8L : 0x3.ca14c60907b717acp-1024L : inexact-ok
+= exp10 upward ldbl-96-intel -0x1.33ad18p+8L : 0x3.ca14c60907b717bp-1024L : inexact-ok
+= exp10 downward ldbl-96-m68k -0x1.33ad18p+8L : 0x3.ca14c60907b717acp-1024L : inexact-ok
+= exp10 tonearest ldbl-96-m68k -0x1.33ad18p+8L : 0x3.ca14c60907b717bp-1024L : inexact-ok
+= exp10 towardzero ldbl-96-m68k -0x1.33ad18p+8L : 0x3.ca14c60907b717acp-1024L : inexact-ok
+= exp10 upward ldbl-96-m68k -0x1.33ad18p+8L : 0x3.ca14c60907b717bp-1024L : inexact-ok
+= exp10 downward ldbl-128 -0x1.33ad18p+8L : 0x3.ca14c60907b717ae36dc1f6cac46p-1024L : inexact-ok
+= exp10 tonearest ldbl-128 -0x1.33ad18p+8L : 0x3.ca14c60907b717ae36dc1f6cac46p-1024L : inexact-ok
+= exp10 towardzero ldbl-128 -0x1.33ad18p+8L : 0x3.ca14c60907b717ae36dc1f6cac46p-1024L : inexact-ok
+= exp10 upward ldbl-128 -0x1.33ad18p+8L : 0x3.ca14c60907b717ae36dc1f6cac48p-1024L : inexact-ok
+= exp10 downward ldbl-128ibm -0x1.33ad18p+8L : 0x3.ca14c60907b7p-1024L : inexact-ok underflow errno-erange-ok
+= exp10 tonearest ldbl-128ibm -0x1.33ad18p+8L : 0x3.ca14c60907b7p-1024L : inexact-ok underflow errno-erange-ok
+= exp10 towardzero ldbl-128ibm -0x1.33ad18p+8L : 0x3.ca14c60907b7p-1024L : inexact-ok underflow errno-erange-ok
+= exp10 upward ldbl-128ibm -0x1.33ad18p+8L : 0x3.ca14c60907b74p-1024L : inexact-ok underflow errno-erange-ok
+= exp10 downward dbl-64 -0x1.33ad17p+8 : 0x3.ca1d7fc4d6c38p-1024 : inexact-ok underflow errno-erange-ok
+= exp10 tonearest dbl-64 -0x1.33ad17p+8 : 0x3.ca1d7fc4d6c3cp-1024 : inexact-ok underflow errno-erange-ok
+= exp10 towardzero dbl-64 -0x1.33ad17p+8 : 0x3.ca1d7fc4d6c38p-1024 : inexact-ok underflow errno-erange-ok
+= exp10 upward dbl-64 -0x1.33ad17p+8 : 0x3.ca1d7fc4d6c3cp-1024 : inexact-ok underflow errno-erange-ok
+= exp10 downward ldbl-96-intel -0x1.33ad17p+8L : 0x3.ca1d7fc4d6c3bc58p-1024L : inexact-ok
+= exp10 tonearest ldbl-96-intel -0x1.33ad17p+8L : 0x3.ca1d7fc4d6c3bc58p-1024L : inexact-ok
+= exp10 towardzero ldbl-96-intel -0x1.33ad17p+8L : 0x3.ca1d7fc4d6c3bc58p-1024L : inexact-ok
+= exp10 upward ldbl-96-intel -0x1.33ad17p+8L : 0x3.ca1d7fc4d6c3bc5cp-1024L : inexact-ok
+= exp10 downward ldbl-96-m68k -0x1.33ad17p+8L : 0x3.ca1d7fc4d6c3bc58p-1024L : inexact-ok
+= exp10 tonearest ldbl-96-m68k -0x1.33ad17p+8L : 0x3.ca1d7fc4d6c3bc58p-1024L : inexact-ok
+= exp10 towardzero ldbl-96-m68k -0x1.33ad17p+8L : 0x3.ca1d7fc4d6c3bc58p-1024L : inexact-ok
+= exp10 upward ldbl-96-m68k -0x1.33ad17p+8L : 0x3.ca1d7fc4d6c3bc5cp-1024L : inexact-ok
+= exp10 downward ldbl-128 -0x1.33ad17p+8L : 0x3.ca1d7fc4d6c3bc586b2b65fe7e66p-1024L : inexact-ok
+= exp10 tonearest ldbl-128 -0x1.33ad17p+8L : 0x3.ca1d7fc4d6c3bc586b2b65fe7e66p-1024L : inexact-ok
+= exp10 towardzero ldbl-128 -0x1.33ad17p+8L : 0x3.ca1d7fc4d6c3bc586b2b65fe7e66p-1024L : inexact-ok
+= exp10 upward ldbl-128 -0x1.33ad17p+8L : 0x3.ca1d7fc4d6c3bc586b2b65fe7e68p-1024L : inexact-ok
+= exp10 downward ldbl-128ibm -0x1.33ad17p+8L : 0x3.ca1d7fc4d6c38p-1024L : inexact-ok underflow errno-erange-ok
+= exp10 tonearest ldbl-128ibm -0x1.33ad17p+8L : 0x3.ca1d7fc4d6c3cp-1024L : inexact-ok underflow errno-erange-ok
+= exp10 towardzero ldbl-128ibm -0x1.33ad17p+8L : 0x3.ca1d7fc4d6c38p-1024L : inexact-ok underflow errno-erange-ok
+= exp10 upward ldbl-128ibm -0x1.33ad17p+8L : 0x3.ca1d7fc4d6c3cp-1024L : inexact-ok underflow errno-erange-ok
+exp10 -0x1.33afcap+8
+= exp10 downward flt-32 -0x1.33afcap+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp10 tonearest flt-32 -0x1.33afcap+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp10 towardzero flt-32 -0x1.33afcap+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp10 upward flt-32 -0x1.33afcap+8f : 0x8p-152f : inexact-ok underflow errno-erange-ok
+= exp10 downward dbl-64 -0x1.33afcap+8 : 0x3.b2d8a908d0634p-1024 : inexact-ok underflow errno-erange-ok
+= exp10 tonearest dbl-64 -0x1.33afcap+8 : 0x3.b2d8a908d0634p-1024 : inexact-ok underflow errno-erange-ok
+= exp10 towardzero dbl-64 -0x1.33afcap+8 : 0x3.b2d8a908d0634p-1024 : inexact-ok underflow errno-erange-ok
+= exp10 upward dbl-64 -0x1.33afcap+8 : 0x3.b2d8a908d0638p-1024 : inexact-ok underflow errno-erange-ok
+= exp10 downward ldbl-96-intel -0x1.33afcap+8L : 0x3.b2d8a908d0634324p-1024L : inexact-ok
+= exp10 tonearest ldbl-96-intel -0x1.33afcap+8L : 0x3.b2d8a908d0634328p-1024L : inexact-ok
+= exp10 towardzero ldbl-96-intel -0x1.33afcap+8L : 0x3.b2d8a908d0634324p-1024L : inexact-ok
+= exp10 upward ldbl-96-intel -0x1.33afcap+8L : 0x3.b2d8a908d0634328p-1024L : inexact-ok
+= exp10 downward ldbl-96-m68k -0x1.33afcap+8L : 0x3.b2d8a908d0634324p-1024L : inexact-ok
+= exp10 tonearest ldbl-96-m68k -0x1.33afcap+8L : 0x3.b2d8a908d0634328p-1024L : inexact-ok
+= exp10 towardzero ldbl-96-m68k -0x1.33afcap+8L : 0x3.b2d8a908d0634324p-1024L : inexact-ok
+= exp10 upward ldbl-96-m68k -0x1.33afcap+8L : 0x3.b2d8a908d0634328p-1024L : inexact-ok
+= exp10 downward ldbl-128 -0x1.33afcap+8L : 0x3.b2d8a908d063432616cd82f6a4eep-1024L : inexact-ok
+= exp10 tonearest ldbl-128 -0x1.33afcap+8L : 0x3.b2d8a908d063432616cd82f6a4eep-1024L : inexact-ok
+= exp10 towardzero ldbl-128 -0x1.33afcap+8L : 0x3.b2d8a908d063432616cd82f6a4eep-1024L : inexact-ok
+= exp10 upward ldbl-128 -0x1.33afcap+8L : 0x3.b2d8a908d063432616cd82f6a4fp-1024L : inexact-ok
+= exp10 downward ldbl-128ibm -0x1.33afcap+8L : 0x3.b2d8a908d0634p-1024L : inexact-ok underflow errno-erange-ok
+= exp10 tonearest ldbl-128ibm -0x1.33afcap+8L : 0x3.b2d8a908d0634p-1024L : inexact-ok underflow errno-erange-ok
+= exp10 towardzero ldbl-128ibm -0x1.33afcap+8L : 0x3.b2d8a908d0634p-1024L : inexact-ok underflow errno-erange-ok
+= exp10 upward ldbl-128ibm -0x1.33afcap+8L : 0x3.b2d8a908d0638p-1024L : inexact-ok underflow errno-erange-ok
 exp10 0x1p-10
 = exp10 downward flt-32 0x4p-12f : 0x1.009388p+0f : inexact-ok
 = exp10 tonearest flt-32 0x4p-12f : 0x1.009388p+0f : inexact-ok
diff --git a/sysdeps/i386/fpu/e_exp10.S b/sysdeps/i386/fpu/e_exp10.S
index 1e32b07848..fa54732e2a 100644
--- a/sysdeps/i386/fpu/e_exp10.S
+++ b/sysdeps/i386/fpu/e_exp10.S
@@ -4,8 +4,25 @@
 
 #include <machine/asm.h>
 
+	.section .rodata.cst8,"aM",@progbits,8
+
+	.p2align 3
+	.type dbl_min,@object
+dbl_min:	.byte 0, 0, 0, 0, 0, 0, 0x10, 0
+	ASM_SIZE_DIRECTIVE(dbl_min)
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%ecx)
+#else
+# define MO(op) op
+#endif
+
+	.text
 /* 10^x = 2^(x * log2(10)) */
 ENTRY(__ieee754_exp10)
+#ifdef  PIC
+	LOAD_PIC_REG (cx)
+#endif
 	fldl	4(%esp)
 /* I added the following ugly construct because exp(+-Inf) resulted
    in NaN.  The ugliness results from the bright minds at Intel.
@@ -28,7 +45,22 @@ ENTRY(__ieee754_exp10)
 	faddp				/* 2^(fract(x * log2(10))) */
 	fscale				/* e^x */
 	fstp	%st(1)
-	ret
+	fldl	MO(dbl_min)
+	fld	%st(1)
+	fucompp
+	fnstsw
+	sahf
+	jnc 3f
+	subl	$8, %esp
+	cfi_adjust_cfa_offset (8)
+	fld	%st(0)
+	fmul	%st(0)
+	fstpl	(%esp)
+	fstpl	(%esp)
+	fldl	(%esp)
+	addl	$8, %esp
+	cfi_adjust_cfa_offset (-8)
+3:	ret
 
 1:	testl	$0x200, %eax		/* Test sign.  */
 	jz	2f			/* If positive, jump.  */
diff --git a/sysdeps/i386/fpu/e_exp10f.S b/sysdeps/i386/fpu/e_exp10f.S
index 614496415e..a84b2ae535 100644
--- a/sysdeps/i386/fpu/e_exp10f.S
+++ b/sysdeps/i386/fpu/e_exp10f.S
@@ -4,8 +4,25 @@
 
 #include <machine/asm.h>
 
+	.section .rodata.cst4,"aM",@progbits,4
+
+	.p2align 2
+	.type flt_min,@object
+flt_min:	.byte 0, 0, 0x80, 0
+	ASM_SIZE_DIRECTIVE(flt_min)
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%ecx)
+#else
+# define MO(op) op
+#endif
+
+	.text
 /* 10^x = 2^(x * log2(10)) */
 ENTRY(__ieee754_exp10f)
+#ifdef  PIC
+	LOAD_PIC_REG (cx)
+#endif
 	flds	4(%esp)
 /* I added the following ugly construct because exp(+-Inf) resulted
    in NaN.  The ugliness results from the bright minds at Intel.
@@ -28,7 +45,22 @@ ENTRY(__ieee754_exp10f)
 	faddp				/* 2^(fract(x * log2(10))) */
 	fscale				/* e^x */
 	fstp	%st(1)
-	ret
+	flds	MO(flt_min)
+	fld	%st(1)
+	fucompp
+	fnstsw
+	sahf
+	jnc 3f
+	subl	$4, %esp
+	cfi_adjust_cfa_offset (4)
+	fld	%st(0)
+	fmul	%st(0)
+	fstps	(%esp)
+	fstps	(%esp)
+	flds	(%esp)
+	addl	$4, %esp
+	cfi_adjust_cfa_offset (-4)
+3:	ret
 
 1:	testl	$0x200, %eax		/* Test sign.  */
 	jz	2f			/* If positive, jump.  */