This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Fix ldbl-128ibm powl spurious underflows
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: <libc-alpha at sourceware dot org>
- Date: Wed, 21 Nov 2012 22:59:51 +0000
- Subject: Fix ldbl-128ibm powl spurious underflows
This patch fixes spurious underflow exceptions from ldbl-128ibm powl
in a similar way to other floating-point formats. As with existing
practice in this and other ldbl-128ibm functions, it doesn't attempt
to do anything special regarding the peculiarities of IBM long double
(where values very close to 1 can be represented with discontiguous
mantissa).
Tested that this eliminates the underflow exceptions on powerpc.
2012-11-21 Joseph Myers <joseph@codesourcery.com>
[BZ #14811]
* sysdeps/ieee754/ldbl-128ibm/e_powl.c (__ieee754_powl): Saturate
nonzero exponents with absolute value below 0x1p-117 to +/-
0x1p-117.
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_powl.c b/sysdeps/ieee754/ldbl-128ibm/e_powl.c
index 0fd4820..8216c49 100644
--- a/sysdeps/ieee754/ldbl-128ibm/e_powl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/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;
@@ -284,6 +284,10 @@ __ieee754_powl (long double x, long double y)
return (hy > 0) ? huge * huge : tiny * tiny;
}
+ ay = y > 0 ? y : -y;
+ if (ay < 0x1p-117)
+ y = y < 0 ? -0x1p-117 : 0x1p-117;
+
n = 0;
/* take care subnormal number */
if (ix < 0x00100000)
--
Joseph S. Myers
joseph@codesourcery.com