about summary refs log tree commit diff
path: root/sysdeps/ieee754
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754')
-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
3 files changed, 23 insertions, 1 deletions
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;
     }