about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--NEWS12
-rw-r--r--math/auto-libm-test-in7
-rw-r--r--math/auto-libm-test-out175
-rw-r--r--sysdeps/ieee754/dbl-64/e_exp2.c4
-rw-r--r--sysdeps/ieee754/flt-32/e_exp2f.c4
6 files changed, 203 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index dee1967ba5..a7f879af23 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2015-06-23  Joseph Myers  <joseph@codesourcery.com>
+
+	[BZ #18219]
+	* sysdeps/ieee754/dbl-64/e_exp2.c (__ieee754_exp2): Reduce
+	threshold on absolute value of exponent for which scaling is used.
+	* sysdeps/ieee754/flt-32/e_exp2f.c (__ieee754_exp2f): Likewise.
+	* math/auto-libm-test-in: Add more tests of exp2.
+	* math/auto-libm-test-out: Regenerated.
+
 2015-06-23  Dmitry V. Levin  <ldv@altlinux.org>
 
 	[BZ #17977]
diff --git a/NEWS b/NEWS
index d1032510fb..42ebdd1af6 100644
--- a/NEWS
+++ b/NEWS
@@ -18,12 +18,12 @@ Version 2.22
   17991, 17996, 17998, 17999, 18007, 18019, 18020, 18029, 18030, 18032,
   18034, 18036, 18038, 18039, 18042, 18043, 18046, 18047, 18049, 18068,
   18080, 18093, 18100, 18104, 18110, 18111, 18116, 18125, 18128, 18138,
-  18185, 18196, 18197, 18206, 18210, 18211, 18217, 18220, 18221, 18234,
-  18244, 18247, 18287, 18319, 18324, 18333, 18346, 18397, 18409, 18410,
-  18412, 18418, 18422, 18434, 18444, 18468, 18469, 18470, 18479, 18483,
-  18495, 18496, 18497, 18498, 18507, 18512, 18513, 18519, 18520, 18522,
-  18527, 18528, 18529, 18530, 18532, 18533, 18534, 18536, 18539, 18540,
-  18542, 18544, 18545, 18546, 18547, 18553, 18558, 18569.
+  18185, 18196, 18197, 18206, 18210, 18211, 18217, 18219, 18220, 18221,
+  18234, 18244, 18247, 18287, 18319, 18324, 18333, 18346, 18397, 18409,
+  18410, 18412, 18418, 18422, 18434, 18444, 18468, 18469, 18470, 18479,
+  18483, 18495, 18496, 18497, 18498, 18507, 18512, 18513, 18519, 18520,
+  18522, 18527, 18528, 18529, 18530, 18532, 18533, 18534, 18536, 18539,
+  18540, 18542, 18544, 18545, 18546, 18547, 18553, 18558, 18569.
 
 * Cache information can be queried via sysconf() function on s390 e.g. with
   _SC_LEVEL1_ICACHE_SIZE as argument.
diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in
index 9bae9d5570..cf7fc359b0 100644
--- a/math/auto-libm-test-in
+++ b/math/auto-libm-test-in
@@ -1271,9 +1271,16 @@ exp2 max
 exp2 -max
 exp2 0.75
 exp2 100.5
+exp2 -116.5
+exp2 -123.5
+exp2 -124.5
+exp2 -125.5
 exp2 127
 exp2 -149
 exp2 1000.25
+exp2 -1019.5
+exp2 -1020.5
+exp2 -1021.5
 exp2 1023
 exp2 -1074
 exp2 16383
diff --git a/math/auto-libm-test-out b/math/auto-libm-test-out
index 9f80736e86..556b833822 100644
--- a/math/auto-libm-test-out
+++ b/math/auto-libm-test-out
@@ -106691,6 +106691,106 @@ exp2 100.5
 = exp2 tonearest ldbl-128ibm 0x6.48p+4L : 0x1.6a09e667f3bcc908b2fb1366ea8p+100L : inexact-ok
 = exp2 towardzero ldbl-128ibm 0x6.48p+4L : 0x1.6a09e667f3bcc908b2fb1366ea8p+100L : inexact-ok
 = exp2 upward ldbl-128ibm 0x6.48p+4L : 0x1.6a09e667f3bcc908b2fb1366ebp+100L : inexact-ok
+exp2 -116.5
+= exp2 downward flt-32 -0x7.48p+4f : 0xb.504f3p-120f : inexact-ok
+= exp2 tonearest flt-32 -0x7.48p+4f : 0xb.504f3p-120f : inexact-ok
+= exp2 towardzero flt-32 -0x7.48p+4f : 0xb.504f3p-120f : inexact-ok
+= exp2 upward flt-32 -0x7.48p+4f : 0xb.504f4p-120f : inexact-ok
+= exp2 downward dbl-64 -0x7.48p+4 : 0xb.504f333f9de6p-120 : inexact-ok
+= exp2 tonearest dbl-64 -0x7.48p+4 : 0xb.504f333f9de68p-120 : inexact-ok
+= exp2 towardzero dbl-64 -0x7.48p+4 : 0xb.504f333f9de6p-120 : inexact-ok
+= exp2 upward dbl-64 -0x7.48p+4 : 0xb.504f333f9de68p-120 : inexact-ok
+= exp2 downward ldbl-96-intel -0x7.48p+4L : 0xb.504f333f9de6484p-120L : inexact-ok
+= exp2 tonearest ldbl-96-intel -0x7.48p+4L : 0xb.504f333f9de6484p-120L : inexact-ok
+= exp2 towardzero ldbl-96-intel -0x7.48p+4L : 0xb.504f333f9de6484p-120L : inexact-ok
+= exp2 upward ldbl-96-intel -0x7.48p+4L : 0xb.504f333f9de6485p-120L : inexact-ok
+= exp2 downward ldbl-96-m68k -0x7.48p+4L : 0xb.504f333f9de6484p-120L : inexact-ok
+= exp2 tonearest ldbl-96-m68k -0x7.48p+4L : 0xb.504f333f9de6484p-120L : inexact-ok
+= exp2 towardzero ldbl-96-m68k -0x7.48p+4L : 0xb.504f333f9de6484p-120L : inexact-ok
+= exp2 upward ldbl-96-m68k -0x7.48p+4L : 0xb.504f333f9de6485p-120L : inexact-ok
+= exp2 downward ldbl-128 -0x7.48p+4L : 0xb.504f333f9de6484597d89b3754a8p-120L : inexact-ok
+= exp2 tonearest ldbl-128 -0x7.48p+4L : 0xb.504f333f9de6484597d89b3754a8p-120L : inexact-ok
+= exp2 towardzero ldbl-128 -0x7.48p+4L : 0xb.504f333f9de6484597d89b3754a8p-120L : inexact-ok
+= exp2 upward ldbl-128 -0x7.48p+4L : 0xb.504f333f9de6484597d89b3754bp-120L : inexact-ok
+= exp2 downward ldbl-128ibm -0x7.48p+4L : 0xb.504f333f9de6484597d89b3754p-120L : inexact-ok
+= exp2 tonearest ldbl-128ibm -0x7.48p+4L : 0xb.504f333f9de6484597d89b3754p-120L : inexact-ok
+= exp2 towardzero ldbl-128ibm -0x7.48p+4L : 0xb.504f333f9de6484597d89b3754p-120L : inexact-ok
+= exp2 upward ldbl-128ibm -0x7.48p+4L : 0xb.504f333f9de6484597d89b3758p-120L : inexact-ok
+exp2 -123.5
+= exp2 downward flt-32 -0x7.b8p+4f : 0x1.6a09e6p-124f : inexact-ok
+= exp2 tonearest flt-32 -0x7.b8p+4f : 0x1.6a09e6p-124f : inexact-ok
+= exp2 towardzero flt-32 -0x7.b8p+4f : 0x1.6a09e6p-124f : inexact-ok
+= exp2 upward flt-32 -0x7.b8p+4f : 0x1.6a09e8p-124f : inexact-ok
+= exp2 downward dbl-64 -0x7.b8p+4 : 0x1.6a09e667f3bccp-124 : inexact-ok
+= exp2 tonearest dbl-64 -0x7.b8p+4 : 0x1.6a09e667f3bcdp-124 : inexact-ok
+= exp2 towardzero dbl-64 -0x7.b8p+4 : 0x1.6a09e667f3bccp-124 : inexact-ok
+= exp2 upward dbl-64 -0x7.b8p+4 : 0x1.6a09e667f3bcdp-124 : inexact-ok
+= exp2 downward ldbl-96-intel -0x7.b8p+4L : 0x1.6a09e667f3bcc908p-124L : inexact-ok
+= exp2 tonearest ldbl-96-intel -0x7.b8p+4L : 0x1.6a09e667f3bcc908p-124L : inexact-ok
+= exp2 towardzero ldbl-96-intel -0x7.b8p+4L : 0x1.6a09e667f3bcc908p-124L : inexact-ok
+= exp2 upward ldbl-96-intel -0x7.b8p+4L : 0x1.6a09e667f3bcc90ap-124L : inexact-ok
+= exp2 downward ldbl-96-m68k -0x7.b8p+4L : 0x1.6a09e667f3bcc908p-124L : inexact-ok
+= exp2 tonearest ldbl-96-m68k -0x7.b8p+4L : 0x1.6a09e667f3bcc908p-124L : inexact-ok
+= exp2 towardzero ldbl-96-m68k -0x7.b8p+4L : 0x1.6a09e667f3bcc908p-124L : inexact-ok
+= exp2 upward ldbl-96-m68k -0x7.b8p+4L : 0x1.6a09e667f3bcc90ap-124L : inexact-ok
+= exp2 downward ldbl-128 -0x7.b8p+4L : 0x1.6a09e667f3bcc908b2fb1366ea95p-124L : inexact-ok
+= exp2 tonearest ldbl-128 -0x7.b8p+4L : 0x1.6a09e667f3bcc908b2fb1366ea95p-124L : inexact-ok
+= exp2 towardzero ldbl-128 -0x7.b8p+4L : 0x1.6a09e667f3bcc908b2fb1366ea95p-124L : inexact-ok
+= exp2 upward ldbl-128 -0x7.b8p+4L : 0x1.6a09e667f3bcc908b2fb1366ea96p-124L : inexact-ok
+= exp2 downward ldbl-128ibm -0x7.b8p+4L : 0x1.6a09e667f3bcc908b2fb1366ea8p-124L : inexact-ok
+= exp2 tonearest ldbl-128ibm -0x7.b8p+4L : 0x1.6a09e667f3bcc908b2fb1366ea8p-124L : inexact-ok
+= exp2 towardzero ldbl-128ibm -0x7.b8p+4L : 0x1.6a09e667f3bcc908b2fb1366ea8p-124L : inexact-ok
+= exp2 upward ldbl-128ibm -0x7.b8p+4L : 0x1.6a09e667f3bcc908b2fb1366ebp-124L : inexact-ok
+exp2 -124.5
+= exp2 downward flt-32 -0x7.c8p+4f : 0xb.504f3p-128f : inexact-ok
+= exp2 tonearest flt-32 -0x7.c8p+4f : 0xb.504f3p-128f : inexact-ok
+= exp2 towardzero flt-32 -0x7.c8p+4f : 0xb.504f3p-128f : inexact-ok
+= exp2 upward flt-32 -0x7.c8p+4f : 0xb.504f4p-128f : inexact-ok
+= exp2 downward dbl-64 -0x7.c8p+4 : 0xb.504f333f9de6p-128 : inexact-ok
+= exp2 tonearest dbl-64 -0x7.c8p+4 : 0xb.504f333f9de68p-128 : inexact-ok
+= exp2 towardzero dbl-64 -0x7.c8p+4 : 0xb.504f333f9de6p-128 : inexact-ok
+= exp2 upward dbl-64 -0x7.c8p+4 : 0xb.504f333f9de68p-128 : inexact-ok
+= exp2 downward ldbl-96-intel -0x7.c8p+4L : 0xb.504f333f9de6484p-128L : inexact-ok
+= exp2 tonearest ldbl-96-intel -0x7.c8p+4L : 0xb.504f333f9de6484p-128L : inexact-ok
+= exp2 towardzero ldbl-96-intel -0x7.c8p+4L : 0xb.504f333f9de6484p-128L : inexact-ok
+= exp2 upward ldbl-96-intel -0x7.c8p+4L : 0xb.504f333f9de6485p-128L : inexact-ok
+= exp2 downward ldbl-96-m68k -0x7.c8p+4L : 0xb.504f333f9de6484p-128L : inexact-ok
+= exp2 tonearest ldbl-96-m68k -0x7.c8p+4L : 0xb.504f333f9de6484p-128L : inexact-ok
+= exp2 towardzero ldbl-96-m68k -0x7.c8p+4L : 0xb.504f333f9de6484p-128L : inexact-ok
+= exp2 upward ldbl-96-m68k -0x7.c8p+4L : 0xb.504f333f9de6485p-128L : inexact-ok
+= exp2 downward ldbl-128 -0x7.c8p+4L : 0xb.504f333f9de6484597d89b3754a8p-128L : inexact-ok
+= exp2 tonearest ldbl-128 -0x7.c8p+4L : 0xb.504f333f9de6484597d89b3754a8p-128L : inexact-ok
+= exp2 towardzero ldbl-128 -0x7.c8p+4L : 0xb.504f333f9de6484597d89b3754a8p-128L : inexact-ok
+= exp2 upward ldbl-128 -0x7.c8p+4L : 0xb.504f333f9de6484597d89b3754bp-128L : inexact-ok
+= exp2 downward ldbl-128ibm -0x7.c8p+4L : 0xb.504f333f9de6484597d89b3754p-128L : inexact-ok
+= exp2 tonearest ldbl-128ibm -0x7.c8p+4L : 0xb.504f333f9de6484597d89b3754p-128L : inexact-ok
+= exp2 towardzero ldbl-128ibm -0x7.c8p+4L : 0xb.504f333f9de6484597d89b3754p-128L : inexact-ok
+= exp2 upward ldbl-128ibm -0x7.c8p+4L : 0xb.504f333f9de6484597d89b3758p-128L : inexact-ok
+exp2 -125.5
+= exp2 downward flt-32 -0x7.d8p+4f : 0x5.a82798p-128f : inexact-ok
+= exp2 tonearest flt-32 -0x7.d8p+4f : 0x5.a82798p-128f : inexact-ok
+= exp2 towardzero flt-32 -0x7.d8p+4f : 0x5.a82798p-128f : inexact-ok
+= exp2 upward flt-32 -0x7.d8p+4f : 0x5.a827ap-128f : inexact-ok
+= exp2 downward dbl-64 -0x7.d8p+4 : 0x5.a827999fcef3p-128 : inexact-ok
+= exp2 tonearest dbl-64 -0x7.d8p+4 : 0x5.a827999fcef34p-128 : inexact-ok
+= exp2 towardzero dbl-64 -0x7.d8p+4 : 0x5.a827999fcef3p-128 : inexact-ok
+= exp2 upward dbl-64 -0x7.d8p+4 : 0x5.a827999fcef34p-128 : inexact-ok
+= exp2 downward ldbl-96-intel -0x7.d8p+4L : 0x5.a827999fcef3242p-128L : inexact-ok
+= exp2 tonearest ldbl-96-intel -0x7.d8p+4L : 0x5.a827999fcef3242p-128L : inexact-ok
+= exp2 towardzero ldbl-96-intel -0x7.d8p+4L : 0x5.a827999fcef3242p-128L : inexact-ok
+= exp2 upward ldbl-96-intel -0x7.d8p+4L : 0x5.a827999fcef32428p-128L : inexact-ok
+= exp2 downward ldbl-96-m68k -0x7.d8p+4L : 0x5.a827999fcef3242p-128L : inexact-ok
+= exp2 tonearest ldbl-96-m68k -0x7.d8p+4L : 0x5.a827999fcef3242p-128L : inexact-ok
+= exp2 towardzero ldbl-96-m68k -0x7.d8p+4L : 0x5.a827999fcef3242p-128L : inexact-ok
+= exp2 upward ldbl-96-m68k -0x7.d8p+4L : 0x5.a827999fcef32428p-128L : inexact-ok
+= exp2 downward ldbl-128 -0x7.d8p+4L : 0x5.a827999fcef32422cbec4d9baa54p-128L : inexact-ok
+= exp2 tonearest ldbl-128 -0x7.d8p+4L : 0x5.a827999fcef32422cbec4d9baa54p-128L : inexact-ok
+= exp2 towardzero ldbl-128 -0x7.d8p+4L : 0x5.a827999fcef32422cbec4d9baa54p-128L : inexact-ok
+= exp2 upward ldbl-128 -0x7.d8p+4L : 0x5.a827999fcef32422cbec4d9baa58p-128L : inexact-ok
+= exp2 downward ldbl-128ibm -0x7.d8p+4L : 0x5.a827999fcef32422cbec4d9baap-128L : inexact-ok
+= exp2 tonearest ldbl-128ibm -0x7.d8p+4L : 0x5.a827999fcef32422cbec4d9baap-128L : inexact-ok
+= exp2 towardzero ldbl-128ibm -0x7.d8p+4L : 0x5.a827999fcef32422cbec4d9baap-128L : inexact-ok
+= exp2 upward ldbl-128ibm -0x7.d8p+4L : 0x5.a827999fcef32422cbec4d9bacp-128L : inexact-ok
 exp2 127
 = exp2 downward flt-32 0x7.fp+4f : 0x8p+124f : inexact-ok
 = exp2 tonearest flt-32 0x7.fp+4f : 0x8p+124f : inexact-ok
@@ -106766,6 +106866,81 @@ exp2 1000.25
 = exp2 tonearest ldbl-128ibm 0x3.e84p+8L : 0x1.306fe0a31b7152de8d5a46305c8p+1000L : inexact-ok
 = exp2 towardzero ldbl-128ibm 0x3.e84p+8L : 0x1.306fe0a31b7152de8d5a46305c8p+1000L : inexact-ok
 = exp2 upward ldbl-128ibm 0x3.e84p+8L : 0x1.306fe0a31b7152de8d5a46305dp+1000L : inexact-ok
+exp2 -1019.5
+= exp2 downward flt-32 -0x3.fb8p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp2 tonearest flt-32 -0x3.fb8p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp2 towardzero flt-32 -0x3.fb8p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp2 upward flt-32 -0x3.fb8p+8f : 0x8p-152f : inexact-ok underflow errno-erange-ok
+= exp2 downward dbl-64 -0x3.fb8p+8 : 0x1.6a09e667f3bccp-1020 : inexact-ok
+= exp2 tonearest dbl-64 -0x3.fb8p+8 : 0x1.6a09e667f3bcdp-1020 : inexact-ok
+= exp2 towardzero dbl-64 -0x3.fb8p+8 : 0x1.6a09e667f3bccp-1020 : inexact-ok
+= exp2 upward dbl-64 -0x3.fb8p+8 : 0x1.6a09e667f3bcdp-1020 : inexact-ok
+= exp2 downward ldbl-96-intel -0x3.fb8p+8L : 0x1.6a09e667f3bcc908p-1020L : inexact-ok
+= exp2 tonearest ldbl-96-intel -0x3.fb8p+8L : 0x1.6a09e667f3bcc908p-1020L : inexact-ok
+= exp2 towardzero ldbl-96-intel -0x3.fb8p+8L : 0x1.6a09e667f3bcc908p-1020L : inexact-ok
+= exp2 upward ldbl-96-intel -0x3.fb8p+8L : 0x1.6a09e667f3bcc90ap-1020L : inexact-ok
+= exp2 downward ldbl-96-m68k -0x3.fb8p+8L : 0x1.6a09e667f3bcc908p-1020L : inexact-ok
+= exp2 tonearest ldbl-96-m68k -0x3.fb8p+8L : 0x1.6a09e667f3bcc908p-1020L : inexact-ok
+= exp2 towardzero ldbl-96-m68k -0x3.fb8p+8L : 0x1.6a09e667f3bcc908p-1020L : inexact-ok
+= exp2 upward ldbl-96-m68k -0x3.fb8p+8L : 0x1.6a09e667f3bcc90ap-1020L : inexact-ok
+= exp2 downward ldbl-128 -0x3.fb8p+8L : 0x1.6a09e667f3bcc908b2fb1366ea95p-1020L : inexact-ok
+= exp2 tonearest ldbl-128 -0x3.fb8p+8L : 0x1.6a09e667f3bcc908b2fb1366ea95p-1020L : inexact-ok
+= exp2 towardzero ldbl-128 -0x3.fb8p+8L : 0x1.6a09e667f3bcc908b2fb1366ea95p-1020L : inexact-ok
+= exp2 upward ldbl-128 -0x3.fb8p+8L : 0x1.6a09e667f3bcc908b2fb1366ea96p-1020L : inexact-ok
+= exp2 downward ldbl-128ibm -0x3.fb8p+8L : 0x1.6a09e667f3bcc8p-1020L : inexact-ok underflow errno-erange-ok
+= exp2 tonearest ldbl-128ibm -0x3.fb8p+8L : 0x1.6a09e667f3bcc8p-1020L : inexact-ok underflow errno-erange-ok
+= exp2 towardzero ldbl-128ibm -0x3.fb8p+8L : 0x1.6a09e667f3bcc8p-1020L : inexact-ok underflow errno-erange-ok
+= exp2 upward ldbl-128ibm -0x3.fb8p+8L : 0x1.6a09e667f3bcccp-1020L : inexact-ok underflow errno-erange-ok
+exp2 -1020.5
+= exp2 downward flt-32 -0x3.fc8p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp2 tonearest flt-32 -0x3.fc8p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp2 towardzero flt-32 -0x3.fc8p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp2 upward flt-32 -0x3.fc8p+8f : 0x8p-152f : inexact-ok underflow errno-erange-ok
+= exp2 downward dbl-64 -0x3.fc8p+8 : 0xb.504f333f9de6p-1024 : inexact-ok
+= exp2 tonearest dbl-64 -0x3.fc8p+8 : 0xb.504f333f9de68p-1024 : inexact-ok
+= exp2 towardzero dbl-64 -0x3.fc8p+8 : 0xb.504f333f9de6p-1024 : inexact-ok
+= exp2 upward dbl-64 -0x3.fc8p+8 : 0xb.504f333f9de68p-1024 : inexact-ok
+= exp2 downward ldbl-96-intel -0x3.fc8p+8L : 0xb.504f333f9de6484p-1024L : inexact-ok
+= exp2 tonearest ldbl-96-intel -0x3.fc8p+8L : 0xb.504f333f9de6484p-1024L : inexact-ok
+= exp2 towardzero ldbl-96-intel -0x3.fc8p+8L : 0xb.504f333f9de6484p-1024L : inexact-ok
+= exp2 upward ldbl-96-intel -0x3.fc8p+8L : 0xb.504f333f9de6485p-1024L : inexact-ok
+= exp2 downward ldbl-96-m68k -0x3.fc8p+8L : 0xb.504f333f9de6484p-1024L : inexact-ok
+= exp2 tonearest ldbl-96-m68k -0x3.fc8p+8L : 0xb.504f333f9de6484p-1024L : inexact-ok
+= exp2 towardzero ldbl-96-m68k -0x3.fc8p+8L : 0xb.504f333f9de6484p-1024L : inexact-ok
+= exp2 upward ldbl-96-m68k -0x3.fc8p+8L : 0xb.504f333f9de6485p-1024L : inexact-ok
+= exp2 downward ldbl-128 -0x3.fc8p+8L : 0xb.504f333f9de6484597d89b3754a8p-1024L : inexact-ok
+= exp2 tonearest ldbl-128 -0x3.fc8p+8L : 0xb.504f333f9de6484597d89b3754a8p-1024L : inexact-ok
+= exp2 towardzero ldbl-128 -0x3.fc8p+8L : 0xb.504f333f9de6484597d89b3754a8p-1024L : inexact-ok
+= exp2 upward ldbl-128 -0x3.fc8p+8L : 0xb.504f333f9de6484597d89b3754bp-1024L : inexact-ok
+= exp2 downward ldbl-128ibm -0x3.fc8p+8L : 0xb.504f333f9de64p-1024L : inexact-ok underflow errno-erange-ok
+= exp2 tonearest ldbl-128ibm -0x3.fc8p+8L : 0xb.504f333f9de64p-1024L : inexact-ok underflow errno-erange-ok
+= exp2 towardzero ldbl-128ibm -0x3.fc8p+8L : 0xb.504f333f9de64p-1024L : inexact-ok underflow errno-erange-ok
+= exp2 upward ldbl-128ibm -0x3.fc8p+8L : 0xb.504f333f9de68p-1024L : inexact-ok underflow errno-erange-ok
+exp2 -1021.5
+= exp2 downward flt-32 -0x3.fd8p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp2 tonearest flt-32 -0x3.fd8p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp2 towardzero flt-32 -0x3.fd8p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp2 upward flt-32 -0x3.fd8p+8f : 0x8p-152f : inexact-ok underflow errno-erange-ok
+= exp2 downward dbl-64 -0x3.fd8p+8 : 0x5.a827999fcef3p-1024 : inexact-ok
+= exp2 tonearest dbl-64 -0x3.fd8p+8 : 0x5.a827999fcef34p-1024 : inexact-ok
+= exp2 towardzero dbl-64 -0x3.fd8p+8 : 0x5.a827999fcef3p-1024 : inexact-ok
+= exp2 upward dbl-64 -0x3.fd8p+8 : 0x5.a827999fcef34p-1024 : inexact-ok
+= exp2 downward ldbl-96-intel -0x3.fd8p+8L : 0x5.a827999fcef3242p-1024L : inexact-ok
+= exp2 tonearest ldbl-96-intel -0x3.fd8p+8L : 0x5.a827999fcef3242p-1024L : inexact-ok
+= exp2 towardzero ldbl-96-intel -0x3.fd8p+8L : 0x5.a827999fcef3242p-1024L : inexact-ok
+= exp2 upward ldbl-96-intel -0x3.fd8p+8L : 0x5.a827999fcef32428p-1024L : inexact-ok
+= exp2 downward ldbl-96-m68k -0x3.fd8p+8L : 0x5.a827999fcef3242p-1024L : inexact-ok
+= exp2 tonearest ldbl-96-m68k -0x3.fd8p+8L : 0x5.a827999fcef3242p-1024L : inexact-ok
+= exp2 towardzero ldbl-96-m68k -0x3.fd8p+8L : 0x5.a827999fcef3242p-1024L : inexact-ok
+= exp2 upward ldbl-96-m68k -0x3.fd8p+8L : 0x5.a827999fcef32428p-1024L : inexact-ok
+= exp2 downward ldbl-128 -0x3.fd8p+8L : 0x5.a827999fcef32422cbec4d9baa54p-1024L : inexact-ok
+= exp2 tonearest ldbl-128 -0x3.fd8p+8L : 0x5.a827999fcef32422cbec4d9baa54p-1024L : inexact-ok
+= exp2 towardzero ldbl-128 -0x3.fd8p+8L : 0x5.a827999fcef32422cbec4d9baa54p-1024L : inexact-ok
+= exp2 upward ldbl-128 -0x3.fd8p+8L : 0x5.a827999fcef32422cbec4d9baa58p-1024L : inexact-ok
+= exp2 downward ldbl-128ibm -0x3.fd8p+8L : 0x5.a827999fcef3p-1024L : inexact-ok underflow errno-erange-ok
+= exp2 tonearest ldbl-128ibm -0x3.fd8p+8L : 0x5.a827999fcef34p-1024L : inexact-ok underflow errno-erange-ok
+= exp2 towardzero ldbl-128ibm -0x3.fd8p+8L : 0x5.a827999fcef3p-1024L : inexact-ok underflow errno-erange-ok
+= exp2 upward ldbl-128ibm -0x3.fd8p+8L : 0x5.a827999fcef34p-1024L : inexact-ok underflow errno-erange-ok
 exp2 1023
 = exp2 downward flt-32 0x3.ffp+8f : 0xf.fffffp+124f : inexact-ok overflow errno-erange-ok
 = exp2 tonearest flt-32 0x3.ffp+8f : plus_infty : inexact-ok overflow errno-erange
diff --git a/sysdeps/ieee754/dbl-64/e_exp2.c b/sysdeps/ieee754/dbl-64/e_exp2.c
index 948a756df7..30f0a8f529 100644
--- a/sysdeps/ieee754/dbl-64/e_exp2.c
+++ b/sysdeps/ieee754/dbl-64/e_exp2.c
@@ -96,7 +96,9 @@ __ieee754_exp2 (double x)
 	/* 3. Compute ex2 = 2^(t/512+e+ex).  */
 	ex2_u.d = exp2_accuratetable[tval & 511];
 	tval >>= 9;
-	unsafe = abs (tval) >= -DBL_MIN_EXP - 1;
+	/* x2 is an integer multiple of 2^-54; avoid intermediate
+	   underflow from the calculation of x22 * x.  */
+	unsafe = abs (tval) >= -DBL_MIN_EXP - 56;
 	ex2_u.ieee.exponent += tval >> unsafe;
 	scale_u.d = 1.0;
 	scale_u.ieee.exponent += tval - (tval >> unsafe);
diff --git a/sysdeps/ieee754/flt-32/e_exp2f.c b/sysdeps/ieee754/flt-32/e_exp2f.c
index f3e3a8e6fc..0b75a7ea2a 100644
--- a/sysdeps/ieee754/flt-32/e_exp2f.c
+++ b/sysdeps/ieee754/flt-32/e_exp2f.c
@@ -89,7 +89,9 @@ __ieee754_exp2f (float x)
 	/* 3. Compute ex2 = 2^(t/255+e+ex).  */
 	ex2_u.f = __exp2f_atable[tval & 255];
 	tval >>= 8;
-	unsafe = abs(tval) >= -FLT_MIN_EXP - 1;
+	/* x2 is an integer multiple of 2^-30; avoid intermediate
+	   underflow from the calculation of x22 * x.  */
+	unsafe = abs(tval) >= -FLT_MIN_EXP - 32;
 	ex2_u.ieee.exponent += tval >> unsafe;
 	scale_u.f = 1.0;
 	scale_u.ieee.exponent += tval - (tval >> unsafe);