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] Update sparc ULPs.


From: "Joseph S. Myers" <joseph@codesourcery.com>
Date: Fri, 16 Nov 2012 17:40:10 +0000

> Those indicate that ldbl-128 needs a fix for bug 14811 (probably similar 
> to those for other versions, i.e. saturating small exponents to +/- 
> 0x1p-128, but each version of pow is substantially different from the 
> others).

The following patch seems to do the trick, does it look OK to you?

2012-11-16  David S. Miller  <davem@davemloft.net>

	[BZ #14811]
	* sysdeps/ieee754/ldbl-128/e_powl.c (__ieee754_powl): Saturate
	nonzero exponents with absolute value below 0x1p-128 to +/-
	0x1p-128.

diff --git a/sysdeps/ieee754/ldbl-128/e_powl.c b/sysdeps/ieee754/ldbl-128/e_powl.c
index 40fc314..d131750 100644
--- a/sysdeps/ieee754/ldbl-128/e_powl.c
+++ b/sysdeps/ieee754/ldbl-128/e_powl.c
@@ -149,7 +149,7 @@ __ieee754_powl (long double x, long double y)
 {
   long double z, ax, z_h, z_l, p_h, p_l;
   long double y1, t1, t2, r, s, t, u, v, w;
-  long double s2, s_h, s_l, t_h, t_l;
+  long double s2, s_h, s_l, t_h, t_l, ay;
   int32_t i, j, k, yisint, n;
   u_int32_t ix, iy;
   int32_t hx, hy;
@@ -282,6 +282,10 @@ __ieee754_powl (long double x, long double y)
 	return (hy > 0) ? huge * huge : tiny * tiny;
     }
 
+  ay = y > 0 ? y : -y;
+  if (ay < 0x1p-128)
+    y = y < 0 ? -0x1p-128 : 0x1p-128;
+
   n = 0;
   /* take care subnormal number */
   if (ix < 0x00010000)


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