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

> On Fri, 16 Nov 2012, David Miller wrote:
> 
>> Failure: yn (10, min_value) == -inf: Exception "Underflow" set
>> Failure: yn (10, min_value) == -inf: Exception "Underflow" set

These two failures are indirectly caused by y0l/y1l, specifically
they lack the handling of extremely small values that the flt-32
and dbl-64 variants have.

So the code falls down into the multiply "X * X" and that's where we
get the underflow.

This should fix the same failures on powerpc too, since the
ldbl-128ibm files just include this code.

Any objections?

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

	* sysdeps/ieee754/ldbl-128/e_j0l.c ( __ieee754_y0l): Avoid
	arithmetic underflow when absolute 'x' is very small.
	* sysdeps/ieee754/ldbl-128/e_j1l.c (___ieee754_y1l): Likewise.

diff --git a/sysdeps/ieee754/ldbl-128/e_j0l.c b/sysdeps/ieee754/ldbl-128/e_j0l.c
index 112a8f3..7ee4731 100644
--- a/sysdeps/ieee754/ldbl-128/e_j0l.c
+++ b/sysdeps/ieee754/ldbl-128/e_j0l.c
@@ -831,6 +831,8 @@ long double
       return -HUGE_VALL + x;
     }
   xx = fabsl (x);
+  if (xx < 0x2p-27)
+    return TWOOPI * __ieee754_logl (x);
   if (xx <= 2.0L)
     {
       /* 0 <= x <= 2 */
diff --git a/sysdeps/ieee754/ldbl-128/e_j1l.c b/sysdeps/ieee754/ldbl-128/e_j1l.c
index 1f62bd0..4b10e97 100644
--- a/sysdeps/ieee754/ldbl-128/e_j1l.c
+++ b/sysdeps/ieee754/ldbl-128/e_j1l.c
@@ -838,6 +838,8 @@ __ieee754_y1l (long double x)
       return -HUGE_VALL + x;
     }
   xx = fabsl (x);
+  if (xx < 0x2p-54)
+    return -TWOOPI / x;
   if (xx <= 2.0L)
     {
       /* 0 <= x <= 2 */


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