summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog22
-rw-r--r--NEWS2
-rw-r--r--math/auto-libm-test-in9
-rw-r--r--math/auto-libm-test-out200
-rw-r--r--sysdeps/i386/fpu/s_log1p.S27
-rw-r--r--sysdeps/i386/fpu/s_log1pf.S27
-rw-r--r--sysdeps/ieee754/dbl-64/s_log1p.c10
-rw-r--r--sysdeps/ieee754/flt-32/s_log1pf.c8
-rw-r--r--sysdeps/ieee754/ldbl-128/s_log1pl.c6
9 files changed, 202 insertions, 109 deletions
diff --git a/ChangeLog b/ChangeLog
index 3f3a5b14e7..f6bf877b16 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2015-05-14  Joseph Myers  <joseph@codesourcery.com>
+
+	[BZ #16339]
+	* sysdeps/i386/fpu/s_log1p.S (dbl_min): New object.
+	(__log1p): Force underflow exception for results with small
+	absolute value.
+	* sysdeps/i386/fpu/s_log1pf.S (flt_min): New object.
+	(__log1pf): Force underflow exception for results with small
+	absolute value.
+	* sysdeps/ieee754/dbl-64/s_log1p.c: Include <float.h>.
+	(__log1p): Force underflow exception for results with small
+	absolute value.
+	* sysdeps/ieee754/flt-32/s_log1pf.c: Include <float.h>.
+	(__log1pf): Force underflow exception for results with small
+	absolute value.
+	* sysdeps/ieee754/ldbl-128/s_log1pl.c: Include <float.h>.
+	(__log1pl): Force underflow exception for results with small
+	absolute value.
+	* math/auto-libm-test-in: Do not allow missing underflow
+	exceptions from log1p.
+	* math/auto-libm-test-out: Regenerated.
+
 2015-05-14  Jakub Bogusz  <qboosh@pld-linux.org>
 	    Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
diff --git a/NEWS b/NEWS
index 91027bd83b..a9b0138b3e 100644
--- a/NEWS
+++ b/NEWS
@@ -9,7 +9,7 @@ Version 2.22
 
 * The following bugs are resolved with this release:
 
-  4719, 6792, 13064, 14094, 14841, 14906, 15319, 15467, 15790, 15969,
+  4719, 6792, 13064, 14094, 14841, 14906, 15319, 15467, 15790, 15969, 16339,
   16351, 16512, 16560, 16783, 16850, 17090, 17195, 17269, 17523, 17542,
   17569, 17588, 17596, 17620, 17621, 17628, 17631, 17692, 17711, 17715,
   17776, 17779, 17792, 17836, 17912, 17916, 17930, 17932, 17944, 17949,
diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in
index 883397c40a..7e5c7bb254 100644
--- a/math/auto-libm-test-in
+++ b/math/auto-libm-test-in
@@ -1850,11 +1850,10 @@ log1p -0
 log1p e-1
 log1p -0.25
 log1p -0.875
-# Bug 16339: underflow exception may be missing.
-log1p min missing-underflow
-log1p min_subnorm missing-underflow
-log1p -min missing-underflow
-log1p -min_subnorm missing-underflow
+log1p min
+log1p min_subnorm
+log1p -min
+log1p -min_subnorm
 log1p 0x1p10
 log1p 0x1p20
 log1p 0x1p30
diff --git a/math/auto-libm-test-out b/math/auto-libm-test-out
index 0d7fac54d6..7c8a3fb8ff 100644
--- a/math/auto-libm-test-out
+++ b/math/auto-libm-test-out
@@ -143235,7 +143235,7 @@ log1p -0.875
 = log1p tonearest ldbl-128ibm -0xep-4L : -0x2.145647e7756e6d035dab1ac80cp+0L : inexact-ok
 = log1p towardzero ldbl-128ibm -0xep-4L : -0x2.145647e7756e6d035dab1ac80bp+0L : inexact-ok
 = log1p upward ldbl-128ibm -0xep-4L : -0x2.145647e7756e6d035dab1ac80bp+0L : inexact-ok
-log1p min missing-underflow
+log1p min
 = log1p downward flt-32 0x4p-128f : 0x3.fffff8p-128f : inexact-ok underflow-ok errno-erange-ok
 = log1p tonearest flt-32 0x4p-128f : 0x4p-128f : inexact-ok underflow-ok errno-erange-ok
 = log1p towardzero flt-32 0x4p-128f : 0x3.fffff8p-128f : inexact-ok underflow-ok errno-erange-ok
@@ -143276,10 +143276,10 @@ log1p min missing-underflow
 = log1p tonearest ldbl-128 0x4p-1024L : 0x4p-1024L : inexact-ok
 = log1p towardzero ldbl-128 0x4p-1024L : 0x3.fffffffffffffffffffffffffffep-1024L : inexact-ok
 = log1p upward ldbl-128 0x4p-1024L : 0x4p-1024L : inexact-ok
-= log1p downward ldbl-128ibm 0x4p-1024L : 0x3.ffffffffffffcp-1024L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p tonearest ldbl-128ibm 0x4p-1024L : 0x4p-1024L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p towardzero ldbl-128ibm 0x4p-1024L : 0x3.ffffffffffffcp-1024L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p upward ldbl-128ibm 0x4p-1024L : 0x4p-1024L : inexact-ok underflow underflow-ok errno-erange-ok
+= log1p downward ldbl-128ibm 0x4p-1024L : 0x3.ffffffffffffcp-1024L : inexact-ok underflow errno-erange-ok
+= log1p tonearest ldbl-128ibm 0x4p-1024L : 0x4p-1024L : inexact-ok underflow errno-erange-ok
+= log1p towardzero ldbl-128ibm 0x4p-1024L : 0x3.ffffffffffffcp-1024L : inexact-ok underflow errno-erange-ok
+= log1p upward ldbl-128ibm 0x4p-1024L : 0x4p-1024L : inexact-ok underflow errno-erange-ok
 = log1p downward ldbl-96-intel 0x4p-16384L : 0x3.fffffffffffffff8p-16384L : inexact-ok underflow-ok errno-erange-ok
 = log1p tonearest ldbl-96-intel 0x4p-16384L : 0x4p-16384L : inexact-ok underflow-ok errno-erange-ok
 = log1p towardzero ldbl-96-intel 0x4p-16384L : 0x3.fffffffffffffff8p-16384L : inexact-ok underflow-ok errno-erange-ok
@@ -143292,18 +143292,18 @@ log1p min missing-underflow
 = log1p tonearest ldbl-128 0x4p-16384L : 0x4p-16384L : inexact-ok underflow-ok errno-erange-ok
 = log1p towardzero ldbl-128 0x4p-16384L : 0x3.fffffffffffffffffffffffffffcp-16384L : inexact-ok underflow-ok errno-erange-ok
 = log1p upward ldbl-128 0x4p-16384L : 0x4p-16384L : inexact-ok underflow-ok errno-erange-ok
-= log1p downward ldbl-96-intel 0x2p-16384L : 0x1.fffffffffffffff8p-16384L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p tonearest ldbl-96-intel 0x2p-16384L : 0x2p-16384L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p towardzero ldbl-96-intel 0x2p-16384L : 0x1.fffffffffffffff8p-16384L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p upward ldbl-96-intel 0x2p-16384L : 0x2p-16384L : inexact-ok underflow underflow-ok errno-erange-ok
+= log1p downward ldbl-96-intel 0x2p-16384L : 0x1.fffffffffffffff8p-16384L : inexact-ok underflow errno-erange-ok
+= log1p tonearest ldbl-96-intel 0x2p-16384L : 0x2p-16384L : inexact-ok underflow errno-erange-ok
+= log1p towardzero ldbl-96-intel 0x2p-16384L : 0x1.fffffffffffffff8p-16384L : inexact-ok underflow errno-erange-ok
+= log1p upward ldbl-96-intel 0x2p-16384L : 0x2p-16384L : inexact-ok underflow errno-erange-ok
 = log1p downward ldbl-96-m68k 0x2p-16384L : 0x1.fffffffffffffffcp-16384L : inexact-ok underflow-ok errno-erange-ok
 = log1p tonearest ldbl-96-m68k 0x2p-16384L : 0x2p-16384L : inexact-ok underflow-ok errno-erange-ok
 = log1p towardzero ldbl-96-m68k 0x2p-16384L : 0x1.fffffffffffffffcp-16384L : inexact-ok underflow-ok errno-erange-ok
 = log1p upward ldbl-96-m68k 0x2p-16384L : 0x2p-16384L : inexact-ok underflow-ok errno-erange-ok
-= log1p downward ldbl-128 0x2p-16384L : 0x1.fffffffffffffffffffffffffffcp-16384L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p tonearest ldbl-128 0x2p-16384L : 0x2p-16384L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p towardzero ldbl-128 0x2p-16384L : 0x1.fffffffffffffffffffffffffffcp-16384L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p upward ldbl-128 0x2p-16384L : 0x2p-16384L : inexact-ok underflow underflow-ok errno-erange-ok
+= log1p downward ldbl-128 0x2p-16384L : 0x1.fffffffffffffffffffffffffffcp-16384L : inexact-ok underflow errno-erange-ok
+= log1p tonearest ldbl-128 0x2p-16384L : 0x2p-16384L : inexact-ok underflow errno-erange-ok
+= log1p towardzero ldbl-128 0x2p-16384L : 0x1.fffffffffffffffffffffffffffcp-16384L : inexact-ok underflow errno-erange-ok
+= log1p upward ldbl-128 0x2p-16384L : 0x2p-16384L : inexact-ok underflow errno-erange-ok
 = log1p downward dbl-64 0x8p-972 : 0x7.ffffffffffffcp-972 : inexact-ok
 = log1p tonearest dbl-64 0x8p-972 : 0x8p-972 : inexact-ok
 = log1p towardzero dbl-64 0x8p-972 : 0x7.ffffffffffffcp-972 : inexact-ok
@@ -143324,11 +143324,11 @@ log1p min missing-underflow
 = log1p tonearest ldbl-128ibm 0x8p-972L : 0x8p-972L : inexact-ok underflow-ok errno-erange-ok
 = log1p towardzero ldbl-128ibm 0x8p-972L : 0x7.fffffffffffffffffffffffffcp-972L : inexact-ok underflow-ok errno-erange-ok
 = log1p upward ldbl-128ibm 0x8p-972L : 0x8p-972L : inexact-ok underflow-ok errno-erange-ok
-log1p min_subnorm missing-underflow
-= log1p downward flt-32 0x8p-152f : 0x0p+0f : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p tonearest flt-32 0x8p-152f : 0x8p-152f : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p towardzero flt-32 0x8p-152f : 0x0p+0f : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p upward flt-32 0x8p-152f : 0x8p-152f : inexact-ok underflow underflow-ok errno-erange-ok
+log1p min_subnorm
+= log1p downward flt-32 0x8p-152f : 0x0p+0f : inexact-ok underflow errno-erange-ok
+= log1p tonearest flt-32 0x8p-152f : 0x8p-152f : inexact-ok underflow errno-erange-ok
+= log1p towardzero flt-32 0x8p-152f : 0x0p+0f : inexact-ok underflow errno-erange-ok
+= log1p upward flt-32 0x8p-152f : 0x8p-152f : inexact-ok underflow errno-erange-ok
 = log1p downward dbl-64 0x8p-152 : 0x7.ffffffffffffcp-152 : inexact-ok
 = log1p tonearest dbl-64 0x8p-152 : 0x8p-152 : inexact-ok
 = log1p towardzero dbl-64 0x8p-152 : 0x7.ffffffffffffcp-152 : inexact-ok
@@ -143349,10 +143349,10 @@ log1p min_subnorm missing-underflow
 = log1p tonearest ldbl-128ibm 0x8p-152L : 0x8p-152L : inexact-ok
 = log1p towardzero ldbl-128ibm 0x8p-152L : 0x7.fffffffffffffffffffffffffep-152L : inexact-ok
 = log1p upward ldbl-128ibm 0x8p-152L : 0x8p-152L : inexact-ok
-= log1p downward dbl-64 0x4p-1076 : 0x0p+0 : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p tonearest dbl-64 0x4p-1076 : 0x4p-1076 : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p towardzero dbl-64 0x4p-1076 : 0x0p+0 : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p upward dbl-64 0x4p-1076 : 0x4p-1076 : inexact-ok underflow underflow-ok errno-erange-ok
+= log1p downward dbl-64 0x4p-1076 : 0x0p+0 : inexact-ok underflow errno-erange-ok
+= log1p tonearest dbl-64 0x4p-1076 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
+= log1p towardzero dbl-64 0x4p-1076 : 0x0p+0 : inexact-ok underflow errno-erange-ok
+= log1p upward dbl-64 0x4p-1076 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
 = log1p downward ldbl-96-intel 0x4p-1076L : 0x3.fffffffffffffffcp-1076L : inexact-ok
 = log1p tonearest ldbl-96-intel 0x4p-1076L : 0x4p-1076L : inexact-ok
 = log1p towardzero ldbl-96-intel 0x4p-1076L : 0x3.fffffffffffffffcp-1076L : inexact-ok
@@ -143365,35 +143365,35 @@ log1p min_subnorm missing-underflow
 = log1p tonearest ldbl-128 0x4p-1076L : 0x4p-1076L : inexact-ok
 = log1p towardzero ldbl-128 0x4p-1076L : 0x3.fffffffffffffffffffffffffffep-1076L : inexact-ok
 = log1p upward ldbl-128 0x4p-1076L : 0x4p-1076L : inexact-ok
-= log1p downward ldbl-128ibm 0x4p-1076L : 0x0p+0L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p tonearest ldbl-128ibm 0x4p-1076L : 0x4p-1076L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p towardzero ldbl-128ibm 0x4p-1076L : 0x0p+0L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p upward ldbl-128ibm 0x4p-1076L : 0x4p-1076L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p downward ldbl-96-intel 0x8p-16448L : 0x0p+0L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p tonearest ldbl-96-intel 0x8p-16448L : 0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p towardzero ldbl-96-intel 0x8p-16448L : 0x0p+0L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p upward ldbl-96-intel 0x8p-16448L : 0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p downward ldbl-96-m68k 0x8p-16448L : 0x4p-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p tonearest ldbl-96-m68k 0x8p-16448L : 0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p towardzero ldbl-96-m68k 0x8p-16448L : 0x4p-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p upward ldbl-96-m68k 0x8p-16448L : 0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p downward ldbl-128 0x8p-16448L : 0x7.fffffffffffcp-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p tonearest ldbl-128 0x8p-16448L : 0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p towardzero ldbl-128 0x8p-16448L : 0x7.fffffffffffcp-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p upward ldbl-128 0x8p-16448L : 0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p downward ldbl-96-m68k 0x4p-16448L : 0x0p+0L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p tonearest ldbl-96-m68k 0x4p-16448L : 0x4p-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p towardzero ldbl-96-m68k 0x4p-16448L : 0x0p+0L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p upward ldbl-96-m68k 0x4p-16448L : 0x4p-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p downward ldbl-128 0x4p-16448L : 0x3.fffffffffffcp-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p tonearest ldbl-128 0x4p-16448L : 0x4p-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p towardzero ldbl-128 0x4p-16448L : 0x3.fffffffffffcp-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p upward ldbl-128 0x4p-16448L : 0x4p-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p downward ldbl-128 0x4p-16496L : 0x0p+0L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p tonearest ldbl-128 0x4p-16496L : 0x4p-16496L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p towardzero ldbl-128 0x4p-16496L : 0x0p+0L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p upward ldbl-128 0x4p-16496L : 0x4p-16496L : inexact-ok underflow underflow-ok errno-erange-ok
-log1p -min missing-underflow
+= log1p downward ldbl-128ibm 0x4p-1076L : 0x0p+0L : inexact-ok underflow errno-erange-ok
+= log1p tonearest ldbl-128ibm 0x4p-1076L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+= log1p towardzero ldbl-128ibm 0x4p-1076L : 0x0p+0L : inexact-ok underflow errno-erange-ok
+= log1p upward ldbl-128ibm 0x4p-1076L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+= log1p downward ldbl-96-intel 0x8p-16448L : 0x0p+0L : inexact-ok underflow errno-erange-ok
+= log1p tonearest ldbl-96-intel 0x8p-16448L : 0x8p-16448L : inexact-ok underflow errno-erange-ok
+= log1p towardzero ldbl-96-intel 0x8p-16448L : 0x0p+0L : inexact-ok underflow errno-erange-ok
+= log1p upward ldbl-96-intel 0x8p-16448L : 0x8p-16448L : inexact-ok underflow errno-erange-ok
+= log1p downward ldbl-96-m68k 0x8p-16448L : 0x4p-16448L : inexact-ok underflow errno-erange-ok
+= log1p tonearest ldbl-96-m68k 0x8p-16448L : 0x8p-16448L : inexact-ok underflow errno-erange-ok
+= log1p towardzero ldbl-96-m68k 0x8p-16448L : 0x4p-16448L : inexact-ok underflow errno-erange-ok
+= log1p upward ldbl-96-m68k 0x8p-16448L : 0x8p-16448L : inexact-ok underflow errno-erange-ok
+= log1p downward ldbl-128 0x8p-16448L : 0x7.fffffffffffcp-16448L : inexact-ok underflow errno-erange-ok
+= log1p tonearest ldbl-128 0x8p-16448L : 0x8p-16448L : inexact-ok underflow errno-erange-ok
+= log1p towardzero ldbl-128 0x8p-16448L : 0x7.fffffffffffcp-16448L : inexact-ok underflow errno-erange-ok
+= log1p upward ldbl-128 0x8p-16448L : 0x8p-16448L : inexact-ok underflow errno-erange-ok
+= log1p downward ldbl-96-m68k 0x4p-16448L : 0x0p+0L : inexact-ok underflow errno-erange-ok
+= log1p tonearest ldbl-96-m68k 0x4p-16448L : 0x4p-16448L : inexact-ok underflow errno-erange-ok
+= log1p towardzero ldbl-96-m68k 0x4p-16448L : 0x0p+0L : inexact-ok underflow errno-erange-ok
+= log1p upward ldbl-96-m68k 0x4p-16448L : 0x4p-16448L : inexact-ok underflow errno-erange-ok
+= log1p downward ldbl-128 0x4p-16448L : 0x3.fffffffffffcp-16448L : inexact-ok underflow errno-erange-ok
+= log1p tonearest ldbl-128 0x4p-16448L : 0x4p-16448L : inexact-ok underflow errno-erange-ok
+= log1p towardzero ldbl-128 0x4p-16448L : 0x3.fffffffffffcp-16448L : inexact-ok underflow errno-erange-ok
+= log1p upward ldbl-128 0x4p-16448L : 0x4p-16448L : inexact-ok underflow errno-erange-ok
+= log1p downward ldbl-128 0x4p-16496L : 0x0p+0L : inexact-ok underflow errno-erange-ok
+= log1p tonearest ldbl-128 0x4p-16496L : 0x4p-16496L : inexact-ok underflow errno-erange-ok
+= log1p towardzero ldbl-128 0x4p-16496L : 0x0p+0L : inexact-ok underflow errno-erange-ok
+= log1p upward ldbl-128 0x4p-16496L : 0x4p-16496L : inexact-ok underflow errno-erange-ok
+log1p -min
 = log1p downward flt-32 -0x4p-128f : -0x4.000008p-128f : inexact-ok underflow-ok errno-erange-ok
 = log1p tonearest flt-32 -0x4p-128f : -0x4p-128f : inexact-ok underflow-ok errno-erange-ok
 = log1p towardzero flt-32 -0x4p-128f : -0x4p-128f : inexact-ok underflow-ok errno-erange-ok
@@ -143434,10 +143434,10 @@ log1p -min missing-underflow
 = log1p tonearest ldbl-128 -0x4p-1024L : -0x4p-1024L : inexact-ok
 = log1p towardzero ldbl-128 -0x4p-1024L : -0x4p-1024L : inexact-ok
 = log1p upward ldbl-128 -0x4p-1024L : -0x4p-1024L : inexact-ok
-= log1p downward ldbl-128ibm -0x4p-1024L : -0x4.0000000000004p-1024L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p tonearest ldbl-128ibm -0x4p-1024L : -0x4p-1024L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p towardzero ldbl-128ibm -0x4p-1024L : -0x4p-1024L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p upward ldbl-128ibm -0x4p-1024L : -0x4p-1024L : inexact-ok underflow underflow-ok errno-erange-ok
+= log1p downward ldbl-128ibm -0x4p-1024L : -0x4.0000000000004p-1024L : inexact-ok underflow errno-erange-ok
+= log1p tonearest ldbl-128ibm -0x4p-1024L : -0x4p-1024L : inexact-ok underflow errno-erange-ok
+= log1p towardzero ldbl-128ibm -0x4p-1024L : -0x4p-1024L : inexact-ok underflow errno-erange-ok
+= log1p upward ldbl-128ibm -0x4p-1024L : -0x4p-1024L : inexact-ok underflow errno-erange-ok
 = log1p downward ldbl-96-intel -0x4p-16384L : -0x4.0000000000000008p-16384L : inexact-ok underflow-ok errno-erange-ok
 = log1p tonearest ldbl-96-intel -0x4p-16384L : -0x4p-16384L : inexact-ok underflow-ok errno-erange-ok
 = log1p towardzero ldbl-96-intel -0x4p-16384L : -0x4p-16384L : inexact-ok underflow-ok errno-erange-ok
@@ -143450,18 +143450,18 @@ log1p -min missing-underflow
 = log1p tonearest ldbl-128 -0x4p-16384L : -0x4p-16384L : inexact-ok underflow-ok errno-erange-ok
 = log1p towardzero ldbl-128 -0x4p-16384L : -0x4p-16384L : inexact-ok underflow-ok errno-erange-ok
 = log1p upward ldbl-128 -0x4p-16384L : -0x4p-16384L : inexact-ok underflow-ok errno-erange-ok
-= log1p downward ldbl-96-intel -0x2p-16384L : -0x2.0000000000000008p-16384L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p tonearest ldbl-96-intel -0x2p-16384L : -0x2p-16384L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p towardzero ldbl-96-intel -0x2p-16384L : -0x2p-16384L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p upward ldbl-96-intel -0x2p-16384L : -0x2p-16384L : inexact-ok underflow underflow-ok errno-erange-ok
+= log1p downward ldbl-96-intel -0x2p-16384L : -0x2.0000000000000008p-16384L : inexact-ok underflow errno-erange-ok
+= log1p tonearest ldbl-96-intel -0x2p-16384L : -0x2p-16384L : inexact-ok underflow errno-erange-ok
+= log1p towardzero ldbl-96-intel -0x2p-16384L : -0x2p-16384L : inexact-ok underflow errno-erange-ok
+= log1p upward ldbl-96-intel -0x2p-16384L : -0x2p-16384L : inexact-ok underflow errno-erange-ok
 = log1p downward ldbl-96-m68k -0x2p-16384L : -0x2.0000000000000004p-16384L : inexact-ok underflow-ok errno-erange-ok
 = log1p tonearest ldbl-96-m68k -0x2p-16384L : -0x2p-16384L : inexact-ok underflow-ok errno-erange-ok
 = log1p towardzero ldbl-96-m68k -0x2p-16384L : -0x2p-16384L : inexact-ok underflow-ok errno-erange-ok
 = log1p upward ldbl-96-m68k -0x2p-16384L : -0x2p-16384L : inexact-ok underflow-ok errno-erange-ok
-= log1p downward ldbl-128 -0x2p-16384L : -0x2.0000000000000000000000000004p-16384L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p tonearest ldbl-128 -0x2p-16384L : -0x2p-16384L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p towardzero ldbl-128 -0x2p-16384L : -0x2p-16384L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p upward ldbl-128 -0x2p-16384L : -0x2p-16384L : inexact-ok underflow underflow-ok errno-erange-ok
+= log1p downward ldbl-128 -0x2p-16384L : -0x2.0000000000000000000000000004p-16384L : inexact-ok underflow errno-erange-ok
+= log1p tonearest ldbl-128 -0x2p-16384L : -0x2p-16384L : inexact-ok underflow errno-erange-ok
+= log1p towardzero ldbl-128 -0x2p-16384L : -0x2p-16384L : inexact-ok underflow errno-erange-ok
+= log1p upward ldbl-128 -0x2p-16384L : -0x2p-16384L : inexact-ok underflow errno-erange-ok
 = log1p downward dbl-64 -0x8p-972 : -0x8.0000000000008p-972 : inexact-ok
 = log1p tonearest dbl-64 -0x8p-972 : -0x8p-972 : inexact-ok
 = log1p towardzero dbl-64 -0x8p-972 : -0x8p-972 : inexact-ok
@@ -143482,11 +143482,11 @@ log1p -min missing-underflow
 = log1p tonearest ldbl-128ibm -0x8p-972L : -0x8p-972L : inexact-ok underflow-ok errno-erange-ok
 = log1p towardzero ldbl-128ibm -0x8p-972L : -0x8p-972L : inexact-ok underflow-ok errno-erange-ok
 = log1p upward ldbl-128ibm -0x8p-972L : -0x8p-972L : inexact-ok underflow-ok errno-erange-ok
-log1p -min_subnorm missing-underflow
-= log1p downward flt-32 -0x8p-152f : -0x1p-148f : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p tonearest flt-32 -0x8p-152f : -0x8p-152f : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p towardzero flt-32 -0x8p-152f : -0x8p-152f : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p upward flt-32 -0x8p-152f : -0x8p-152f : inexact-ok underflow underflow-ok errno-erange-ok
+log1p -min_subnorm
+= log1p downward flt-32 -0x8p-152f : -0x1p-148f : inexact-ok underflow errno-erange-ok
+= log1p tonearest flt-32 -0x8p-152f : -0x8p-152f : inexact-ok underflow errno-erange-ok
+= log1p towardzero flt-32 -0x8p-152f : -0x8p-152f : inexact-ok underflow errno-erange-ok
+= log1p upward flt-32 -0x8p-152f : -0x8p-152f : inexact-ok underflow errno-erange-ok
 = log1p downward dbl-64 -0x8p-152 : -0x8.0000000000008p-152 : inexact-ok
 = log1p tonearest dbl-64 -0x8p-152 : -0x8p-152 : inexact-ok
 = log1p towardzero dbl-64 -0x8p-152 : -0x8p-152 : inexact-ok
@@ -143507,10 +143507,10 @@ log1p -min_subnorm missing-underflow
 = log1p tonearest ldbl-128ibm -0x8p-152L : -0x8p-152L : inexact-ok
 = log1p towardzero ldbl-128ibm -0x8p-152L : -0x8p-152L : inexact-ok
 = log1p upward ldbl-128ibm -0x8p-152L : -0x8p-152L : inexact-ok
-= log1p downward dbl-64 -0x4p-1076 : -0x8p-1076 : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p tonearest dbl-64 -0x4p-1076 : -0x4p-1076 : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p towardzero dbl-64 -0x4p-1076 : -0x4p-1076 : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p upward dbl-64 -0x4p-1076 : -0x4p-1076 : inexact-ok underflow underflow-ok errno-erange-ok
+= log1p downward dbl-64 -0x4p-1076 : -0x8p-1076 : inexact-ok underflow errno-erange-ok
+= log1p tonearest dbl-64 -0x4p-1076 : -0x4p-1076 : inexact-ok underflow errno-erange-ok
+= log1p towardzero dbl-64 -0x4p-1076 : -0x4p-1076 : inexact-ok underflow errno-erange-ok
+= log1p upward dbl-64 -0x4p-1076 : -0x4p-1076 : inexact-ok underflow errno-erange-ok
 = log1p downward ldbl-96-intel -0x4p-1076L : -0x4.0000000000000008p-1076L : inexact-ok
 = log1p tonearest ldbl-96-intel -0x4p-1076L : -0x4p-1076L : inexact-ok
 = log1p towardzero ldbl-96-intel -0x4p-1076L : -0x4p-1076L : inexact-ok
@@ -143523,34 +143523,34 @@ log1p -min_subnorm missing-underflow
 = log1p tonearest ldbl-128 -0x4p-1076L : -0x4p-1076L : inexact-ok
 = log1p towardzero ldbl-128 -0x4p-1076L : -0x4p-1076L : inexact-ok
 = log1p upward ldbl-128 -0x4p-1076L : -0x4p-1076L : inexact-ok
-= log1p downward ldbl-128ibm -0x4p-1076L : -0x8p-1076L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p tonearest ldbl-128ibm -0x4p-1076L : -0x4p-1076L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p towardzero ldbl-128ibm -0x4p-1076L : -0x4p-1076L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p upward ldbl-128ibm -0x4p-1076L : -0x4p-1076L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p downward ldbl-96-intel -0x8p-16448L : -0x1p-16444L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p tonearest ldbl-96-intel -0x8p-16448L : -0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p towardzero ldbl-96-intel -0x8p-16448L : -0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p upward ldbl-96-intel -0x8p-16448L : -0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p downward ldbl-96-m68k -0x8p-16448L : -0xcp-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p tonearest ldbl-96-m68k -0x8p-16448L : -0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p towardzero ldbl-96-m68k -0x8p-16448L : -0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p upward ldbl-96-m68k -0x8p-16448L : -0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p downward ldbl-128 -0x8p-16448L : -0x8.000000000004p-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p tonearest ldbl-128 -0x8p-16448L : -0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p towardzero ldbl-128 -0x8p-16448L : -0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p upward ldbl-128 -0x8p-16448L : -0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p downward ldbl-96-m68k -0x4p-16448L : -0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p tonearest ldbl-96-m68k -0x4p-16448L : -0x4p-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p towardzero ldbl-96-m68k -0x4p-16448L : -0x4p-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p upward ldbl-96-m68k -0x4p-16448L : -0x4p-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p downward ldbl-128 -0x4p-16448L : -0x4.000000000004p-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p tonearest ldbl-128 -0x4p-16448L : -0x4p-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p towardzero ldbl-128 -0x4p-16448L : -0x4p-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p upward ldbl-128 -0x4p-16448L : -0x4p-16448L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p downward ldbl-128 -0x4p-16496L : -0x8p-16496L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p tonearest ldbl-128 -0x4p-16496L : -0x4p-16496L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p towardzero ldbl-128 -0x4p-16496L : -0x4p-16496L : inexact-ok underflow underflow-ok errno-erange-ok
-= log1p upward ldbl-128 -0x4p-16496L : -0x4p-16496L : inexact-ok underflow underflow-ok errno-erange-ok
+= log1p downward ldbl-128ibm -0x4p-1076L : -0x8p-1076L : inexact-ok underflow errno-erange-ok
+= log1p tonearest ldbl-128ibm -0x4p-1076L : -0x4p-1076L : inexact-ok underflow errno-erange-ok
+= log1p towardzero ldbl-128ibm -0x4p-1076L : -0x4p-1076L : inexact-ok underflow errno-erange-ok
+= log1p upward ldbl-128ibm -0x4p-1076L : -0x4p-1076L : inexact-ok underflow errno-erange-ok
+= log1p downward ldbl-96-intel -0x8p-16448L : -0x1p-16444L : inexact-ok underflow errno-erange-ok
+= log1p tonearest ldbl-96-intel -0x8p-16448L : -0x8p-16448L : inexact-ok underflow errno-erange-ok
+= log1p towardzero ldbl-96-intel -0x8p-16448L : -0x8p-16448L : inexact-ok underflow errno-erange-ok
+= log1p upward ldbl-96-intel -0x8p-16448L : -0x8p-16448L : inexact-ok underflow errno-erange-ok
+= log1p downward ldbl-96-m68k -0x8p-16448L : -0xcp-16448L : inexact-ok underflow errno-erange-ok
+= log1p tonearest ldbl-96-m68k -0x8p-16448L : -0x8p-16448L : inexact-ok underflow errno-erange-ok
+= log1p towardzero ldbl-96-m68k -0x8p-16448L : -0x8p-16448L : inexact-ok underflow errno-erange-ok
+= log1p upward ldbl-96-m68k -0x8p-16448L : -0x8p-16448L : inexact-ok underflow errno-erange-ok
+= log1p downward ldbl-128 -0x8p-16448L : -0x8.000000000004p-16448L : inexact-ok underflow errno-erange-ok
+= log1p tonearest ldbl-128 -0x8p-16448L : -0x8p-16448L : inexact-ok underflow errno-erange-ok
+= log1p towardzero ldbl-128 -0x8p-16448L : -0x8p-16448L : inexact-ok underflow errno-erange-ok
+= log1p upward ldbl-128 -0x8p-16448L : -0x8p-16448L : inexact-ok underflow errno-erange-ok
+= log1p downward ldbl-96-m68k -0x4p-16448L : -0x8p-16448L : inexact-ok underflow errno-erange-ok
+= log1p tonearest ldbl-96-m68k -0x4p-16448L : -0x4p-16448L : inexact-ok underflow errno-erange-ok
+= log1p towardzero ldbl-96-m68k -0x4p-16448L : -0x4p-16448L : inexact-ok underflow errno-erange-ok
+= log1p upward ldbl-96-m68k -0x4p-16448L : -0x4p-16448L : inexact-ok underflow errno-erange-ok
+= log1p downward ldbl-128 -0x4p-16448L : -0x4.000000000004p-16448L : inexact-ok underflow errno-erange-ok
+= log1p tonearest ldbl-128 -0x4p-16448L : -0x4p-16448L : inexact-ok underflow errno-erange-ok
+= log1p towardzero ldbl-128 -0x4p-16448L : -0x4p-16448L : inexact-ok underflow errno-erange-ok
+= log1p upward ldbl-128 -0x4p-16448L : -0x4p-16448L : inexact-ok underflow errno-erange-ok
+= log1p downward ldbl-128 -0x4p-16496L : -0x8p-16496L : inexact-ok underflow errno-erange-ok
+= log1p tonearest ldbl-128 -0x4p-16496L : -0x4p-16496L : inexact-ok underflow errno-erange-ok
+= log1p towardzero ldbl-128 -0x4p-16496L : -0x4p-16496L : inexact-ok underflow errno-erange-ok
+= log1p upward ldbl-128 -0x4p-16496L : -0x4p-16496L : inexact-ok underflow errno-erange-ok
 log1p 0x1p10
 = log1p downward flt-32 0x4p+8f : 0x6.eeb4ep+0f : inexact-ok
 = log1p tonearest flt-32 0x4p+8f : 0x6.eeb4e8p+0f : inexact-ok
diff --git a/sysdeps/i386/fpu/s_log1p.S b/sysdeps/i386/fpu/s_log1p.S
index 8624249dba..c2559a3f18 100644
--- a/sysdeps/i386/fpu/s_log1p.S
+++ b/sysdeps/i386/fpu/s_log1p.S
@@ -17,6 +17,13 @@ RCSID("$NetBSD: s_log1p.S,v 1.7 1995/05/09 00:10:58 jtc Exp $")
 limit:	.double 0.29
 one:	.double 1.0
 
+	.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)
+
 /*
  * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29,
  * otherwise fyl2x with the needed extra computation.
@@ -55,7 +62,25 @@ ENTRY(__log1p)
 	ret
 
 2:	fyl2xp1
-	ret
+#ifdef PIC
+	fldl	dbl_min@GOTOFF(%edx)
+#else
+	fldl	dbl_min
+#endif
+	fld	%st(1)
+	fabs
+	fucompp
+	fnstsw
+	sahf
+	jnc	1f
+	subl	$8, %esp
+	cfi_adjust_cfa_offset (8)
+	fld	%st(0)
+	fmul	%st(0)
+	fstpl	(%esp)
+	addl	$8, %esp
+	cfi_adjust_cfa_offset (-8)
+1:	ret
 
 3:	jp	4b		// in case x is ħInf
 	fstp	%st(1)
diff --git a/sysdeps/i386/fpu/s_log1pf.S b/sysdeps/i386/fpu/s_log1pf.S
index b071e7372d..8fca22e4ff 100644
--- a/sysdeps/i386/fpu/s_log1pf.S
+++ b/sysdeps/i386/fpu/s_log1pf.S
@@ -17,6 +17,13 @@ RCSID("$NetBSD: s_log1pf.S,v 1.4 1995/05/09 00:13:05 jtc Exp $")
 limit:	.float 0.29
 one:	.float 1.0
 
+	.section .rodata.cst4,"aM",@progbits,4
+
+	.p2align 2
+	.type flt_min,@object
+flt_min:	.byte 0, 0, 0x80, 0
+	ASM_SIZE_DIRECTIVE(flt_min)
+
 /*
  * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29,
  * otherwise fyl2x with the needed extra computation.
@@ -55,7 +62,25 @@ ENTRY(__log1pf)
 	ret
 
 2:	fyl2xp1
-	ret
+#ifdef PIC
+	flds	flt_min@GOTOFF(%edx)
+#else
+	flds	flt_min
+#endif
+	fld	%st(1)
+	fabs
+	fucompp
+	fnstsw
+	sahf
+	jnc	1f
+	subl	$4, %esp
+	cfi_adjust_cfa_offset (4)
+	fld	%st(0)
+	fmul	%st(0)
+	fstps	(%esp)
+	addl	$4, %esp
+	cfi_adjust_cfa_offset (-4)
+1:	ret
 
 3:	jp	4b		// in case x is ħInf
 	fstp	%st(1)
diff --git a/sysdeps/ieee754/dbl-64/s_log1p.c b/sysdeps/ieee754/dbl-64/s_log1p.c
index 86bbfbacaf..cff555b0aa 100644
--- a/sysdeps/ieee754/dbl-64/s_log1p.c
+++ b/sysdeps/ieee754/dbl-64/s_log1p.c
@@ -78,6 +78,7 @@
  *	 See HP-15C Advanced Functions Handbook, p.193.
  */
 
