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: Sun, 18 Nov 2012 15:54:47 +0000

> On Sun, 18 Nov 2012, David Miller wrote:
> 
>> From: David Miller <davem@davemloft.net>
>> Date: Sat, 17 Nov 2012 23:14:30 -0500 (EST)
>> 
>> > Thanks for all of your feedback Joseph, I think I have everything
>> > taken care of now.
>> > 
>> > If you're OK with this change I'll put together the ChangeLog as well
>> > as the ULP updates for i386, x86-64, and sparc.
>> 
>> Meanwhile I took care of all of those details and verified that
>> things pass properly on all 4 targets I tested, and here is the
>> result:
> 
> I think there should be tests for y1 for a range of small inputs, similar 
> to those for y0.  Given such tests with appropriate ulps updates, I don't 
> see any problems with this patch version.

Great, committed as follows.

Thanks a lot for all of your help, it would have taken me a week
without your guidance.

>From 05b227bdaea9a5f1faf08dad31221d8736f3659d Mon Sep 17 00:00:00 2001
From: "David S. Miller" <davem@davemloft.net>
Date: Sun, 18 Nov 2012 12:33:53 -0800
Subject: [PATCH] Correct tinyness handling in long-double and float y0/y1.

	With help from Joseph Myers.
	* sysdeps/ieee754/flt-32/e_j0f.c (__ieee754_y0f): Adjust tinyness
	cutoff to 2**-13.
	* sysdeps/ieee754/flt-32/e_j1f.c (__ieee754_y1f): Adjust tinyness
	cutoff to 2**-25.
	* sysdeps/ieee754/ldbl-128/e_j0l.c (U0): New constant.
	( __ieee754_y0l): Avoid arithmetic underflow when 'x' is very
	small.
	* sysdeps/ieee754/ldbl-128/e_j1l.c (__ieee754_y1l): Likewise.
	* math/libm-test.inc (y0_test): New tests.
	(y1_test): New tests.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Update.
	* sysdeps/sparc/fpu/libm-test-ulps: Update.
---
 ChangeLog                         | 17 ++++++++++++++
 math/libm-test.inc                | 24 ++++++++++++++++++++
 sysdeps/i386/fpu/libm-test-ulps   | 25 +++++++++++++++++++++
 sysdeps/ieee754/flt-32/e_j0f.c    |  2 +-
 sysdeps/ieee754/flt-32/e_j1f.c    |  2 +-
 sysdeps/ieee754/ldbl-128/e_j0l.c  |  3 +++
 sysdeps/ieee754/ldbl-128/e_j1l.c  |  2 ++
 sysdeps/sparc/fpu/libm-test-ulps  | 47 ++++++++++++++++++++++++++++++++++++++-
 sysdeps/x86_64/fpu/libm-test-ulps | 35 +++++++++++++++++++++++++++++
 9 files changed, 154 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index de3de3e..00fa045 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2012-11-18  David S. Miller  <davem@davemloft.net>
+
+	With help from Joseph Myers.
+	* sysdeps/ieee754/flt-32/e_j0f.c (__ieee754_y0f): Adjust tinyness
+	cutoff to 2**-13.
+	* sysdeps/ieee754/flt-32/e_j1f.c (__ieee754_y1f): Adjust tinyness
+	cutoff to 2**-25.
+	* sysdeps/ieee754/ldbl-128/e_j0l.c (U0): New constant.
+	( __ieee754_y0l): Avoid arithmetic underflow when 'x' is very
+	small.
+	* sysdeps/ieee754/ldbl-128/e_j1l.c (__ieee754_y1l): Likewise.
+	* math/libm-test.inc (y0_test): New tests.
+	(y1_test): New tests.
+	* sysdeps/i386/fpu/libm-test-ulps: Update.
+	* sysdeps/x86_64/fpu/libm-test-ulps: Update.
+	* sysdeps/sparc/fpu/libm-test-ulps: Update.
+
 2012-11-18  Andreas Schwab  <schwab@linux-m68k.org>
 
 	* configure.in (libc_cv_ld_gnu_indirect_function): Use .quad on
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 225a5e1..0b254e1 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -10198,6 +10198,18 @@ y0_test (void)
   TEST_f_f (y0, 0x1.ff00000000002p+840L, 1.846591691699331493194965158699937660696e-127L, UNDERFLOW_EXCEPTION_OK);
 #endif
 
