Fix acosf underflow (bug 14153).

This commit is contained in:
Joseph Myers 2012-05-25 11:07:07 +00:00
parent b0bc23a177
commit b65504975c
4 changed files with 11 additions and 4 deletions

View File

@ -1,3 +1,11 @@
2012-05-24 Joseph Myers <joseph@codesourcery.com>
[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 <law@redhat.com>
* stdio-common/Makefile (tests): Add bug25.

2
NEWS
View File

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

View File

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

View File

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