+#include <float.h>
 #include <math.h>
 #include <math_private.h>
 
@@ -118,7 +119,14 @@ __log1p (double x)
 	{
 	  math_force_eval (two54 + x);          /* raise inexact */
 	  if (ax < 0x3c900000)                  /* |x| < 2**-54 */
-	    return x;
+	    {
+	      if (fabs (x) < DBL_MIN)
+		{
+		  double force_underflow = x * x;
+		  math_force_eval (force_underflow);
+		}
+	      return x;
+	    }
 	  else
 	    return x - x * x * 0.5;
 	}
diff --git a/sysdeps/ieee754/flt-32/s_log1pf.c b/sysdeps/ieee754/flt-32/s_log1pf.c
index 94c33fca16..83a09f1414 100644
--- a/sysdeps/ieee754/flt-32/s_log1pf.c
+++ b/sysdeps/ieee754/flt-32/s_log1pf.c
@@ -13,6 +13,7 @@
  * ====================================================
  */
 
+#include <float.h>
 #include <math.h>
 #include <math_private.h>
 
@@ -48,7 +49,14 @@ __log1pf(float x)
 	    if(ax<0x31000000) {			/* |x| < 2**-29 */
 		math_force_eval(two25+x);	/* raise inexact */
 		if (ax<0x24800000)		/* |x| < 2**-54 */
+		  {
+		    if (fabsf (x) < FLT_MIN)
+		      {
+			float force_underflow = x * x;
+			math_force_eval (force_underflow);
+		      }
 		    return x;
+		  }
 		else
 		    return x - x*x*(float)0.5;
 	    }
diff --git a/sysdeps/ieee754/ldbl-128/s_log1pl.c b/sysdeps/ieee754/ldbl-128/s_log1pl.c
index b70a55b758..ff759bc000 100644
--- a/sysdeps/ieee754/ldbl-128/s_log1pl.c
+++ b/sysdeps/ieee754/ldbl-128/s_log1pl.c
@@ -53,6 +53,7 @@
     <http://www.gnu.org/licenses/>.  */
 
 
+#include <float.h>
 #include <math.h>
 #include <math_private.h>
 
@@ -140,6 +141,11 @@ __log1pl (long double xm1)
 
   if ((hx & 0x7fffffff) < 0x3f8e0000)
     {
+      if (fabsl (xm1) < LDBL_MIN)
+	{
+	  long double force_underflow = xm1 * xm1;
+	  math_force_eval (force_underflow);
+	}
       if ((int) xm1 == 0)
 	return xm1;
     }