From c36e1d2369f149a64c759f3ad6f4cc5a03b03b62 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Fri, 16 Mar 2012 20:08:02 +0000 Subject: [PATCH] Disable Bessel function TLOSS errors in POSIX mode. --- ChangeLog | 35 ++++++++++++++++++++++++++ NEWS | 15 +++++------ math/libm-test.inc | 28 ++++++++++++++++++++- math/w_j0.c | 4 +-- math/w_j0f.c | 4 +-- math/w_j0l.c | 4 +-- math/w_j1.c | 4 +-- math/w_j1f.c | 4 +-- math/w_j1l.c | 4 +-- math/w_jn.c | 4 +-- math/w_jnf.c | 4 +-- math/w_jnl.c | 7 ++++-- sysdeps/i386/fpu/libm-test-ulps | 41 +++++++++++++++++++++++++++++-- sysdeps/x86_64/fpu/libm-test-ulps | 41 +++++++++++++++++++++++++++++-- 14 files changed, 169 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index 91b04a2587..0392cdc7f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,40 @@ 2012-03-16 Joseph Myers + [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. + [BZ #13851] [BZ #13854] * sysdeps/ieee754/dbl-64/s_tan.c (tan): Use diff --git a/NEWS b/NEWS index cbccc7b458..cc897dbf7f 100644 --- a/NEWS +++ b/NEWS @@ -9,13 +9,14 @@ Version 2.16 * The following bugs are resolved with this release: - 174, 350, 411, 2541, 2547, 2548, 3335, 3976, 3992, 4026, 4108, 4596, 4822, - 5077, 5461, 5805, 5993, 6884, 6907, 6911, 9739, 9902, 10110, 10135, 10140, - 10210, 10545, 10716, 11174, 11322, 11365, 11494, 12047, 13058, 13525, - 13526, 13527, 13528, 13529, 13530, 13531, 13532, 13533, 13547, 13551, - 13552, 13553, 13555, 13559, 13566, 13583, 13618, 13637, 13656, 13658, - 13673, 13695, 13704, 13706, 13726, 13738, 13786, 13792, 13806, 13840, - 13841, 13844, 13846, 13851, 13852, 13854 + 174, 350, 411, 2541, 2547, 2548, 2551, 2552, 2553, 2554, 2562, 2563, 2565, + 2566, 2576, 3335, 3976, 3992, 4026, 4108, 4596, 4822, 5077, 5461, 5805, + 5993, 6884, 6907, 6911, 9739, 9902, 10110, 10135, 10140, 10210, 10545, + 10716, 11174, 11322, 11365, 11494, 12047, 13058, 13525, 13526, 13527, + 13528, 13529, 13530, 13531, 13532, 13533, 13547, 13551, 13552, 13553, + 13555, 13559, 13566, 13583, 13618, 13637, 13656, 13658, 13673, 13695, + 13704, 13706, 13726, 13738, 13786, 13792, 13806, 13840, 13841, 13844, + 13846, 13851, 13852, 13854 * ISO C11 support: diff --git a/math/libm-test.inc b/math/libm-test.inc index 8bcaa8869f..5638b76869 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); } @@ -7152,6 +7166,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); } @@ -7186,6 +7206,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 f8d3724756..0171a0bc72 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 cef36aab1b..9e1681a243 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 144f33c0db..54c9c89029 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 e9a5357b76..40600503ee 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 29bd949eea..a3f5ee2e27 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 01b8551252..208377ecaf 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 fd3fb162f2..63658a93c2 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 36d6f6d573..41d9bc5711 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 148817ff44..2028d488df 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 d83b2339ca..9b683b905d 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 @@ -1745,6 +1764,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 @@ -1776,6 +1803,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 @@ -2434,8 +2471,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 613ae579e9..ad1e2f19b8 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 @@ -1699,6 +1720,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 @@ -1730,6 +1759,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 @@ -2380,8 +2417,8 @@ double: 3 float: 2 idouble: 3 ifloat: 2 -ildouble: 1 -ldouble: 1 +ildouble: 2 +ldouble: 2 Function: "yn": double: 3 -- 2.43.5