about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2013-12-03 21:49:56 +0000
committerJoseph Myers <joseph@codesourcery.com>2013-12-03 21:49:56 +0000
commit749008ff0361297af02b8574ac8848d35436eac3 (patch)
tree24d4078cb9fa9eb70e27a8c886301db8d09fadb1
parent17dea1887fcc116941e07cb0f5f2078140ab0384 (diff)
downloadglibc-749008ff0361297af02b8574ac8848d35436eac3.tar.gz
glibc-749008ff0361297af02b8574ac8848d35436eac3.tar.xz
glibc-749008ff0361297af02b8574ac8848d35436eac3.zip
Fix exp missing underflows (bug 15268, bug 15425).
-rw-r--r--ChangeLog10
-rw-r--r--NEWS20
-rw-r--r--math/auto-libm-test-in2
-rw-r--r--math/auto-libm-test-out214
-rw-r--r--sysdeps/i386/fpu/libm-test-ulps32
-rw-r--r--sysdeps/ieee754/dbl-64/e_exp.c17
-rw-r--r--sysdeps/x86_64/fpu/libm-test-ulps52
7 files changed, 334 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 74c24838df..de64f3f71b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2013-12-03  Joseph Myers  <joseph@codesourcery.com>
 
+	[BZ #15268]
+	[BZ #15425]
+	* sysdeps/ieee754/dbl-64/e_exp.c: Include <float.h>.
+	(__ieee754_exp): For possibly underflowing results, check size of
+	result and force underflow exception if required.
+	* math/auto-libm-test-in: Add more tests of exp.
+	* math/auto-libm-test-out: Regenerated.
+	* sysdeps/i386/fpu/libm-test-ulps: Update.
+	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
+
 	[BZ #16283]
 	* math/w_exp2.c (__exp2): Handle a zero result as underflow.
 	* math/w_exp2f.c (__exp2f): Likewise.
diff --git a/NEWS b/NEWS
index eec76c4c5b..146333099d 100644
--- a/NEWS
+++ b/NEWS
@@ -11,16 +11,16 @@ Version 2.19
 
   156, 387, 431, 832, 2801, 6786, 6787, 7003, 9954, 10253, 10278, 11087,
   11157, 11214, 13028, 13982, 13985, 14029, 14032, 14143, 14155, 14547,
-  14699, 14752, 14876, 14910, 15004, 15048, 15218, 15277, 15308, 15362,
-  15374, 15400, 15427, 15483, 15522, 15531, 15532, 15601, 15608, 15609,
-  15610, 15632, 15640, 15670, 15672, 15680, 15681, 15723, 15734, 15735,
-  15736, 15748, 15749, 15754, 15760, 15763, 15764, 15797, 15799, 15825,
-  15844, 15847, 15849, 15855, 15856, 15857, 15859, 15867, 15886, 15887,
-  15890, 15892, 15893, 15895, 15897, 15905, 15909, 15917, 15919, 15921,
-  15923, 15939, 15948, 15963, 15966, 15985, 15988, 15997, 16032, 16034,
-  16036, 16037, 16041, 16055, 16071, 16072, 16074, 16077, 16078, 16103,
-  16112, 16143, 16144, 16146, 16150, 16151, 16153, 16167, 16172, 16195,
-  16214, 16245, 16271, 16283, 16289.
+  14699, 14752, 14876, 14910, 15004, 15048, 15218, 15268, 15277, 15308,
+  15362, 15374, 15400, 15425, 15427, 15483, 15522, 15531, 15532, 15601,
+  15608, 15609, 15610, 15632, 15640, 15670, 15672, 15680, 15681, 15723,
+  15734, 15735, 15736, 15748, 15749, 15754, 15760, 15763, 15764, 15797,
+  15799, 15825, 15844, 15847, 15849, 15855, 15856, 15857, 15859, 15867,
+  15886, 15887, 15890, 15892, 15893, 15895, 15897, 15905, 15909, 15917,
+  15919, 15921, 15923, 15939, 15948, 15963, 15966, 15985, 15988, 15997,
+  16032, 16034, 16036, 16037, 16041, 16055, 16071, 16072, 16074, 16077,
+  16078, 16103, 16112, 16143, 16144, 16146, 16150, 16151, 16153, 16167,
+  16172, 16195, 16214, 16245, 16271, 16283, 16289.
 
 * The public headers no longer use __unused nor __block.  This change is to
   support compiling programs that are derived from BSD sources and use
diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in
index 83832a7f35..4c07c4fc4b 100644
--- a/math/auto-libm-test-in
+++ b/math/auto-libm-test-in
@@ -178,6 +178,8 @@ exp -1234
 # Bug 16284: results on directed rounding may be incorrect.
 exp 1e5 xfail-rounding:dbl-64
 exp max xfail-rounding:dbl-64
+exp -7.4444006192138124e+02
+exp -0x1.75f113c30b1c8p+9
 exp -max
 
 exp10 0
diff --git a/math/auto-libm-test-out b/math/auto-libm-test-out
index 4241399a9a..d9ef69e7a6 100644
--- a/math/auto-libm-test-out
+++ b/math/auto-libm-test-out
@@ -6018,6 +6018,220 @@ exp max xfail-rounding:dbl-64
 = exp tonearest ldbl-128ibm 0xf.ffffffffffffbffffffffffffcp+1020L : plus_infty : inexact-ok overflow errno-erange
 = exp towardzero ldbl-128ibm 0xf.ffffffffffffbffffffffffffcp+1020L : 0xf.ffffffffffffbffffffffffffcp+1020L : xfail:dbl-64 inexact-ok overflow errno-erange-ok
 = exp upward ldbl-128ibm 0xf.ffffffffffffbffffffffffffcp+1020L : plus_infty : xfail:dbl-64 inexact-ok overflow errno-erange
+exp -7.4444006192138124e+02
+= exp downward flt-32 -0x2.e870a4p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp tonearest flt-32 -0x2.e870a4p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp towardzero flt-32 -0x2.e870a4p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp upward flt-32 -0x2.e870a4p+8f : 0x8p-152f : inexact-ok underflow errno-erange-ok
+= exp downward dbl-64 -0x2.e870a4p+8 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
+= exp tonearest dbl-64 -0x2.e870a4p+8 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
+= exp towardzero dbl-64 -0x2.e870a4p+8 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
+= exp upward dbl-64 -0x2.e870a4p+8 : 0x8p-1076 : inexact-ok underflow errno-erange-ok
+= exp downward ldbl-96-intel -0x2.e870a4p+8L : 0x4.001236e259a703f8p-1076L : inexact-ok
+= exp tonearest ldbl-96-intel -0x2.e870a4p+8L : 0x4.001236e259a704p-1076L : inexact-ok
+= exp towardzero ldbl-96-intel -0x2.e870a4p+8L : 0x4.001236e259a703f8p-1076L : inexact-ok
+= exp upward ldbl-96-intel -0x2.e870a4p+8L : 0x4.001236e259a704p-1076L : inexact-ok
+= exp downward ldbl-96-m68k -0x2.e870a4p+8L : 0x4.001236e259a703f8p-1076L : inexact-ok
+= exp tonearest ldbl-96-m68k -0x2.e870a4p+8L : 0x4.001236e259a704p-1076L : inexact-ok
+= exp towardzero ldbl-96-m68k -0x2.e870a4p+8L : 0x4.001236e259a703f8p-1076L : inexact-ok
+= exp upward ldbl-96-m68k -0x2.e870a4p+8L : 0x4.001236e259a704p-1076L : inexact-ok
+= exp downward ldbl-128 -0x2.e870a4p+8L : 0x4.001236e259a703fe35e4572c21b4p-1076L : inexact-ok
+= exp tonearest ldbl-128 -0x2.e870a4p+8L : 0x4.001236e259a703fe35e4572c21b8p-1076L : inexact-ok
+= exp towardzero ldbl-128 -0x2.e870a4p+8L : 0x4.001236e259a703fe35e4572c21b4p-1076L : inexact-ok
+= exp upward ldbl-128 -0x2.e870a4p+8L : 0x4.001236e259a703fe35e4572c21b8p-1076L : inexact-ok
+= exp downward ldbl-128ibm -0x2.e870a4p+8L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+= exp tonearest ldbl-128ibm -0x2.e870a4p+8L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+= exp towardzero ldbl-128ibm -0x2.e870a4p+8L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+= exp upward ldbl-128ibm -0x2.e870a4p+8L : 0x8p-1076L : inexact-ok underflow errno-erange-ok
+= exp downward flt-32 -0x2.e870a8p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp tonearest flt-32 -0x2.e870a8p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp towardzero flt-32 -0x2.e870a8p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp upward flt-32 -0x2.e870a8p+8f : 0x8p-152f : inexact-ok underflow errno-erange-ok
+= exp downward dbl-64 -0x2.e870a8p+8 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
+= exp tonearest dbl-64 -0x2.e870a8p+8 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
+= exp towardzero dbl-64 -0x2.e870a8p+8 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
+= exp upward dbl-64 -0x2.e870a8p+8 : 0x8p-1076 : inexact-ok underflow errno-erange-ok
+= exp downward ldbl-96-intel -0x2.e870a8p+8L : 0x4.000236b97e84a93p-1076L : inexact-ok
+= exp tonearest ldbl-96-intel -0x2.e870a8p+8L : 0x4.000236b97e84a93p-1076L : inexact-ok
+= exp towardzero ldbl-96-intel -0x2.e870a8p+8L : 0x4.000236b97e84a93p-1076L : inexact-ok
+= exp upward ldbl-96-intel -0x2.e870a8p+8L : 0x4.000236b97e84a938p-1076L : inexact-ok
+= exp downward ldbl-96-m68k -0x2.e870a8p+8L : 0x4.000236b97e84a93p-1076L : inexact-ok
+= exp tonearest ldbl-96-m68k -0x2.e870a8p+8L : 0x4.000236b97e84a93p-1076L : inexact-ok
+= exp towardzero ldbl-96-m68k -0x2.e870a8p+8L : 0x4.000236b97e84a93p-1076L : inexact-ok
+= exp upward ldbl-96-m68k -0x2.e870a8p+8L : 0x4.000236b97e84a938p-1076L : inexact-ok
+= exp downward ldbl-128 -0x2.e870a8p+8L : 0x4.000236b97e84a932aa555f5e8ce4p-1076L : inexact-ok
+= exp tonearest ldbl-128 -0x2.e870a8p+8L : 0x4.000236b97e84a932aa555f5e8ce4p-1076L : inexact-ok
+= exp towardzero ldbl-128 -0x2.e870a8p+8L : 0x4.000236b97e84a932aa555f5e8ce4p-1076L : inexact-ok
+= exp upward ldbl-128 -0x2.e870a8p+8L : 0x4.000236b97e84a932aa555f5e8ce8p-1076L : inexact-ok
+= exp downward ldbl-128ibm -0x2.e870a8p+8L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+= exp tonearest ldbl-128ibm -0x2.e870a8p+8L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+= exp towardzero ldbl-128ibm -0x2.e870a8p+8L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+= exp upward ldbl-128ibm -0x2.e870a8p+8L : 0x8p-1076L : inexact-ok underflow errno-erange-ok
+= exp downward dbl-64 -0x2.e870a7e5e88cp+8 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
+= exp tonearest dbl-64 -0x2.e870a7e5e88cp+8 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
+= exp towardzero dbl-64 -0x2.e870a7e5e88cp+8 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
+= exp upward dbl-64 -0x2.e870a7e5e88cp+8 : 0x8p-1076 : inexact-ok underflow errno-erange-ok
+= exp downward ldbl-96-intel -0x2.e870a7e5e88cp+8L : 0x4.00029f178d98fa08p-1076L : inexact-ok
+= exp tonearest ldbl-96-intel -0x2.e870a7e5e88cp+8L : 0x4.00029f178d98fa1p-1076L : inexact-ok
+= exp towardzero ldbl-96-intel -0x2.e870a7e5e88cp+8L : 0x4.00029f178d98fa08p-1076L : inexact-ok
+= exp upward ldbl-96-intel -0x2.e870a7e5e88cp+8L : 0x4.00029f178d98fa1p-1076L : inexact-ok
+= exp downward ldbl-96-m68k -0x2.e870a7e5e88cp+8L : 0x4.00029f178d98fa08p-1076L : inexact-ok
+= exp tonearest ldbl-96-m68k -0x2.e870a7e5e88cp+8L : 0x4.00029f178d98fa1p-1076L : inexact-ok
+= exp towardzero ldbl-96-m68k -0x2.e870a7e5e88cp+8L : 0x4.00029f178d98fa08p-1076L : inexact-ok
+= exp upward ldbl-96-m68k -0x2.e870a7e5e88cp+8L : 0x4.00029f178d98fa1p-1076L : inexact-ok
+= exp downward ldbl-128 -0x2.e870a7e5e88cp+8L : 0x4.00029f178d98fa0e72d456f74c24p-1076L : inexact-ok
+= exp tonearest ldbl-128 -0x2.e870a7e5e88cp+8L : 0x4.00029f178d98fa0e72d456f74c28p-1076L : inexact-ok
+= exp towardzero ldbl-128 -0x2.e870a7e5e88cp+8L : 0x4.00029f178d98fa0e72d456f74c24p-1076L : inexact-ok
+= exp upward ldbl-128 -0x2.e870a7e5e88cp+8L : 0x4.00029f178d98fa0e72d456f74c28p-1076L : inexact-ok
+= exp downward ldbl-128ibm -0x2.e870a7e5e88cp+8L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+= exp tonearest ldbl-128ibm -0x2.e870a7e5e88cp+8L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+= exp towardzero ldbl-128ibm -0x2.e870a7e5e88cp+8L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+= exp upward ldbl-128ibm -0x2.e870a7e5e88cp+8L : 0x8p-1076L : inexact-ok underflow errno-erange-ok
+= exp downward dbl-64 -0x2.e870a7e5e88c2p+8 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
+= exp tonearest dbl-64 -0x2.e870a7e5e88c2p+8 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
+= exp towardzero dbl-64 -0x2.e870a7e5e88c2p+8 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
+= exp upward dbl-64 -0x2.e870a7e5e88c2p+8 : 0x8p-1076 : inexact-ok underflow errno-erange-ok
+= exp downward ldbl-96-intel -0x2.e870a7e5e88c2p+8L : 0x4.00029f178d18f9b8p-1076L : inexact-ok
+= exp tonearest ldbl-96-intel -0x2.e870a7e5e88c2p+8L : 0x4.00029f178d18f9b8p-1076L : inexact-ok
+= exp towardzero ldbl-96-intel -0x2.e870a7e5e88c2p+8L : 0x4.00029f178d18f9b8p-1076L : inexact-ok
+= exp upward ldbl-96-intel -0x2.e870a7e5e88c2p+8L : 0x4.00029f178d18f9cp-1076L : inexact-ok
+= exp downward ldbl-96-m68k -0x2.e870a7e5e88c2p+8L : 0x4.00029f178d18f9b8p-1076L : inexact-ok
+= exp tonearest ldbl-96-m68k -0x2.e870a7e5e88c2p+8L : 0x4.00029f178d18f9b8p-1076L : inexact-ok
+= exp towardzero ldbl-96-m68k -0x2.e870a7e5e88c2p+8L : 0x4.00029f178d18f9b8p-1076L : inexact-ok
+= exp upward ldbl-96-m68k -0x2.e870a7e5e88c2p+8L : 0x4.00029f178d18f9cp-1076L : inexact-ok
+= exp downward ldbl-128 -0x2.e870a7e5e88c2p+8L : 0x4.00029f178d18f9ba8fe2abd80f94p-1076L : inexact-ok
+= exp tonearest ldbl-128 -0x2.e870a7e5e88c2p+8L : 0x4.00029f178d18f9ba8fe2abd80f98p-1076L : inexact-ok
+= exp towardzero ldbl-128 -0x2.e870a7e5e88c2p+8L : 0x4.00029f178d18f9ba8fe2abd80f94p-1076L : inexact-ok
+= exp upward ldbl-128 -0x2.e870a7e5e88c2p+8L : 0x4.00029f178d18f9ba8fe2abd80f98p-1076L : inexact-ok
+= exp downward ldbl-128ibm -0x2.e870a7e5e88c2p+8L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+= exp tonearest ldbl-128ibm -0x2.e870a7e5e88c2p+8L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+= exp towardzero ldbl-128ibm -0x2.e870a7e5e88c2p+8L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+= exp upward ldbl-128ibm -0x2.e870a7e5e88c2p+8L : 0x8p-1076L : inexact-ok underflow errno-erange-ok
+= exp downward ldbl-96-intel -0x2.e870a7e5e88c1f0cp+8L : 0x4.00029f178d1cc9b8p-1076L : inexact-ok
+= exp tonearest ldbl-96-intel -0x2.e870a7e5e88c1f0cp+8L : 0x4.00029f178d1cc9cp-1076L : inexact-ok
+= exp towardzero ldbl-96-intel -0x2.e870a7e5e88c1f0cp+8L : 0x4.00029f178d1cc9b8p-1076L : inexact-ok
+= exp upward ldbl-96-intel -0x2.e870a7e5e88c1f0cp+8L : 0x4.00029f178d1cc9cp-1076L : inexact-ok
+= exp downward ldbl-96-m68k -0x2.e870a7e5e88c1f0cp+8L : 0x4.00029f178d1cc9b8p-1076L : inexact-ok
+= exp tonearest ldbl-96-m68k -0x2.e870a7e5e88c1f0cp+8L : 0x4.00029f178d1cc9cp-1076L : inexact-ok
+= exp towardzero ldbl-96-m68k -0x2.e870a7e5e88c1f0cp+8L : 0x4.00029f178d1cc9b8p-1076L : inexact-ok
+= exp upward ldbl-96-m68k -0x2.e870a7e5e88c1f0cp+8L : 0x4.00029f178d1cc9cp-1076L : inexact-ok
+= exp downward ldbl-128 -0x2.e870a7e5e88c1f0cp+8L : 0x4.00029f178d1cc9bd0f851e55aebcp-1076L : inexact-ok
+= exp tonearest ldbl-128 -0x2.e870a7e5e88c1f0cp+8L : 0x4.00029f178d1cc9bd0f851e55aecp-1076L : inexact-ok
+= exp towardzero ldbl-128 -0x2.e870a7e5e88c1f0cp+8L : 0x4.00029f178d1cc9bd0f851e55aebcp-1076L : inexact-ok
+= exp upward ldbl-128 -0x2.e870a7e5e88c1f0cp+8L : 0x4.00029f178d1cc9bd0f851e55aecp-1076L : inexact-ok
+= exp downward ldbl-128ibm -0x2.e870a7e5e88c1f0cp+8L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+= exp tonearest ldbl-128ibm -0x2.e870a7e5e88c1f0cp+8L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+= exp towardzero ldbl-128ibm -0x2.e870a7e5e88c1f0cp+8L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+= exp upward ldbl-128ibm -0x2.e870a7e5e88c1f0cp+8L : 0x8p-1076L : inexact-ok underflow errno-erange-ok
+= exp downward ldbl-96-intel -0x2.e870a7e5e88c1f1p+8L : 0x4.00029f178d1cb9b8p-1076L : inexact-ok
+= exp tonearest ldbl-96-intel -0x2.e870a7e5e88c1f1p+8L : 0x4.00029f178d1cb9cp-1076L : inexact-ok
+= exp towardzero ldbl-96-intel -0x2.e870a7e5e88c1f1p+8L : 0x4.00029f178d1cb9b8p-1076L : inexact-ok
+= exp upward ldbl-96-intel -0x2.e870a7e5e88c1f1p+8L : 0x4.00029f178d1cb9cp-1076L : inexact-ok
+= exp downward ldbl-96-m68k -0x2.e870a7e5e88c1f1p+8L : 0x4.00029f178d1cb9b8p-1076L : inexact-ok
+= exp tonearest ldbl-96-m68k -0x2.e870a7e5e88c1f1p+8L : 0x4.00029f178d1cb9cp-1076L : inexact-ok
+= exp towardzero ldbl-96-m68k -0x2.e870a7e5e88c1f1p+8L : 0x4.00029f178d1cb9b8p-1076L : inexact-ok
+= exp upward ldbl-96-m68k -0x2.e870a7e5e88c1f1p+8L : 0x4.00029f178d1cb9cp-1076L : inexact-ok
+= exp downward ldbl-128 -0x2.e870a7e5e88c1f1p+8L : 0x4.00029f178d1cb9bd0508c0213bb4p-1076L : inexact-ok
+= exp tonearest ldbl-128 -0x2.e870a7e5e88c1f1p+8L : 0x4.00029f178d1cb9bd0508c0213bb8p-1076L : inexact-ok
+= exp towardzero ldbl-128 -0x2.e870a7e5e88c1f1p+8L : 0x4.00029f178d1cb9bd0508c0213bb4p-1076L : inexact-ok
+= exp upward ldbl-128 -0x2.e870a7e5e88c1f1p+8L : 0x4.00029f178d1cb9bd0508c0213bb8p-1076L : inexact-ok
+= exp downward ldbl-128ibm -0x2.e870a7e5e88c1f1p+8L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+= exp tonearest ldbl-128ibm -0x2.e870a7e5e88c1f1p+8L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+= exp towardzero ldbl-128ibm -0x2.e870a7e5e88c1f1p+8L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+= exp upward ldbl-128ibm -0x2.e870a7e5e88c1f1p+8L : 0x8p-1076L : inexact-ok underflow errno-erange-ok
+= exp downward ldbl-128 -0x2.e870a7e5e88c1f0f86d8bda5cef2p+8L : 0x4.00029f178d1cbba1a34fc1f1ad4cp-1076L : inexact-ok
+= exp tonearest ldbl-128 -0x2.e870a7e5e88c1f0f86d8bda5cef2p+8L : 0x4.00029f178d1cbba1a34fc1f1ad4cp-1076L : inexact-ok
+= exp towardzero ldbl-128 -0x2.e870a7e5e88c1f0f86d8bda5cef2p+8L : 0x4.00029f178d1cbba1a34fc1f1ad4cp-1076L : inexact-ok
+= exp upward ldbl-128 -0x2.e870a7e5e88c1f0f86d8bda5cef2p+8L : 0x4.00029f178d1cbba1a34fc1f1ad5p-1076L : inexact-ok
+= exp downward ldbl-128 -0x2.e870a7e5e88c1f0f86d8bda5cef4p+8L : 0x4.00029f178d1cbba1a34fc1f1a54cp-1076L : inexact-ok
+= exp tonearest ldbl-128 -0x2.e870a7e5e88c1f0f86d8bda5cef4p+8L : 0x4.00029f178d1cbba1a34fc1f1a54cp-1076L : inexact-ok
+= exp towardzero ldbl-128 -0x2.e870a7e5e88c1f0f86d8bda5cef4p+8L : 0x4.00029f178d1cbba1a34fc1f1a54cp-1076L : inexact-ok
+= exp upward ldbl-128 -0x2.e870a7e5e88c1f0f86d8bda5cef4p+8L : 0x4.00029f178d1cbba1a34fc1f1a55p-1076L : inexact-ok
+= exp downward ldbl-128 -0x2.e870a7e5e88c1f0f86d8bda5cep+8L : 0x4.00029f178d1cbba1a34fc1f5754cp-1076L : inexact-ok
+= exp tonearest ldbl-128 -0x2.e870a7e5e88c1f0f86d8bda5cep+8L : 0x4.00029f178d1cbba1a34fc1f5755p-1076L : inexact-ok
+= exp towardzero ldbl-128 -0x2.e870a7e5e88c1f0f86d8bda5cep+8L : 0x4.00029f178d1cbba1a34fc1f5754cp-1076L : inexact-ok
+= exp upward ldbl-128 -0x2.e870a7e5e88c1f0f86d8bda5cep+8L : 0x4.00029f178d1cbba1a34fc1f5755p-1076L : inexact-ok
+= exp downward ldbl-128ibm -0x2.e870a7e5e88c1f0f86d8bda5cep+8L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+= exp tonearest ldbl-128ibm -0x2.e870a7e5e88c1f0f86d8bda5cep+8L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+= exp towardzero ldbl-128ibm -0x2.e870a7e5e88c1f0f86d8bda5cep+8L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+= exp upward ldbl-128ibm -0x2.e870a7e5e88c1f0f86d8bda5cep+8L : 0x8p-1076L : inexact-ok underflow errno-erange-ok
+= exp downward ldbl-128 -0x2.e870a7e5e88c1f0f86d8bda5cfp+8L : 0x4.00029f178d1cbba1a34fc1f1754cp-1076L : inexact-ok
+= exp tonearest ldbl-128 -0x2.e870a7e5e88c1f0f86d8bda5cfp+8L : 0x4.00029f178d1cbba1a34fc1f1754cp-1076L : inexact-ok
+= exp towardzero ldbl-128 -0x2.e870a7e5e88c1f0f86d8bda5cfp+8L : 0x4.00029f178d1cbba1a34fc1f1754cp-1076L : inexact-ok
+= exp upward ldbl-128 -0x2.e870a7e5e88c1f0f86d8bda5cfp+8L : 0x4.00029f178d1cbba1a34fc1f1755p-1076L : inexact-ok
+= exp downward ldbl-128ibm -0x2.e870a7e5e88c1f0f86d8bda5cfp+8L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+= exp tonearest ldbl-128ibm -0x2.e870a7e5e88c1f0f86d8bda5cfp+8L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+= exp towardzero ldbl-128ibm -0x2.e870a7e5e88c1f0f86d8bda5cfp+8L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+= exp upward ldbl-128ibm -0x2.e870a7e5e88c1f0f86d8bda5cfp+8L : 0x8p-1076L : inexact-ok underflow errno-erange-ok
+exp -0x1.75f113c30b1c8p+9
+= exp downward flt-32 -0x2.ebe224p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp tonearest flt-32 -0x2.ebe224p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp towardzero flt-32 -0x2.ebe224p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp upward flt-32 -0x2.ebe224p+8f : 0x8p-152f : inexact-ok underflow errno-erange-ok
+= exp downward dbl-64 -0x2.ebe224p+8 : 0x0p+0 : inexact-ok underflow errno-erange
+= exp tonearest dbl-64 -0x2.ebe224p+8 : 0x0p+0 : inexact-ok underflow errno-erange
+= exp towardzero dbl-64 -0x2.ebe224p+8 : 0x0p+0 : inexact-ok underflow errno-erange
+= exp upward dbl-64 -0x2.ebe224p+8 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
+= exp downward ldbl-96-intel -0x2.ebe224p+8L : 0x2.0b9f4f64aed595b4p-1080L : inexact-ok
+= exp tonearest ldbl-96-intel -0x2.ebe224p+8L : 0x2.0b9f4f64aed595b8p-1080L : inexact-ok
+= exp towardzero ldbl-96-intel -0x2.ebe224p+8L : 0x2.0b9f4f64aed595b4p-1080L : inexact-ok
+= exp upward ldbl-96-intel -0x2.ebe224p+8L : 0x2.0b9f4f64aed595b8p-1080L : inexact-ok
+= exp downward ldbl-96-m68k -0x2.ebe224p+8L : 0x2.0b9f4f64aed595b4p-1080L : inexact-ok
+= exp tonearest ldbl-96-m68k -0x2.ebe224p+8L : 0x2.0b9f4f64aed595b8p-1080L : inexact-ok
+= exp towardzero ldbl-96-m68k -0x2.ebe224p+8L : 0x2.0b9f4f64aed595b4p-1080L : inexact-ok
+= exp upward ldbl-96-m68k -0x2.ebe224p+8L : 0x2.0b9f4f64aed595b8p-1080L : inexact-ok
+= exp downward ldbl-128 -0x2.ebe224p+8L : 0x2.0b9f4f64aed595b7b1e41fe97b6ep-1080L : inexact-ok
+= exp tonearest ldbl-128 -0x2.ebe224p+8L : 0x2.0b9f4f64aed595b7b1e41fe97b6ep-1080L : inexact-ok
+= exp towardzero ldbl-128 -0x2.ebe224p+8L : 0x2.0b9f4f64aed595b7b1e41fe97b6ep-1080L : inexact-ok
+= exp upward ldbl-128 -0x2.ebe224p+8L : 0x2.0b9f4f64aed595b7b1e41fe97b7p-1080L : inexact-ok
+= exp downward ldbl-128ibm -0x2.ebe224p+8L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp tonearest ldbl-128ibm -0x2.ebe224p+8L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp towardzero ldbl-128ibm -0x2.ebe224p+8L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp upward ldbl-128ibm -0x2.ebe224p+8L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+= exp downward flt-32 -0x2.ebe228p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp tonearest flt-32 -0x2.ebe228p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp towardzero flt-32 -0x2.ebe228p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp upward flt-32 -0x2.ebe228p+8f : 0x8p-152f : inexact-ok underflow errno-erange-ok
+= exp downward dbl-64 -0x2.ebe228p+8 : 0x0p+0 : inexact-ok underflow errno-erange
+= exp tonearest dbl-64 -0x2.ebe228p+8 : 0x0p+0 : inexact-ok underflow errno-erange
+= exp towardzero dbl-64 -0x2.ebe228p+8 : 0x0p+0 : inexact-ok underflow errno-erange
+= exp upward dbl-64 -0x2.ebe228p+8 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
+= exp downward ldbl-96-intel -0x2.ebe228p+8L : 0x2.0b9720f7ce27844cp-1080L : inexact-ok
+= exp tonearest ldbl-96-intel -0x2.ebe228p+8L : 0x2.0b9720f7ce27845p-1080L : inexact-ok
+= exp towardzero ldbl-96-intel -0x2.ebe228p+8L : 0x2.0b9720f7ce27844cp-1080L : inexact-ok
+= exp upward ldbl-96-intel -0x2.ebe228p+8L : 0x2.0b9720f7ce27845p-1080L : inexact-ok
+= exp downward ldbl-96-m68k -0x2.ebe228p+8L : 0x2.0b9720f7ce27844cp-1080L : inexact-ok
+= exp tonearest ldbl-96-m68k -0x2.ebe228p+8L : 0x2.0b9720f7ce27845p-1080L : inexact-ok
+= exp towardzero ldbl-96-m68k -0x2.ebe228p+8L : 0x2.0b9720f7ce27844cp-1080L : inexact-ok
+= exp upward ldbl-96-m68k -0x2.ebe228p+8L : 0x2.0b9720f7ce27845p-1080L : inexact-ok
+= exp downward ldbl-128 -0x2.ebe228p+8L : 0x2.0b9720f7ce27844ea9674284d866p-1080L : inexact-ok
+= exp tonearest ldbl-128 -0x2.ebe228p+8L : 0x2.0b9720f7ce27844ea9674284d868p-1080L : inexact-ok
+= exp towardzero ldbl-128 -0x2.ebe228p+8L : 0x2.0b9720f7ce27844ea9674284d866p-1080L : inexact-ok
+= exp upward ldbl-128 -0x2.ebe228p+8L : 0x2.0b9720f7ce27844ea9674284d868p-1080L : inexact-ok
+= exp downward ldbl-128ibm -0x2.ebe228p+8L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp tonearest ldbl-128ibm -0x2.ebe228p+8L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp towardzero ldbl-128ibm -0x2.ebe228p+8L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp upward ldbl-128ibm -0x2.ebe228p+8L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+= exp downward dbl-64 -0x2.ebe227861639p+8 : 0x0p+0 : inexact-ok underflow errno-erange
+= exp tonearest dbl-64 -0x2.ebe227861639p+8 : 0x0p+0 : inexact-ok underflow errno-erange
+= exp towardzero dbl-64 -0x2.ebe227861639p+8 : 0x0p+0 : inexact-ok underflow errno-erange
+= exp upward dbl-64 -0x2.ebe227861639p+8 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
+= exp downward ldbl-96-intel -0x2.ebe227861639p+8L : 0x2.0b981a509bab7298p-1080L : inexact-ok
+= exp tonearest ldbl-96-intel -0x2.ebe227861639p+8L : 0x2.0b981a509bab7298p-1080L : inexact-ok
+= exp towardzero ldbl-96-intel -0x2.ebe227861639p+8L : 0x2.0b981a509bab7298p-1080L : inexact-ok
+= exp upward ldbl-96-intel -0x2.ebe227861639p+8L : 0x2.0b981a509bab729cp-1080L : inexact-ok
+= exp downward ldbl-96-m68k -0x2.ebe227861639p+8L : 0x2.0b981a509bab7298p-1080L : inexact-ok
+= exp tonearest ldbl-96-m68k -0x2.ebe227861639p+8L : 0x2.0b981a509bab7298p-1080L : inexact-ok
+= exp towardzero ldbl-96-m68k -0x2.ebe227861639p+8L : 0x2.0b981a509bab7298p-1080L : inexact-ok
+= exp upward ldbl-96-m68k -0x2.ebe227861639p+8L : 0x2.0b981a509bab729cp-1080L : inexact-ok
+= exp downward ldbl-128 -0x2.ebe227861639p+8L : 0x2.0b981a509bab72997118df69cd7ep-1080L : inexact-ok
+= exp tonearest ldbl-128 -0x2.ebe227861639p+8L : 0x2.0b981a509bab72997118df69cd8p-1080L : inexact-ok
+= exp towardzero ldbl-128 -0x2.ebe227861639p+8L : 0x2.0b981a509bab72997118df69cd7ep-1080L : inexact-ok
+= exp upward ldbl-128 -0x2.ebe227861639p+8L : 0x2.0b981a509bab72997118df69cd8p-1080L : inexact-ok
+= exp downward ldbl-128ibm -0x2.ebe227861639p+8L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp tonearest ldbl-128ibm -0x2.ebe227861639p+8L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp towardzero ldbl-128ibm -0x2.ebe227861639p+8L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp upward ldbl-128ibm -0x2.ebe227861639p+8L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
 exp -max
 = exp downward flt-32 -0xf.fffffp+124f : 0x0p+0f : inexact-ok underflow errno-erange
 = exp tonearest flt-32 -0xf.fffffp+124f : 0x0p+0f : inexact-ok underflow errno-erange
diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps
index a492da30d6..4ed02a2797 100644
--- a/sysdeps/i386/fpu/libm-test-ulps
+++ b/sysdeps/i386/fpu/libm-test-ulps
@@ -6017,6 +6017,30 @@ ildouble: 1
 ldouble: 1
 
 # exp_towardzero
+Test "exp_towardzero (-0x2.e870a4p+8)":
+ildouble: 1
+ldouble: 1
+Test "exp_towardzero (-0x2.e870a7e5e88c1f0cp+8)":
+ildouble: 1
+ldouble: 1
+Test "exp_towardzero (-0x2.e870a7e5e88c1f1p+8)":
+ildouble: 1
+ldouble: 1
+Test "exp_towardzero (-0x2.e870a7e5e88c2p+8)":
+ildouble: 1
+ldouble: 1
+Test "exp_towardzero (-0x2.e870a7e5e88cp+8)":
+ildouble: 1
+ldouble: 1
+Test "exp_towardzero (-0x2.e870a8p+8)":
+ildouble: 1
+ldouble: 1
+Test "exp_towardzero (-0x2.ebe224p+8)":
+ildouble: 1
+ldouble: 1
+Test "exp_towardzero (-0x2.ebe228p+8)":
+ildouble: 1
+ldouble: 1
 Test "exp_towardzero (0x2.c5cp+8)":
 double: 1
 idouble: 1
@@ -6047,6 +6071,12 @@ ildouble: 1
 ldouble: 1
 
 # exp_upward
+Test "exp_upward (-0x2.e870a7e5e88c1f0cp+8)":
+ildouble: 1
+ldouble: 1
+Test "exp_upward (-0x2.e870a7e5e88cp+8)":
+ildouble: 1
+ldouble: 1
 Test "exp_upward (1)":
 double: 1
 float: 1
@@ -8112,6 +8142,8 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: "expm1":
 ildouble: 1
diff --git a/sysdeps/ieee754/dbl-64/e_exp.c b/sysdeps/ieee754/dbl-64/e_exp.c
index df3aa5efaa..9d35e6d66c 100644
--- a/sysdeps/ieee754/dbl-64/e_exp.c
+++ b/sysdeps/ieee754/dbl-64/e_exp.c
@@ -39,6 +39,7 @@
 #include "uexp.tbl"
 #include <math_private.h>
 #include <fenv.h>
+#include <float.h>
 
 #ifndef SECTION
 # define SECTION
@@ -169,7 +170,7 @@ __ieee754_exp (double x)
 	  else
 	    {
 	      retval = __slowexp (x);
-	      goto ret;
+	      goto check_uflow_ret;
 	    }			/*if error is over bound */
 	}
       ex = -(1022 + ex);
@@ -185,13 +186,23 @@ __ieee754_exp (double x)
 	{
 	  binexp.i[HIGH_HALF] = 0x00100000;
 	  retval = (res - 1.0) * binexp.x;
-	  goto ret;
+	  goto check_uflow_ret;
 	}
       else
 	{
 	  retval = __slowexp (x);
-	  goto ret;
+	  goto check_uflow_ret;
 	}			/*   if error is over bound    */
+    check_uflow_ret:
+      if (retval < DBL_MIN)
+	{
+#if FLT_EVAL_METHOD != 0
+	  volatile
+#endif
+	  double force_underflow = tiny * tiny;
+	  math_force_eval (force_underflow);
+	}
+      goto ret;
     }
   else
     {
diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
index 5c923e69b3..e78514869d 100644
--- a/sysdeps/x86_64/fpu/libm-test-ulps
+++ b/sysdeps/x86_64/fpu/libm-test-ulps
@@ -6882,6 +6882,30 @@ ildouble: 1
 ldouble: 1
 
 # exp_towardzero
+Test "exp_towardzero (-0x2.e870a4p+8)":
+ildouble: 1
+ldouble: 1
+Test "exp_towardzero (-0x2.e870a7e5e88c1f0cp+8)":
+ildouble: 1
+ldouble: 1
+Test "exp_towardzero (-0x2.e870a7e5e88c1f1p+8)":
+ildouble: 1
+ldouble: 1
+Test "exp_towardzero (-0x2.e870a7e5e88c2p+8)":
+ildouble: 1
+ldouble: 1
+Test "exp_towardzero (-0x2.e870a7e5e88cp+8)":
+ildouble: 1
+ldouble: 1
+Test "exp_towardzero (-0x2.e870a8p+8)":
+ildouble: 1
+ldouble: 1
+Test "exp_towardzero (-0x2.ebe224p+8)":
+ildouble: 1
+ldouble: 1
+Test "exp_towardzero (-0x2.ebe228p+8)":
+ildouble: 1
+ldouble: 1
 Test "exp_towardzero (0x2.c5cp+8)":
 ildouble: 1
 ldouble: 1
@@ -6917,6 +6941,32 @@ ildouble: 1
 ldouble: 1
 
 # exp_upward
+Test "exp_upward (-0x2.e870a4p+8)":
+double: 1
+idouble: 1
+Test "exp_upward (-0x2.e870a7e5e88c1f0cp+8)":
+ildouble: 1
+ldouble: 1
+Test "exp_upward (-0x2.e870a7e5e88c2p+8)":
+double: 1
+idouble: 1
+Test "exp_upward (-0x2.e870a7e5e88cp+8)":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "exp_upward (-0x2.e870a8p+8)":
+double: 1
+idouble: 1
+Test "exp_upward (-0x2.ebe224p+8)":
+double: 1
+idouble: 1
+Test "exp_upward (-0x2.ebe227861639p+8)":
+double: 1
+idouble: 1
+Test "exp_upward (-0x2.ebe228p+8)":
+double: 1
+idouble: 1
 Test "exp_upward (-0x4.d2p+8)":
 double: 1
 idouble: 1
@@ -9208,6 +9258,8 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: "expm1":
 double: 1