This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2.19] BZ16427: Fix ldbl-128 exp overflows


On Tue, Jan 14, 2014 at 02:54:01PM +0530, Siddhesh Poyarekar wrote:
> On Tue, Jan 14, 2014 at 09:29:48AM +0100, Andreas Krebbel wrote:
> > 2014-01-14  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.
> > 
> > commit 1e74b6daed6c95628a4710f64d140880457c9c44
> > Author: Andreas Krebbel <krebbel@linux.vnet.ibm.com>
> > Date:   Mon Jan 13 14:41:47 2014 +0000
> > 
> >     S/390: Fix ldbl-128 exp overflows.
> 
> Please put in a more descriptive commit message and mention the bz# in
> the subject line of the message so that the post-hook adds a comment
> to the bug report.

Ok.

commit 028ccea8771a99e12c3aa7ba8fae6699a89890ea
Author: Andreas Krebbel <krebbel@linux.vnet.ibm.com>
Date:   Mon Jan 13 14:41:47 2014 +0000

    [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.

diff --git a/sysdeps/ieee754/ldbl-128/w_expl.c b/sysdeps/ieee754/ldbl-128/w_expl.c
index 10193be..f0b1f8e 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
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]