+  TEST_f_f (y0, 0x1p-10L, -4.4865150767109739412411806297168793661098L);
+  TEST_f_f (y0, 0x1p-20L, -8.8992283012125827603076426611387876938160L);
+  TEST_f_f (y0, 0x1p-30L, -1.3311940304267782826037118027401817264906e+1L);
+  TEST_f_f (y0, 0x1p-40L, -1.7724652307320814696990854700366226762563e+1L);
+  TEST_f_f (y0, 0x1p-50L, -2.2137364310373846564919987139743760738155e+1L);
+  TEST_f_f (y0, 0x1p-60L, -2.6550076313426878432849115782108205929120e+1L);
+  TEST_f_f (y0, 0x1p-70L, -3.0962788316479910300778244424468159753887e+1L);
+  TEST_f_f (y0, 0x1p-80L, -3.5375500319532942168707373066828113573541e+1L);
+  TEST_f_f (y0, 0x1p-90L, -3.9788212322585974036636501709188067393195e+1L);
+  TEST_f_f (y0, 0x1p-100L, -4.420092432563900590456563035154802121284e+1L);
+  TEST_f_f (y0, 0x1p-110L, -4.861363632869203777249475899390797503250e+1L);
+
   END (y0);
 }
 
@@ -10241,6 +10253,18 @@ y1_test (void)
   TEST_f_f (y1, 0x1.001000001p+593L, 3.927269966354206207832593635798954916263e-90L, UNDERFLOW_EXCEPTION_OK);
 #endif
 
+  TEST_f_f (y1, 0x1p-10L, -6.5190099301063115047395187618929589514382e+02L);
+  TEST_f_f (y1, 0x1p-20L, -6.6754421443450423911167962313100637952285e+05L);
+  TEST_f_f (y1, 0x1p-30L, -6.8356527557643159612937462812258975438856e+08L);
+  TEST_f_f (y1, 0x1p-40L, -6.9997084219026594793707805777425993547887e+11L);
+  TEST_f_f (y1, 0x1p-50L, -7.1677014240283233068755952926181262431559e+14L);
+  TEST_f_f (y1, 0x1p-60L, -7.3397262582050030662406095795388448059822e+17L);
+  TEST_f_f (y1, 0x1p-70L, -7.5158796884019231398303842094477769620063e+20L);
+  TEST_f_f (y1, 0x1p-80L, -7.6962608009235692951863134304745236090943e+23L);
+  TEST_f_f (y1, 0x1p-90L, -7.8809710601457349582707849528059121757126e+26L);
+  TEST_f_f (y1, 0x1p-100L, -8.0701143655892325972692837916732540679297e+29L);
+  TEST_f_f (y1, 0x1p-110L, -8.2637971103633741796037466026734121655600e+32L);
+
   END (y1);
 }
 
diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps
index 239da44..8da973a 100644
--- a/sysdeps/i386/fpu/libm-test-ulps
+++ b/sysdeps/i386/fpu/libm-test-ulps
@@ -3015,6 +3015,28 @@ ldouble: 1
 Test "y0 (0x1.ff00000000002p+840) == 1.846591691699331493194965158699937660696e-127":
 double: 1
 idouble: 1
