This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Disable Bessel function TLOSS errors in POSIX mode
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: libc-alpha at sourceware dot org
- Date: Fri, 16 Mar 2012 16:31:55 +0000 (UTC)
- Subject: Disable Bessel function TLOSS errors in POSIX mode
No-one commented on my message
<http://sourceware.org/ml/libc-alpha/2012-02/msg00512.html> about TLOSS
errors from Bessel functions. Now that sincos is fixed for all
floating-point formats, it's possible to make changes for that issue and
add testcases in the normal way without the tests failing because of
sincos inaccuracy. I propose this patch which addresses those nine bugs
by disabling the TLOSS errors in POSIX mode (the default libm error
handling mode) the way they are disabled in IEEE mode (so they will still
occur in SVID and XOPEN modes).
Tested x86 and x86_64 and ulps updated accordingly.
2012-03-16 Joseph Myers <joseph@codesourcery.com>
[BZ #2551]
[BZ #2552]
[BZ #2553]
[BZ #2554]
[BZ #2562]
[BZ #2563]
[BZ #2565]
[BZ #2566]
[BZ #2576]
* math/w_j0.c (j0): Don't produce TLOSS errors for POSIX libm.
(y0): Likewise.
* math/w_j0f.c (j0f): Likewise.
(y0f): Likewise.
* math/w_j0l.c (__j0l): Likewise.
(__y0l): Likewise.
* math/w_j1.c (j1): Likewise.
(y1): Likewise.
* math/w_j1f.c (j1f): Likewise.
(y1f): Likewise.
* math/w_j1l.c (__j1l): Likewise.
(__y1l): Likewise.
* math/w_jn.c (jn): Likewise.
(yn): Likewise.
* math/w_jnf.c (jnf): Likewise.
(ynf): Likewise.
* math/w_jnl.c (__jnl): Likewise.
(__ynl): Likewise.
* math/libm-test.inc (j0_test): Add more tests.
(j1_test): Likewise.
(jn_test): Likewise. Add trailing semicolon to existing test.
(y0_test): Likewise.
(y1_test): Likewise.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
diff --git a/math/libm-test.inc b/math/libm-test.inc
index fb82926..97f227b 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -3686,6 +3686,12 @@ j0_test (void)
TEST_f_f (j0, 4.0, -3.9714980986384737228659076845169804197562E-1L);
TEST_f_f (j0, -4.0, -3.9714980986384737228659076845169804197562E-1L);
+ TEST_f_f (j0, 0x1.d7ce3ap+107L, 2.775523647291230802651040996274861694514e-17L);
+
+#ifndef TEST_FLOAT
+ TEST_f_f (j0, -0x1.001000001p+593L, -3.927269966354206207832593635798954916263e-90L);
+#endif
+
END (j0);
}
@@ -3721,6 +3727,12 @@ j1_test (void)
TEST_f_f (j1, 8.0, 0.234636346853914624381276651590454612L);
TEST_f_f (j1, 10.0, 0.0434727461688614366697487680258592883L);
+ TEST_f_f (j1, 0x1.3ffp+74L, 1.818984347516051243459364437186082741567e-12L);
+
+#ifndef TEST_FLOAT
+ TEST_f_f (j1, 0x1.ff00000000002p+840L, 1.846591691699331493194965158699937660696e-127L);
+#endif
+
END (j1);
}
@@ -3801,7 +3813,9 @@ jn_test (void)
TEST_ff_f (jn, 6, 2.4048255576957729L, 0.34048184720278336646673682895929161E-2L);
TEST_ff_f (jn, 7, 2.4048255576957729L, 0.60068836573295394221291569249883076E-3L);
TEST_ff_f (jn, 8, 2.4048255576957729L, 0.92165786705344923232879022467054148E-4L);
- TEST_ff_f (jn, 9, 2.4048255576957729L, 0.12517270977961513005428966643852564E-4L)
+ TEST_ff_f (jn, 9, 2.4048255576957729L, 0.12517270977961513005428966643852564E-4L);
+
+ TEST_ff_f (jn, 2, 0x1.ffff62p+99L, -4.43860668048170034334926693188979974489e-16L);
END (jn);
}
@@ -7147,6 +7161,12 @@ y0_test (void)
TEST_f_f (y0, 8.0, 0.223521489387566220527323400498620359L);
TEST_f_f (y0, 10.0, 0.0556711672835993914244598774101900481L);
+ TEST_f_f (y0, 0x1.3ffp+74L, 1.818984347516051243459467456433028748678e-12L);
+
+#ifndef TEST_FLOAT
+ TEST_f_f (y0, 0x1.ff00000000002p+840L, 1.846591691699331493194965158699937660696e-127L);
+#endif
+
END (y0);
}
@@ -7181,6 +7201,12 @@ y1_test (void)
TEST_f_f (y1, 8.0, -0.158060461731247494255555266187483550L);
TEST_f_f (y1, 10.0, 0.249015424206953883923283474663222803L);
+ TEST_f_f (y1, 0x1.27e204p+99L, -8.881610148467797208469612080785210013461e-16L);
+
+#ifndef TEST_FLOAT
+ TEST_f_f (y1, 0x1.001000001p+593L, 3.927269966354206207832593635798954916263e-90L);
+#endif
+
END (y1);
}
diff --git a/math/w_j0.c b/math/w_j0.c
index f8d3724..0171a0b 100644
--- a/math/w_j0.c
+++ b/math/w_j0.c
@@ -26,7 +26,7 @@ double
j0 (double x)
{
if (__builtin_expect (isgreater (fabs (x), X_TLOSS), 0)
- && _LIB_VERSION != _IEEE_)
+ && _LIB_VERSION != _IEEE_ && _LIB_VERSION != _POSIX_)
/* j0(|x|>X_TLOSS) */
return __kernel_standard (x, x, 34);
@@ -53,7 +53,7 @@ y0 (double x)
else if (x == 0.0)
/* d = -one/(x-x) */
return __kernel_standard (x, x, 8);
- else
+ else if (_LIB_VERSION != _POSIX_)
/* y0(x>X_TLOSS) */
return __kernel_standard (x, x, 35);
}
diff --git a/math/w_j0f.c b/math/w_j0f.c
index cef36aa..9e1681a 100644
--- a/math/w_j0f.c
+++ b/math/w_j0f.c
@@ -26,7 +26,7 @@ float
j0f (float x)
{
if (__builtin_expect (isgreater (fabsf (x), (float) X_TLOSS), 0)
- && _LIB_VERSION != _IEEE_)
+ && _LIB_VERSION != _IEEE_ && _LIB_VERSION != _POSIX_)
/* j0(|x|>X_TLOSS) */
return __kernel_standard_f (x, x, 134);
@@ -51,7 +51,7 @@ y0f (float x)
else if (x == 0.0f)
/* d = -one/(x-x) */
return __kernel_standard_f (x, x, 108);
- else
+ else if (_LIB_VERSION != _POSIX_)
/* y0(x>X_TLOSS) */
return __kernel_standard_f (x, x, 135);
}
diff --git a/math/w_j0l.c b/math/w_j0l.c
index 144f33c..54c9c89 100644
--- a/math/w_j0l.c
+++ b/math/w_j0l.c
@@ -26,7 +26,7 @@ long double
__j0l (long double x)
{
if (__builtin_expect (isgreater (fabsl (x), X_TLOSS), 0)
- && _LIB_VERSION != _IEEE_)
+ && _LIB_VERSION != _IEEE_ && _LIB_VERSION != _POSIX_)
/* j0(|x|>X_TLOSS) */
return __kernel_standard (x, x, 234);
@@ -51,7 +51,7 @@ __y0l (long double x)
else if (x == 0.0L)
/* d = -one/(x-x) */
return __kernel_standard (x, x, 208);
- else
+ else if (_LIB_VERSION != _POSIX_)
/* y0(x>X_TLOSS) */
return __kernel_standard (x, x, 235);
}
diff --git a/math/w_j1.c b/math/w_j1.c
index e9a5357..4060050 100644
--- a/math/w_j1.c
+++ b/math/w_j1.c
@@ -26,7 +26,7 @@ double
j1 (double x)
{
if (__builtin_expect (isgreater (fabs (x), X_TLOSS), 0)
- && _LIB_VERSION != _IEEE_)
+ && _LIB_VERSION != _IEEE_ && _LIB_VERSION != _POSIX_)
/* j1(|x|>X_TLOSS) */
return __kernel_standard (x, x, 36);
@@ -53,7 +53,7 @@ y1 (double x)
else if (x == 0.0)
/* d = -one/(x-x) */
return __kernel_standard (x, x, 10);
- else
+ else if (_LIB_VERSION != _POSIX_)
/* y1(x>X_TLOSS) */
return __kernel_standard (x, x, 37);
}
diff --git a/math/w_j1f.c b/math/w_j1f.c
index 29bd949..a3f5ee2 100644
--- a/math/w_j1f.c
+++ b/math/w_j1f.c
@@ -26,7 +26,7 @@ float
j1f (float x)
{
if (__builtin_expect (isgreater (fabsf (x), X_TLOSS), 0)
- && _LIB_VERSION != _IEEE_)
+ && _LIB_VERSION != _IEEE_ && _LIB_VERSION != _POSIX_)
/* j1(|x|>X_TLOSS) */
return __kernel_standard_f (x, x, 136);
@@ -51,7 +51,7 @@ y1f (float x)
else if (x == 0.0f)
/* d = -one/(x-x) */
return __kernel_standard_f (x, x, 110);
- else
+ else if (_LIB_VERSION != _POSIX_)
/* y1(x>X_TLOSS) */
return __kernel_standard_f (x, x, 137);
}
diff --git a/math/w_j1l.c b/math/w_j1l.c
index 01b8551..208377e 100644
--- a/math/w_j1l.c
+++ b/math/w_j1l.c
@@ -26,7 +26,7 @@ long double
__j1l (long double x)
{
if (__builtin_expect (isgreater (fabsl (x), X_TLOSS), 0)
- && _LIB_VERSION != _IEEE_)
+ && _LIB_VERSION != _IEEE_ && _LIB_VERSION != _POSIX_)
/* j1(|x|>X_TLOSS) */
return __kernel_standard (x, x, 236);
@@ -51,7 +51,7 @@ __y1l (long double x)
else if (x == 0.0L)
/* d = -one/(x-x) */
return __kernel_standard (x, x, 210);
- else
+ else if (_LIB_VERSION != _POSIX_)
/* y1(x>X_TLOSS) */
return __kernel_standard (x, x, 237);
}
diff --git a/math/w_jn.c b/math/w_jn.c
index fd3fb16..63658a9 100644
--- a/math/w_jn.c
+++ b/math/w_jn.c
@@ -26,7 +26,7 @@ double
jn (int n, double x)
{
if (__builtin_expect (isgreater (fabs (x), X_TLOSS), 0)
- && _LIB_VERSION != _IEEE_)
+ && _LIB_VERSION != _IEEE_ && _LIB_VERSION != _POSIX_)
/* jn(n,|x|>X_TLOSS) */
return __kernel_standard (n, x, 38);
@@ -53,7 +53,7 @@ yn (int n, double x)
else if (x == 0.0)
/* d = -one/(x-x) */
return __kernel_standard (n, x, 12);
- else
+ else if (_LIB_VERSION != _POSIX_)
/* yn(n,x>X_TLOSS) */
return __kernel_standard (n, x, 39);
}
diff --git a/math/w_jnf.c b/math/w_jnf.c
index 36d6f6d..41d9bc5 100644
--- a/math/w_jnf.c
+++ b/math/w_jnf.c
@@ -26,7 +26,7 @@ float
jnf (int n, float x)
{
if (__builtin_expect (isgreater (fabsf (x), (float) X_TLOSS), 0)
- && _LIB_VERSION != _IEEE_)
+ && _LIB_VERSION != _IEEE_ && _LIB_VERSION != _POSIX_)
/* jn(n,|x|>X_TLOSS) */
return __kernel_standard_f (n, x, 138);
@@ -51,7 +51,7 @@ ynf (int n, float x)
else if (x == 0.0)
/* d = -one/(x-x) */
return __kernel_standard_f (n, x, 112);
- else
+ else if (_LIB_VERSION != _POSIX_)
/* yn(n,x>X_TLOSS) */
return __kernel_standard_f (n, x, 139);
}
diff --git a/math/w_jnl.c b/math/w_jnl.c
index 148817f..2028d48 100644
--- a/math/w_jnl.c
+++ b/math/w_jnl.c
@@ -54,7 +54,10 @@ long double __jnl(int n, long double x) /* wrapper jnl */
#else
long double z;
z = __ieee754_jnl(n,x);
- if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z;
+ if (_LIB_VERSION == _IEEE_
+ || _LIB_VERSION == _POSIX_
+ || __isnanl(x))
+ return z;
if(fabsl(x)>X_TLOSS) {
return __kernel_standard((double)n,x,238); /* jn(|x|>X_TLOSS,n) */
} else
@@ -79,7 +82,7 @@ long double __ynl(int n, long double x) /* wrapper ynl */
/* d = zero/(x-x); */
return __kernel_standard((double)n,x,213);
}
- if(x>X_TLOSS) {
+ if(x>X_TLOSS && _LIB_VERSION != _POSIX_) {
return __kernel_standard((double)n,x,239); /* yn(x>X_TLOSS,n) */
} else
return z;
diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps
index 6f090e1..87120ef 100644
--- a/sysdeps/i386/fpu/libm-test-ulps
+++ b/sysdeps/i386/fpu/libm-test-ulps
@@ -1024,6 +1024,9 @@ Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271":
float: 1
# j0
+Test "j0 (-0x1.001000001p+593) == -3.927269966354206207832593635798954916263e-90":
+ildouble: 2
+ldouble: 2
Test "j0 (-4.0) == -3.9714980986384737228659076845169804197562E-1":
double: 1
float: 2
@@ -1031,6 +1034,9 @@ idouble: 1
ifloat: 2
ildouble: 2
ldouble: 2
+Test "j0 (0x1.d7ce3ap+107) == 2.775523647291230802651040996274861694514e-17":
+float: 1
+ifloat: 1
Test "j0 (10.0) == -0.245935764451348335197760862485328754":
double: 3
float: 1
@@ -1056,6 +1062,14 @@ ifloat: 1
Test "j1 (0.75) == 0.349243602174862192523281016426251335":
double: 1
idouble: 1
+Test "j1 (0x1.3ffp+74) == 1.818984347516051243459364437186082741567e-12":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "j1 (0x1.ff00000000002p+840) == 1.846591691699331493194965158699937660696e-127":
+double: 1
+idouble: 1
Test "j1 (10.0) == 0.0434727461688614366697487680258592883":
double: 2
float: 1
@@ -1158,6 +1172,11 @@ double: 2
idouble: 2
ildouble: 1
ldouble: 1
+Test "jn (2, 0x1.ffff62p+99) == -4.43860668048170034334926693188979974489e-16":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
Test "jn (2, 2.4048255576957729) == 0.43175480701968038399746111312430703":
double: 1
float: 1
@@ -1731,6 +1750,14 @@ double: 1
float: 1
idouble: 1
ifloat: 1
+Test "y0 (0x1.3ffp+74) == 1.818984347516051243459467456433028748678e-12":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "y0 (0x1.ff00000000002p+840) == 1.846591691699331493194965158699937660696e-127":
+double: 1
+idouble: 1
Test "y0 (1.0) == 0.0882569642156769579829267660235151628":
double: 2
float: 1
@@ -1762,6 +1789,16 @@ ldouble: 1
Test "y1 (0.125) == -5.19993611253477499595928744876579921":
ildouble: 1
ldouble: 1
+Test "y1 (0x1.001000001p+593) == 3.927269966354206207832593635798954916263e-90":
+ildouble: 2
+ldouble: 2
+Test "y1 (0x1.27e204p+99) == -8.881610148467797208469612080785210013461e-16":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
Test "y1 (1.0) == -0.781212821300288716547150000047964821":
double: 1
idouble: 1
@@ -2418,8 +2455,8 @@ double: 2
float: 2
idouble: 2
ifloat: 2
-ildouble: 1
-ldouble: 1
+ildouble: 2
+ldouble: 2
Function: "yn":
double: 2
diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
index 9a3fd6f..171d470 100644
--- a/sysdeps/x86_64/fpu/libm-test-ulps
+++ b/sysdeps/x86_64/fpu/libm-test-ulps
@@ -1073,6 +1073,9 @@ float: 1
ifloat: 1
# j0
+Test "j0 (-0x1.001000001p+593) == -3.927269966354206207832593635798954916263e-90":
+ildouble: 2
+ldouble: 2
Test "j0 (-4.0) == -3.9714980986384737228659076845169804197562E-1":
double: 1
float: 1
@@ -1083,6 +1086,9 @@ ldouble: 2
Test "j0 (0.75) == 0.864242275166648623555731103820923211":
float: 1
ifloat: 1
+Test "j0 (0x1.d7ce3ap+107) == 2.775523647291230802651040996274861694514e-17":
+float: 2
+ifloat: 2
Test "j0 (10.0) == -0.245935764451348335197760862485328754":
double: 2
float: 1
@@ -1105,6 +1111,14 @@ idouble: 2
ifloat: 1
# j1
+Test "j1 (0x1.3ffp+74) == 1.818984347516051243459364437186082741567e-12":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "j1 (0x1.ff00000000002p+840) == 1.846591691699331493194965158699937660696e-127":
+double: 1
+idouble: 1
Test "j1 (10.0) == 0.0434727461688614366697487680258592883":
float: 2
ifloat: 2
@@ -1195,6 +1209,13 @@ idouble: 1
ifloat: 4
ildouble: 1
ldouble: 1
+Test "jn (2, 0x1.ffff62p+99) == -4.43860668048170034334926693188979974489e-16":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 1
+ldouble: 1
Test "jn (2, 2.4048255576957729) == 0.43175480701968038399746111312430703":
double: 2
float: 1
@@ -1673,6 +1694,14 @@ ldouble: 1
Test "y0 (0.125) == -1.38968062514384052915582277745018693":
ildouble: 1
ldouble: 1
+Test "y0 (0x1.3ffp+74) == 1.818984347516051243459467456433028748678e-12":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "y0 (0x1.ff00000000002p+840) == 1.846591691699331493194965158699937660696e-127":
+double: 1
+idouble: 1
Test "y0 (1.0) == 0.0882569642156769579829267660235151628":
double: 2
float: 1
@@ -1704,6 +1733,14 @@ double: 1
idouble: 1
ildouble: 1
ldouble: 1
+Test "y1 (0x1.001000001p+593) == 3.927269966354206207832593635798954916263e-90":
+ildouble: 2
+ldouble: 2
+Test "y1 (0x1.27e204p+99) == -8.881610148467797208469612080785210013461e-16":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
Test "y1 (1.5) == -0.412308626973911295952829820633445323":
float: 1
ifloat: 1
@@ -2352,8 +2389,8 @@ double: 3
float: 2
idouble: 3
ifloat: 2
-ildouble: 1
-ldouble: 1
+ildouble: 2
+ldouble: 2
Function: "yn":
double: 3
--
Joseph S. Myers
joseph@codesourcery.com