about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndreas Krebbel <krebbel@linux.vnet.ibm.com>2014-01-15 09:50:31 +0100
committerAndreas Krebbel <krebbel@linux.vnet.ibm.com>2014-01-15 09:50:31 +0100
commit7beb48cbb77ef32135a07b429838521a0c181377 (patch)
treee545e9c4f79024dee0da455c0cbf25d33c1d135d
parentc20d5bf50991d6c4e396f27612ad379214120c48 (diff)
downloadglibc-7beb48cbb77ef32135a07b429838521a0c181377.tar.gz
glibc-7beb48cbb77ef32135a07b429838521a0c181377.tar.xz
glibc-7beb48cbb77ef32135a07b429838521a0c181377.zip
[BZ #16427] Fix ldbl-128 exp overflows.
Invoke the non-IEEE handling only for numbers special also in the IEEE
case.  This aligns the exp handling with the other ldbl variants.
-rw-r--r--ChangeLog6
-rw-r--r--sysdeps/ieee754/ldbl-128/w_expl.c18
2 files changed, 11 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 4eab51195c..d455e16ee1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2014-01-15  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
 
+	[BZ #16427]
+	* sysdeps/ieee754/ldbl-128/w_expl.c (__expl): Invoke the non-IEEE
+	handling only for numbers special also in the IEEE case.
+
+2014-01-15  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
+
 	* sysdeps/s390/fpu/libm-test-ulps: Regenerate.
 
 2014-01-11  Allan McRae  <allan@archlinux.org>
diff --git a/sysdeps/ieee754/ldbl-128/w_expl.c b/sysdeps/ieee754/ldbl-128/w_expl.c
index 10193befa9..f0b1f8e55f 100644
--- a/sysdeps/ieee754/ldbl-128/w_expl.c
+++ b/sysdeps/ieee754/ldbl-128/w_expl.c
@@ -25,24 +25,16 @@ static char rcsid[] = "$NetBSD: $";
 #include <math.h>
 #include <math_private.h>
 
-static const long double
-o_threshold= 1.1356523406294143949491931077970763428449E4L,
-u_threshold= -1.1433462743336297878837243843452621503410E4;
-
 long double __expl(long double x)	/* wrapper exp */
 {
 #ifdef _IEEE_LIBM
 	return __ieee754_expl(x);
 #else
-	long double z;
-	z = __ieee754_expl(x);
-	if(_LIB_VERSION == _IEEE_) return z;
-	if(__finitel(x)) {
-	    if(x>o_threshold)
-	        return __kernel_standard_l(x,x,206); /* exp overflow */
-	    else if(x<u_threshold)
-	        return __kernel_standard_l(x,x,207); /* exp underflow */
-	}
+	long double z = __ieee754_expl (x);
+	if (__glibc_unlikely (!__finitel (z) || z == 0)
+	    && __finitel (x) && _LIB_VERSION != _IEEE_)
+	  return __kernel_standard_l (x, x, 206 + !!__signbitl (x));
+
 	return z;
 #endif
 }