+Test "y0 (0x1p-10) == -4.4865150767109739412411806297168793661098":
+ildouble: 1
+ldouble: 1
+Test "y0 (0x1p-30) == -1.3311940304267782826037118027401817264906e+1":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "y0 (0x1p-40) == -1.7724652307320814696990854700366226762563e+1":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "y0 (0x1p-60) == -2.6550076313426878432849115782108205929120e+1":
+double: 1
+idouble: 1
+Test "y0 (0x1p-70) == -3.0962788316479910300778244424468159753887e+1":
+double: 1
+idouble: 1
+Test "y0 (0x1p-80) == -3.5375500319532942168707373066828113573541e+1":
+double: 1
+idouble: 1
 Test "y0 (1.0) == 0.0882569642156769579829267660235151628":
 double: 2
 float: 1
@@ -3056,6 +3078,9 @@ idouble: 1
 ifloat: 2
 ildouble: 1
 ldouble: 1
+Test "y1 (0x1p-10) == -6.5190099301063115047395187618929589514382e+02":
+float: 1
+ifloat: 1
 Test "y1 (1.0) == -0.781212821300288716547150000047964821":
 double: 1
 idouble: 1
diff --git a/sysdeps/ieee754/flt-32/e_j0f.c b/sysdeps/ieee754/flt-32/e_j0f.c
index 0729cd0..c4cabd5 100644
--- a/sysdeps/ieee754/flt-32/e_j0f.c
+++ b/sysdeps/ieee754/flt-32/e_j0f.c
@@ -138,7 +138,7 @@ __ieee754_y0f(float x)
 		}
 		return z;
 	}
-	if(ix<=0x32000000) {	/* x < 2**-27 */
+	if(ix<=0x39800000) {	/* x < 2**-13 */
 	    return(u00 + tpi*__ieee754_logf(x));
 	}
 	z = x*x;
diff --git a/sysdeps/ieee754/flt-32/e_j1f.c b/sysdeps/ieee754/flt-32/e_j1f.c
index 30b7d8e..cb9f97f 100644
--- a/sysdeps/ieee754/flt-32/e_j1f.c
+++ b/sysdeps/ieee754/flt-32/e_j1f.c
@@ -133,7 +133,7 @@ __ieee754_y1f(float x)
 		}
 		return z;
 	}
-	if(__builtin_expect(ix<=0x24800000, 0)) {    /* x < 2**-54 */
+	if(__builtin_expect(ix<=0x33000000, 0)) {    /* x < 2**-25 */
 	    return(-tpi/x);
 	}
 	z = x*x;
diff --git a/sysdeps/ieee754/ldbl-128/e_j0l.c b/sysdeps/ieee754/ldbl-128/e_j0l.c
index 112a8f3..1b18289 100644
--- a/sysdeps/ieee754/ldbl-128/e_j0l.c
+++ b/sysdeps/ieee754/ldbl-128/e_j0l.c
@@ -809,6 +809,7 @@ static long double Y0_2D[NY0_2D + 1] = {
  /* 1.000000000000000000000000000000000000000E0 */
 };
 
+static const long double U0 = -7.3804295108687225274343927948483016310862e-02L;
 
 /* Bessel function of the second kind, order zero.  */
 
@@ -831,6 +832,8 @@ long double
       return -HUGE_VALL + x;
     }
   xx = fabsl (x);
