From b65504975c97e1ec7aadaa75dcefb42e7e70fa1f Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Fri, 25 May 2012 11:07:07 +0000 Subject: [PATCH] Fix acosf underflow (bug 14153). --- ChangeLog | 8 ++++++++ NEWS | 2 +- math/libm-test.inc | 3 +-- sysdeps/ieee754/flt-32/e_acosf.c | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c6c2cad..ceb3f5a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2012-05-24 Joseph Myers + + [BZ #14153] + * sysdeps/ieee754/flt-32/e_acosf.c (__ieee754_acosf): Return pi/2 + for |x| <= 2**-26, not 2**-57. + * math/libm-test.inc (acos_test): Do not allow spurious underflow + exception. + 2012-05-24 Jeff Law * stdio-common/Makefile (tests): Add bug25. diff --git a/NEWS b/NEWS index 7ccfb90..932934d 100644 --- a/NEWS +++ b/NEWS @@ -28,7 +28,7 @@ Version 2.16 13941, 13942, 13954, 13955, 13956, 13963, 13967, 13968, 13970, 13973, 13979, 13983, 13986, 14012, 14027, 14033, 14034, 14036, 14040, 14043, 14044, 14049, 14053, 14055, 14059, 14064, 14080, 14083, 14103, 14104, - 14109, 14122, 14123 + 14109, 14122, 14123, 14153 * ISO C11 support: diff --git a/math/libm-test.inc b/math/libm-test.inc index 5946ca8..ed13f53 100644 --- a/math/libm-test.inc +++ b/math/libm-test.inc @@ -804,8 +804,7 @@ acos_test (void) TEST_f_f (acos, 0.5, M_PI_6l*2.0); TEST_f_f (acos, -0.5, M_PI_6l*4.0); TEST_f_f (acos, 0.75L, 0.722734247813415611178377352641333362L); - /* Bug 14153: spurious exception may occur. */ - TEST_f_f (acos, 2e-17L, 1.57079632679489659923132169163975144L, UNDERFLOW_EXCEPTION_OK_FLOAT); + TEST_f_f (acos, 2e-17L, 1.57079632679489659923132169163975144L); TEST_f_f (acos, 0.0625L, 1.50825556499840522843072005474337068L); TEST_f_f (acos, 0x0.ffffffp0L, 3.4526698471620358760324948263873649728491e-4L); TEST_f_f (acos, -0x0.ffffffp0L, 3.1412473866050770348750401337968641476999L); diff --git a/sysdeps/ieee754/flt-32/e_acosf.c b/sysdeps/ieee754/flt-32/e_acosf.c index c0f1d4e..6f792f6 100644 --- a/sysdeps/ieee754/flt-32/e_acosf.c +++ b/sysdeps/ieee754/flt-32/e_acosf.c @@ -46,7 +46,7 @@ __ieee754_acosf(float x) return (x-x)/(x-x); /* acos(|x|>1) is NaN */ } if(ix<0x3f000000) { /* |x| < 0.5 */ - if(ix<=0x23000000) return pio2_hi+pio2_lo;/*if|x|<2**-57*/ + if(ix<=0x32800000) return pio2_hi+pio2_lo;/*if|x|<=2**-26*/ z = x*x; p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); -- 2.7.4