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.
This commit is contained in:
David S. Miller 2012-11-18 12:33:53 -08:00
parent 786b0b67a3
commit 05b227bdae
9 changed files with 154 additions and 3 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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 */

View File

@ -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 */

View File

@ -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

View File

@ -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