+  if (xx <= 0x1p-57)
+    return U0 + 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..f16343b 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 <= 0x1p-114)
+    return -TWOOPI / x;
   if (xx <= 2.0L)
     {
       /* 0 <= x <= 2 */
diff --git a/sysdeps/sparc/fpu/libm-test-ulps b/sysdeps/sparc/fpu/libm-test-ulps
index 0f8179f..ec0ad66 100644
--- a/sysdeps/sparc/fpu/libm-test-ulps
+++ b/sysdeps/sparc/fpu/libm-test-ulps
@@ -1328,8 +1328,8 @@ Test "Imaginary part of: clog10 (0xf2p-10 + 0x3e3p-10 i) == 2.692124017335111295
 double: 1
 idouble: 1
 Test "Imaginary part of: clog10 (0xfd95243681c055c2632286921092p-113 + 0x1bccabcd29ca2152860ec29e34ef7p-113 i) == 2.8774482675253468630312378575186855052697e-66 + 0.4571561610046221605554903008571429975493 i":
-ldouble: 2
 ildouble: 2
+ldouble: 2
 Test "Imaginary part of: clog10 (0xfe961079616p-45 + 0x1bc37e09e6d1p-45 i) == 2.3329549194675052736016290082882121135546e-26 + 0.4561756099441139182878993697611751382976 i":
 double: 1
 idouble: 1
@@ -2861,6 +2861,43 @@ double: 1
 idouble: 1
 ildouble: 1
 ldouble: 1
+Test "y0 (0x1p-10) == -4.4865150767109739412411806297168793661098":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "y0 (0x1p-110) == -4.861363632869203777249475899390797503250e+1":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "y0 (0x1p-20) == -8.8992283012125827603076426611387876938160":
+float: 1
+ifloat: 1
+Test "y0 (0x1p-30) == -1.3311940304267782826037118027401817264906e+1":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "y0 (0x1p-40) == -1.7724652307320814696990854700366226762563e+1":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "y0 (0x1p-50) == -2.2137364310373846564919987139743760738155e+1":
+float: 1
+ifloat: 1
+Test "y0 (0x1p-60) == -2.6550076313426878432849115782108205929120e+1":
+ildouble: 1
+ldouble: 1
+Test "y0 (0x1p-70) == -3.0962788316479910300778244424468159753887e+1":
+double: 1
+idouble: 1
+Test "y0 (0x1p-80) == -3.5375500319532942168707373066828113573541e+1":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
 Test "y0 (1.0) == 0.0882569642156769579829267660235151628":
 double: 2
 float: 1
@@ -2897,6 +2934,14 @@ ldouble: 1
 Test "y1 (0x1.27e204p+99) == -8.881610148467797208469612080785210013461e-16":
 double: 1
 idouble: 1
+Test "y1 (0x1p-10) == -6.5190099301063115047395187618929589514382e+02":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "y1 (0x1p-30) == -6.8356527557643159612937462812258975438856e+08":
+ildouble: 1
+ldouble: 1
 Test "y1 (1.5) == -0.412308626973911295952829820633445323":
 float: 1
 ifloat: 1
diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
index 9c5157f..4767be9 100644
--- a/sysdeps/x86_64/fpu/libm-test-ulps
+++ b/sysdeps/x86_64/fpu/libm-test-ulps
@@ -2796,6 +2796,38 @@ ldouble: 1
 Test "y0 (0x1.ff00000000002p+840) == 1.846591691699331493194965158699937660696e-127":
 double: 1
 idouble: 1
+Test "y0 (0x1p-10) == -4.4865150767109739412411806297168793661098":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "y0 (0x1p-110) == -4.861363632869203777249475899390797503250e+1":
+double: 1
+idouble: 1
+Test "y0 (0x1p-20) == -8.8992283012125827603076426611387876938160":
+float: 1
+ifloat: 1
+Test "y0 (0x1p-30) == -1.3311940304267782826037118027401817264906e+1":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "y0 (0x1p-40) == -1.7724652307320814696990854700366226762563e+1":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "y0 (0x1p-50) == -2.2137364310373846564919987139743760738155e+1":
+float: 1
+ifloat: 1
+Test "y0 (0x1p-70) == -3.0962788316479910300778244424468159753887e+1":
+double: 1
+idouble: 1
+Test "y0 (0x1p-80) == -3.5375500319532942168707373066828113573541e+1":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
 Test "y0 (1.0) == 0.0882569642156769579829267660235151628":
 double: 2
 float: 1
@@ -2837,6 +2869,9 @@ idouble: 1
 ifloat: 1
 ildouble: 1
 ldouble: 1
+Test "y1 (0x1p-10) == -6.5190099301063115047395187618929589514382e+02":
+double: 1
+idouble: 1
 Test "y1 (1.5) == -0.412308626973911295952829820633445323":
 float: 1
 ifloat: 1
-- 
1.7.12.2.dirty


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