From b3c7503940022f70ec8272c2c0d0a0e4489ae992 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Mon, 2 Sep 2013 14:51:24 +0000 Subject: [PATCH] Fix spurious jnf underflows (bug 14155). --- ChangeLog | 12 ++++++++++++ NEWS | 29 +++++++++++++++++------------ math/libm-test.inc | 19 +++++++++++++++++-- sysdeps/i386/fpu/libm-test-ulps | 20 ++++++++++++++++++-- sysdeps/ieee754/flt-32/e_jnf.c | 4 ++-- sysdeps/x86_64/fpu/libm-test-ulps | 19 +++++++++++++++++-- 6 files changed, 83 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 13486b022b4..a2e0a9f7173 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2013-09-02 Joseph Myers + + [BZ #14155] + * sysdeps/ieee754/flt-32/e_jnf.c (__ieee754_jnf): Use double for + intermediate calculations in recurrence. + (__ieee754_ynf): Likewise. + * math/libm-test.inc (jn_test_data): Do not allow spurious + underflow exception. Add more tests. + (yn_test_data): Add more tests. + * sysdeps/i386/fpu/libm-test-ulps: Update. + * sysdeps/x86_64/fpu/libm-test-ulps: Likewise. + 2013-08-29 Thomas Schwinge [BZ #15522] strtod ("nan(N)") returning a sNaN in some cases diff --git a/NEWS b/NEWS index 18cf053fb03..751b9aa9a2e 100644 --- a/NEWS +++ b/NEWS @@ -11,9 +11,14 @@ Version 2.19 * The following bugs are resolved with this release: +<<<<<<< HEAD 14699, 15522, 15531, 15532, 15736, 15749, 15797, 15867, 15890, 15897, 15905. >>>>>>> 0007fc9... [BZ #15522] strtod ("nan(N)") returning a sNaN in some cases +======= + 14155, 14699, 15522, 15531, 15532, 15736, 15749, 15797, 15867, 15890, + 15897, 15905, 15909. +>>>>>>> b7835e3... Fix spurious jnf underflows (bug 14155). Version 2.18 @@ -21,18 +26,18 @@ Version 2.18 2546, 2560, 5159, 6809, 7006, 10060, 10062, 10283, 10357, 10686, 11120, 11561, 12310, 12387, 12492, 12515, 12723, 13550, 13889, 13951, 13988, - 14142, 14176, 14200, 14256, 14280, 14293, 14317, 14327, 14478, 14496, - 14582, 14686, 14699, 14812, 14888, 14894, 14907, 14908, 14909, 14920, - 14952, 14964, 14981, 14982, 14985, 14991, 14994, 14996, 15000, 15003, - 15006, 15007, 15014, 15020, 15022, 15023, 15036, 15054, 15055, 15062, - 15078, 15084, 15085, 15086, 15100, 15160, 15214, 15221, 15232, 15234, - 15283, 15285, 15287, 15304, 15305, 15307, 15309, 15327, 15330, 15331, - 15335, 15336, 15337, 15339, 15342, 15346, 15359, 15361, 15366, 15380, - 15381, 15394, 15395, 15405, 15406, 15409, 15416, 15418, 15419, 15423, - 15424, 15426, 15429, 15431, 15432, 15441, 15442, 15448, 15465, 15480, - 15485, 15488, 15490, 15492, 15493, 15497, 15506, 15522, 15529, 15532, - 15536, 15553, 15577, 15583, 15618, 15627, 15631, 15654, 15655, 15666, - 15667, 15674, 15711, 15755, 15759, 15797. + 14142, 14155, 14176, 14200, 14256, 14280, 14293, 14317, 14327, 14478, + 14496, 14582, 14686, 14699, 14812, 14888, 14894, 14907, 14908, 14909, + 14920, 14952, 14964, 14981, 14982, 14985, 14991, 14994, 14996, 15000, + 15003, 15006, 15007, 15014, 15020, 15022, 15023, 15036, 15054, 15055, + 15062, 15078, 15084, 15085, 15086, 15100, 15160, 15214, 15221, 15232, + 15234, 15283, 15285, 15287, 15304, 15305, 15307, 15309, 15327, 15330, + 15331, 15335, 15336, 15337, 15339, 15342, 15346, 15359, 15361, 15366, + 15380, 15381, 15394, 15395, 15405, 15406, 15409, 15416, 15418, 15419, + 15423, 15424, 15426, 15429, 15431, 15432, 15441, 15442, 15448, 15465, + 15480, 15485, 15488, 15490, 15492, 15493, 15497, 15506, 15522, 15529, + 15532, 15536, 15553, 15577, 15583, 15618, 15627, 15631, 15654, 15655, + 15666, 15667, 15674, 15711, 15755, 15759, 15797. * CVE-2013-2207 Incorrectly granting access to another user's pseudo-terminal has been fixed by disabling the use of pt_chown (Bugzilla #15755). diff --git a/math/libm-test.inc b/math/libm-test.inc index 7408c6b312e..9d4925533d2 100644 --- a/math/libm-test.inc +++ b/math/libm-test.inc @@ -9908,8 +9908,14 @@ static const struct test_if_f_data jn_test_data[] = TEST_if_f (jn, 8, 2.4048255576957729L, 0.92165786705344923232879022467054148E-4L), TEST_if_f (jn, 9, 2.4048255576957729L, 0.12517270977961513005428966643852564E-4L), - /* Bug 14155: spurious exception may occur. */ - TEST_if_f (jn, 2, 0x1.ffff62p+99L, -4.43860668048170034334926693188979974489e-16L, UNDERFLOW_EXCEPTION_OK), + TEST_if_f (jn, 2, 0x1.ffff62p+99L, -4.43860668048170034334926693188979974489e-16L), + TEST_if_f (jn, 2, 0x1p127L, -6.0784021821505059176832624052765568656702e-20L), +#ifndef TEST_FLOAT + TEST_if_f (jn, 2, 0x1p1023L, 1.5665258060609012834424478437196679802783e-155L), +#endif +#if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384 + TEST_if_f (jn, 2, 0x1p16383L, -9.5859502826270374691362975419147645151233e-2467L), +#endif }; static void @@ -14526,6 +14532,15 @@ static const struct test_if_f_data yn_test_data[] = /* Check whether yn returns correct value for LDBL_MIN, DBL_MIN, and FLT_MIN. See Bug 14173. */ TEST_if_f (yn, 10, min_value, minus_infty, OVERFLOW_EXCEPTION|ERRNO_ERANGE), + + TEST_if_f (yn, 2, 0x1.ffff62p+99L, -5.5244413477397111790415387179517953221757e-16L), + TEST_if_f (yn, 2, 0x1p127L, 6.8569250690166637098111268958532649249771e-21L), +#ifndef TEST_FLOAT + TEST_if_f (yn, 2, 0x1p1023L, -8.2687542933709649327986678723012001545638e-155L), +#endif +#if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384 + TEST_if_f (yn, 2, 0x1p16383L, 3.8895531955766020648617743624167352352217e-2467L), +#endif }; static void diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps index 530dbd7402e..8244863ef67 100644 --- a/sysdeps/i386/fpu/libm-test-ulps +++ b/sysdeps/i386/fpu/libm-test-ulps @@ -5635,9 +5635,9 @@ ildouble: 1 ldouble: 1 Test "jn (10, 10.0)": double: 1 -float: 1 +float: 2 idouble: 1 -ifloat: 1 +ifloat: 2 ildouble: 2 ldouble: 2 Test "jn (10, 2.0)": @@ -5648,6 +5648,14 @@ float: 1 ifloat: 1 ildouble: 1 ldouble: 1 +Test "jn (2, 0x1p1023)": +double: 1 +idouble: 1 +Test "jn (2, 0x1p127)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 Test "jn (2, 2.4048255576957729)": double: 1 float: 1 @@ -6844,6 +6852,14 @@ ifloat: 1 Test "yn (10, 2.0)": float: 3 ifloat: 3 +Test "yn (2, 0x1.ffff62p+99)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "yn (2, 0x1p127)": +float: 2 +ifloat: 2 Test "yn (3, 0.125)": ildouble: 1 ldouble: 1 diff --git a/sysdeps/ieee754/flt-32/e_jnf.c b/sysdeps/ieee754/flt-32/e_jnf.c index ad26d7e8a6e..5984d94a3c2 100644 --- a/sysdeps/ieee754/flt-32/e_jnf.c +++ b/sysdeps/ieee754/flt-32/e_jnf.c @@ -54,7 +54,7 @@ __ieee754_jnf(int n, float x) b = __ieee754_j1f(x); for(i=1;i