about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2013-12-03 20:50:51 +0000
committerJoseph Myers <joseph@codesourcery.com>2013-12-03 20:50:51 +0000
commit17dea1887fcc116941e07cb0f5f2078140ab0384 (patch)
tree1b7f0def9e7037e6e97efc4419df028a852e314c
parentb20de2c3d9d751eb259c321426188eefc64fcbe9 (diff)
downloadglibc-17dea1887fcc116941e07cb0f5f2078140ab0384.tar.gz
glibc-17dea1887fcc116941e07cb0f5f2078140ab0384.tar.xz
glibc-17dea1887fcc116941e07cb0f5f2078140ab0384.zip
Fix exp2 errno setting on underflow (bug 16283).
-rw-r--r--ChangeLog10
-rw-r--r--NEWS2
-rw-r--r--math/auto-libm-test-in12
-rw-r--r--math/auto-libm-test-out170
-rw-r--r--math/w_exp2.c2
-rw-r--r--math/w_exp2f.c2
-rw-r--r--math/w_exp2l.c2
7 files changed, 103 insertions, 97 deletions
diff --git a/ChangeLog b/ChangeLog
index 4f19e3df61..74c24838df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2013-12-03  Joseph Myers  <joseph@codesourcery.com>
+
+	[BZ #16283]
+	* math/w_exp2.c (__exp2): Handle a zero result as underflow.
+	* math/w_exp2f.c (__exp2f): Likewise.
+	* math/w_exp2l.c (__exp2l): Likewise.
+	* math/auto-libm-test-in: Do not allow missing errno on exp2
+	underflow.
+	* math/auto-libm-test-out: Regenerated.
+
 2013-12-03  Ondřej Bílka  <neleai@seznam.cz>
 
 	[BZ #16274]
diff --git a/NEWS b/NEWS
index 574cb899ce..eec76c4c5b 100644
--- a/NEWS
+++ b/NEWS
@@ -20,7 +20,7 @@ Version 2.19
   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, 16289.
+  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 126a9eaec7..83832a7f35 100644
--- a/math/auto-libm-test-in
+++ b/math/auto-libm-test-in
@@ -203,22 +203,18 @@ exp2 -0
 exp2 10
 exp2 -1
 exp2 1e6
-# Bug 16283: errno may not be set on underflow.
-exp2 -1e6 missing-errno
+exp2 -1e6
 exp2 max
-# Bug 16283: errno may not be set on underflow.
-exp2 -max missing-errno
+exp2 -max
 exp2 0.75
 exp2 100.5
 exp2 127
 exp2 -149
 exp2 1000.25
 exp2 1023
-# Bug 16283: errno may not be set on underflow.
-exp2 -1074 missing-errno
+exp2 -1074
 exp2 16383
-# Bug 16283: errno may not be set on underflow.
-exp2 -16400 missing-errno
+exp2 -16400
 
 expm1 0
 expm1 -0
diff --git a/math/auto-libm-test-out b/math/auto-libm-test-out
index 9b3c398893..4241399a9a 100644
--- a/math/auto-libm-test-out
+++ b/math/auto-libm-test-out
@@ -6725,30 +6725,30 @@ exp2 1e6
 = exp2 tonearest ldbl-128ibm 0xf.424p+16L : plus_infty : inexact-ok overflow errno-erange
 = exp2 towardzero ldbl-128ibm 0xf.424p+16L : 0xf.ffffffffffffbffffffffffffcp+1020L : inexact-ok overflow errno-erange-ok
 = exp2 upward ldbl-128ibm 0xf.424p+16L : plus_infty : inexact-ok overflow errno-erange
-exp2 -1e6 missing-errno
-= exp2 downward flt-32 -0xf.424p+16f : 0x0p+0f : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 tonearest flt-32 -0xf.424p+16f : 0x0p+0f : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 towardzero flt-32 -0xf.424p+16f : 0x0p+0f : inexact-ok underflow errno-erange errno-erange-ok
+exp2 -1e6
+= exp2 downward flt-32 -0xf.424p+16f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp2 tonearest flt-32 -0xf.424p+16f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp2 towardzero flt-32 -0xf.424p+16f : 0x0p+0f : inexact-ok underflow errno-erange
 = exp2 upward flt-32 -0xf.424p+16f : 0x8p-152f : inexact-ok underflow errno-erange-ok
-= exp2 downward dbl-64 -0xf.424p+16 : 0x0p+0 : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 tonearest dbl-64 -0xf.424p+16 : 0x0p+0 : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 towardzero dbl-64 -0xf.424p+16 : 0x0p+0 : inexact-ok underflow errno-erange errno-erange-ok
+= exp2 downward dbl-64 -0xf.424p+16 : 0x0p+0 : inexact-ok underflow errno-erange
+= exp2 tonearest dbl-64 -0xf.424p+16 : 0x0p+0 : inexact-ok underflow errno-erange
+= exp2 towardzero dbl-64 -0xf.424p+16 : 0x0p+0 : inexact-ok underflow errno-erange
 = exp2 upward dbl-64 -0xf.424p+16 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
-= exp2 downward ldbl-96-intel -0xf.424p+16L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 tonearest ldbl-96-intel -0xf.424p+16L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 towardzero ldbl-96-intel -0xf.424p+16L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
+= exp2 downward ldbl-96-intel -0xf.424p+16L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 tonearest ldbl-96-intel -0xf.424p+16L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 towardzero ldbl-96-intel -0xf.424p+16L : 0x0p+0L : inexact-ok underflow errno-erange
 = exp2 upward ldbl-96-intel -0xf.424p+16L : 0x8p-16448L : inexact-ok underflow errno-erange-ok
-= exp2 downward ldbl-96-m68k -0xf.424p+16L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 tonearest ldbl-96-m68k -0xf.424p+16L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 towardzero ldbl-96-m68k -0xf.424p+16L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
+= exp2 downward ldbl-96-m68k -0xf.424p+16L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 tonearest ldbl-96-m68k -0xf.424p+16L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 towardzero ldbl-96-m68k -0xf.424p+16L : 0x0p+0L : inexact-ok underflow errno-erange
 = exp2 upward ldbl-96-m68k -0xf.424p+16L : 0x4p-16448L : inexact-ok underflow errno-erange-ok
-= exp2 downward ldbl-128 -0xf.424p+16L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 tonearest ldbl-128 -0xf.424p+16L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 towardzero ldbl-128 -0xf.424p+16L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
+= exp2 downward ldbl-128 -0xf.424p+16L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 tonearest ldbl-128 -0xf.424p+16L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 towardzero ldbl-128 -0xf.424p+16L : 0x0p+0L : inexact-ok underflow errno-erange
 = exp2 upward ldbl-128 -0xf.424p+16L : 0x4p-16496L : inexact-ok underflow errno-erange-ok
-= exp2 downward ldbl-128ibm -0xf.424p+16L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 tonearest ldbl-128ibm -0xf.424p+16L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 towardzero ldbl-128ibm -0xf.424p+16L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
+= exp2 downward ldbl-128ibm -0xf.424p+16L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 tonearest ldbl-128ibm -0xf.424p+16L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 towardzero ldbl-128ibm -0xf.424p+16L : 0x0p+0L : inexact-ok underflow errno-erange
 = exp2 upward ldbl-128ibm -0xf.424p+16L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
 exp2 max
 = exp2 downward flt-32 0xf.fffffp+124f : 0xf.fffffp+124f : inexact-ok overflow errno-erange-ok
@@ -6819,74 +6819,74 @@ exp2 max
 = exp2 tonearest ldbl-128ibm 0xf.ffffffffffffbffffffffffffcp+1020L : plus_infty : inexact-ok overflow errno-erange
 = exp2 towardzero ldbl-128ibm 0xf.ffffffffffffbffffffffffffcp+1020L : 0xf.ffffffffffffbffffffffffffcp+1020L : inexact-ok overflow errno-erange-ok
 = exp2 upward ldbl-128ibm 0xf.ffffffffffffbffffffffffffcp+1020L : plus_infty : inexact-ok overflow errno-erange
-exp2 -max missing-errno
-= exp2 downward flt-32 -0xf.fffffp+124f : 0x0p+0f : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 tonearest flt-32 -0xf.fffffp+124f : 0x0p+0f : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 towardzero flt-32 -0xf.fffffp+124f : 0x0p+0f : inexact-ok underflow errno-erange errno-erange-ok
+exp2 -max
+= exp2 downward flt-32 -0xf.fffffp+124f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp2 tonearest flt-32 -0xf.fffffp+124f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp2 towardzero flt-32 -0xf.fffffp+124f : 0x0p+0f : inexact-ok underflow errno-erange
 = exp2 upward flt-32 -0xf.fffffp+124f : 0x8p-152f : inexact-ok underflow errno-erange-ok
-= exp2 downward dbl-64 -0xf.fffffp+124 : 0x0p+0 : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 tonearest dbl-64 -0xf.fffffp+124 : 0x0p+0 : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 towardzero dbl-64 -0xf.fffffp+124 : 0x0p+0 : inexact-ok underflow errno-erange errno-erange-ok
+= exp2 downward dbl-64 -0xf.fffffp+124 : 0x0p+0 : inexact-ok underflow errno-erange
+= exp2 tonearest dbl-64 -0xf.fffffp+124 : 0x0p+0 : inexact-ok underflow errno-erange
+= exp2 towardzero dbl-64 -0xf.fffffp+124 : 0x0p+0 : inexact-ok underflow errno-erange
 = exp2 upward dbl-64 -0xf.fffffp+124 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
-= exp2 downward ldbl-96-intel -0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 tonearest ldbl-96-intel -0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 towardzero ldbl-96-intel -0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
+= exp2 downward ldbl-96-intel -0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 tonearest ldbl-96-intel -0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 towardzero ldbl-96-intel -0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange
 = exp2 upward ldbl-96-intel -0xf.fffffp+124L : 0x8p-16448L : inexact-ok underflow errno-erange-ok
-= exp2 downward ldbl-96-m68k -0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 tonearest ldbl-96-m68k -0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 towardzero ldbl-96-m68k -0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
+= exp2 downward ldbl-96-m68k -0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 tonearest ldbl-96-m68k -0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 towardzero ldbl-96-m68k -0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange
 = exp2 upward ldbl-96-m68k -0xf.fffffp+124L : 0x4p-16448L : inexact-ok underflow errno-erange-ok
-= exp2 downward ldbl-128 -0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 tonearest ldbl-128 -0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 towardzero ldbl-128 -0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
+= exp2 downward ldbl-128 -0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 tonearest ldbl-128 -0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 towardzero ldbl-128 -0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange
 = exp2 upward ldbl-128 -0xf.fffffp+124L : 0x4p-16496L : inexact-ok underflow errno-erange-ok
-= exp2 downward ldbl-128ibm -0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 tonearest ldbl-128ibm -0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 towardzero ldbl-128ibm -0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
+= exp2 downward ldbl-128ibm -0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 tonearest ldbl-128ibm -0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 towardzero ldbl-128ibm -0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange
 = exp2 upward ldbl-128ibm -0xf.fffffp+124L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
-= exp2 downward dbl-64 -0xf.ffffffffffff8p+1020 : 0x0p+0 : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 tonearest dbl-64 -0xf.ffffffffffff8p+1020 : 0x0p+0 : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 towardzero dbl-64 -0xf.ffffffffffff8p+1020 : 0x0p+0 : inexact-ok underflow errno-erange errno-erange-ok
+= exp2 downward dbl-64 -0xf.ffffffffffff8p+1020 : 0x0p+0 : inexact-ok underflow errno-erange
+= exp2 tonearest dbl-64 -0xf.ffffffffffff8p+1020 : 0x0p+0 : inexact-ok underflow errno-erange
+= exp2 towardzero dbl-64 -0xf.ffffffffffff8p+1020 : 0x0p+0 : inexact-ok underflow errno-erange
 = exp2 upward dbl-64 -0xf.ffffffffffff8p+1020 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
-= exp2 downward ldbl-96-intel -0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 tonearest ldbl-96-intel -0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 towardzero ldbl-96-intel -0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
+= exp2 downward ldbl-96-intel -0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 tonearest ldbl-96-intel -0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 towardzero ldbl-96-intel -0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange
 = exp2 upward ldbl-96-intel -0xf.ffffffffffff8p+1020L : 0x8p-16448L : inexact-ok underflow errno-erange-ok
-= exp2 downward ldbl-96-m68k -0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 tonearest ldbl-96-m68k -0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 towardzero ldbl-96-m68k -0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
+= exp2 downward ldbl-96-m68k -0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 tonearest ldbl-96-m68k -0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 towardzero ldbl-96-m68k -0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange
 = exp2 upward ldbl-96-m68k -0xf.ffffffffffff8p+1020L : 0x4p-16448L : inexact-ok underflow errno-erange-ok
-= exp2 downward ldbl-128 -0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 tonearest ldbl-128 -0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 towardzero ldbl-128 -0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
+= exp2 downward ldbl-128 -0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 tonearest ldbl-128 -0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 towardzero ldbl-128 -0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange
 = exp2 upward ldbl-128 -0xf.ffffffffffff8p+1020L : 0x4p-16496L : inexact-ok underflow errno-erange-ok
-= exp2 downward ldbl-128ibm -0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 tonearest ldbl-128ibm -0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 towardzero ldbl-128ibm -0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
+= exp2 downward ldbl-128ibm -0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 tonearest ldbl-128ibm -0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 towardzero ldbl-128ibm -0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange
 = exp2 upward ldbl-128ibm -0xf.ffffffffffff8p+1020L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
-= exp2 downward ldbl-96-intel -0xf.fffffffffffffffp+16380L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 tonearest ldbl-96-intel -0xf.fffffffffffffffp+16380L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 towardzero ldbl-96-intel -0xf.fffffffffffffffp+16380L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
+= exp2 downward ldbl-96-intel -0xf.fffffffffffffffp+16380L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 tonearest ldbl-96-intel -0xf.fffffffffffffffp+16380L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 towardzero ldbl-96-intel -0xf.fffffffffffffffp+16380L : 0x0p+0L : inexact-ok underflow errno-erange
 = exp2 upward ldbl-96-intel -0xf.fffffffffffffffp+16380L : 0x8p-16448L : inexact-ok underflow errno-erange-ok
-= exp2 downward ldbl-96-m68k -0xf.fffffffffffffffp+16380L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 tonearest ldbl-96-m68k -0xf.fffffffffffffffp+16380L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 towardzero ldbl-96-m68k -0xf.fffffffffffffffp+16380L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
+= exp2 downward ldbl-96-m68k -0xf.fffffffffffffffp+16380L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 tonearest ldbl-96-m68k -0xf.fffffffffffffffp+16380L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 towardzero ldbl-96-m68k -0xf.fffffffffffffffp+16380L : 0x0p+0L : inexact-ok underflow errno-erange
 = exp2 upward ldbl-96-m68k -0xf.fffffffffffffffp+16380L : 0x4p-16448L : inexact-ok underflow errno-erange-ok
-= exp2 downward ldbl-128 -0xf.fffffffffffffffp+16380L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 tonearest ldbl-128 -0xf.fffffffffffffffp+16380L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 towardzero ldbl-128 -0xf.fffffffffffffffp+16380L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
+= exp2 downward ldbl-128 -0xf.fffffffffffffffp+16380L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 tonearest ldbl-128 -0xf.fffffffffffffffp+16380L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 towardzero ldbl-128 -0xf.fffffffffffffffp+16380L : 0x0p+0L : inexact-ok underflow errno-erange
 = exp2 upward ldbl-128 -0xf.fffffffffffffffp+16380L : 0x4p-16496L : inexact-ok underflow errno-erange-ok
-= exp2 downward ldbl-128 -0xf.fffffffffffffffffffffffffff8p+16380L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 tonearest ldbl-128 -0xf.fffffffffffffffffffffffffff8p+16380L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 towardzero ldbl-128 -0xf.fffffffffffffffffffffffffff8p+16380L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
+= exp2 downward ldbl-128 -0xf.fffffffffffffffffffffffffff8p+16380L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 tonearest ldbl-128 -0xf.fffffffffffffffffffffffffff8p+16380L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 towardzero ldbl-128 -0xf.fffffffffffffffffffffffffff8p+16380L : 0x0p+0L : inexact-ok underflow errno-erange
 = exp2 upward ldbl-128 -0xf.fffffffffffffffffffffffffff8p+16380L : 0x4p-16496L : inexact-ok underflow errno-erange-ok
-= exp2 downward ldbl-128 -0xf.ffffffffffffbffffffffffffcp+1020L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 tonearest ldbl-128 -0xf.ffffffffffffbffffffffffffcp+1020L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 towardzero ldbl-128 -0xf.ffffffffffffbffffffffffffcp+1020L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
+= exp2 downward ldbl-128 -0xf.ffffffffffffbffffffffffffcp+1020L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 tonearest ldbl-128 -0xf.ffffffffffffbffffffffffffcp+1020L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 towardzero ldbl-128 -0xf.ffffffffffffbffffffffffffcp+1020L : 0x0p+0L : inexact-ok underflow errno-erange
 = exp2 upward ldbl-128 -0xf.ffffffffffffbffffffffffffcp+1020L : 0x4p-16496L : inexact-ok underflow errno-erange-ok
-= exp2 downward ldbl-128ibm -0xf.ffffffffffffbffffffffffffcp+1020L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 tonearest ldbl-128ibm -0xf.ffffffffffffbffffffffffffcp+1020L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 towardzero ldbl-128ibm -0xf.ffffffffffffbffffffffffffcp+1020L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
+= exp2 downward ldbl-128ibm -0xf.ffffffffffffbffffffffffffcp+1020L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 tonearest ldbl-128ibm -0xf.ffffffffffffbffffffffffffcp+1020L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 towardzero ldbl-128ibm -0xf.ffffffffffffbffffffffffffcp+1020L : 0x0p+0L : inexact-ok underflow errno-erange
 = exp2 upward ldbl-128ibm -0xf.ffffffffffffbffffffffffffcp+1020L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
 exp2 0.75
 = exp2 downward flt-32 0xcp-4f : 0x1.ae89f8p+0f : inexact-ok
@@ -7038,10 +7038,10 @@ exp2 1023
 = exp2 tonearest ldbl-128ibm 0x3.ffp+8L : 0x8p+1020L : inexact-ok
 = exp2 towardzero ldbl-128ibm 0x3.ffp+8L : 0x8p+1020L : inexact-ok
 = exp2 upward ldbl-128ibm 0x3.ffp+8L : 0x8p+1020L : inexact-ok
-exp2 -1074 missing-errno
-= exp2 downward flt-32 -0x4.32p+8f : 0x0p+0f : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 tonearest flt-32 -0x4.32p+8f : 0x0p+0f : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 towardzero flt-32 -0x4.32p+8f : 0x0p+0f : inexact-ok underflow errno-erange errno-erange-ok
+exp2 -1074
+= exp2 downward flt-32 -0x4.32p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp2 tonearest flt-32 -0x4.32p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp2 towardzero flt-32 -0x4.32p+8f : 0x0p+0f : inexact-ok underflow errno-erange
 = exp2 upward flt-32 -0x4.32p+8f : 0x8p-152f : inexact-ok underflow errno-erange-ok
 = exp2 downward dbl-64 -0x4.32p+8 : 0x4p-1076 : inexact-ok underflow-ok errno-erange-ok
 = exp2 tonearest dbl-64 -0x4.32p+8 : 0x4p-1076 : inexact-ok underflow-ok errno-erange-ok
@@ -7088,14 +7088,14 @@ exp2 16383
 = exp2 tonearest ldbl-128ibm 0x3.fffp+12L : plus_infty : inexact-ok overflow errno-erange
 = exp2 towardzero ldbl-128ibm 0x3.fffp+12L : 0xf.ffffffffffffbffffffffffffcp+1020L : inexact-ok overflow errno-erange-ok
 = exp2 upward ldbl-128ibm 0x3.fffp+12L : plus_infty : inexact-ok overflow errno-erange
-exp2 -16400 missing-errno
-= exp2 downward flt-32 -0x4.01p+12f : 0x0p+0f : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 tonearest flt-32 -0x4.01p+12f : 0x0p+0f : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 towardzero flt-32 -0x4.01p+12f : 0x0p+0f : inexact-ok underflow errno-erange errno-erange-ok
+exp2 -16400
+= exp2 downward flt-32 -0x4.01p+12f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp2 tonearest flt-32 -0x4.01p+12f : 0x0p+0f : inexact-ok underflow errno-erange
+= exp2 towardzero flt-32 -0x4.01p+12f : 0x0p+0f : inexact-ok underflow errno-erange
 = exp2 upward flt-32 -0x4.01p+12f : 0x8p-152f : inexact-ok underflow errno-erange-ok
-= exp2 downward dbl-64 -0x4.01p+12 : 0x0p+0 : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 tonearest dbl-64 -0x4.01p+12 : 0x0p+0 : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 towardzero dbl-64 -0x4.01p+12 : 0x0p+0 : inexact-ok underflow errno-erange errno-erange-ok
+= exp2 downward dbl-64 -0x4.01p+12 : 0x0p+0 : inexact-ok underflow errno-erange
+= exp2 tonearest dbl-64 -0x4.01p+12 : 0x0p+0 : inexact-ok underflow errno-erange
+= exp2 towardzero dbl-64 -0x4.01p+12 : 0x0p+0 : inexact-ok underflow errno-erange
 = exp2 upward dbl-64 -0x4.01p+12 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
 = exp2 downward ldbl-96-intel -0x4.01p+12L : 0x1p-16400L : inexact-ok underflow-ok errno-erange-ok
 = exp2 tonearest ldbl-96-intel -0x4.01p+12L : 0x1p-16400L : inexact-ok underflow-ok errno-erange-ok
@@ -7109,9 +7109,9 @@ exp2 -16400 missing-errno
 = exp2 tonearest ldbl-128 -0x4.01p+12L : 0x1p-16400L : inexact-ok underflow-ok errno-erange-ok
 = exp2 towardzero ldbl-128 -0x4.01p+12L : 0x1p-16400L : inexact-ok underflow-ok errno-erange-ok
 = exp2 upward ldbl-128 -0x4.01p+12L : 0x1p-16400L : inexact-ok underflow-ok errno-erange-ok
-= exp2 downward ldbl-128ibm -0x4.01p+12L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 tonearest ldbl-128ibm -0x4.01p+12L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
-= exp2 towardzero ldbl-128ibm -0x4.01p+12L : 0x0p+0L : inexact-ok underflow errno-erange errno-erange-ok
+= exp2 downward ldbl-128ibm -0x4.01p+12L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 tonearest ldbl-128ibm -0x4.01p+12L : 0x0p+0L : inexact-ok underflow errno-erange
+= exp2 towardzero ldbl-128ibm -0x4.01p+12L : 0x0p+0L : inexact-ok underflow errno-erange
 = exp2 upward ldbl-128ibm -0x4.01p+12L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
 expm1 0
 = expm1 downward flt-32 0x0p+0f : 0x0p+0f : inexact-ok
diff --git a/math/w_exp2.c b/math/w_exp2.c
index b5d8e25702..02820be373 100644
--- a/math/w_exp2.c
+++ b/math/w_exp2.c
@@ -9,7 +9,7 @@ double
 __exp2 (double x)
 {
   double z = __ieee754_exp2 (x);
-  if (__builtin_expect (!__finite (z), 0)
+  if (__builtin_expect (!__finite (z) || z == 0, 0)
       && __finite (x) && _LIB_VERSION != _IEEE_)
     /* exp2 overflow: 44, exp2 underflow: 45 */
     return __kernel_standard (x, x, 44 + !!__signbit (x));
diff --git a/math/w_exp2f.c b/math/w_exp2f.c
index 7c277ef390..8430fd5702 100644
--- a/math/w_exp2f.c
+++ b/math/w_exp2f.c
@@ -9,7 +9,7 @@ float
 __exp2f (float x)
 {
   float z = __ieee754_exp2f (x);
-  if (__builtin_expect (!__finitef (z), 0)
+  if (__builtin_expect (!__finitef (z) || z == 0, 0)
       && __finitef (x) && _LIB_VERSION != _IEEE_)
     /* exp2 overflow: 144, exp2 underflow: 145 */
     return __kernel_standard_f (x, x, 144 + !!__signbitf (x));
diff --git a/math/w_exp2l.c b/math/w_exp2l.c
index 7f06805a0d..33861d584a 100644
--- a/math/w_exp2l.c
+++ b/math/w_exp2l.c
@@ -9,7 +9,7 @@ long double
 __exp2l (long double x)
 {
   long double z = __ieee754_exp2l (x);
-  if (__builtin_expect (!__finitel (z), 0)
+  if (__builtin_expect (!__finitel (z) || z == 0, 0)
       && __finitel (x) && _LIB_VERSION != _IEEE_)
     /* exp2 overflow: 244, exp2 underflow: 245 */
     return __kernel_standard_l (x, x, 244 + !!__signbitl (x));