Fix atanf spurious underflows (bug 18196) [committed]
Joseph Myers
joseph@codesourcery.com
Thu May 14 23:51:00 GMT 2015
The sysdeps/ieee754/flt-32 version of atanf produces spurious
underflow exceptions for some large arguments, because of computations
that compute x^-4. This patch fixes this by adjusting the threshold
for large arguments (for which +/- pi/2 can just be returned, the
correct result being roughly +/- pi/2 - 1/x) from 2^34 to 2^25.
Tested for x86_64 and x86. Committed.
(auto-libm-test-out diffs omitted below.)
2015-05-14 Joseph Myers <joseph@codesourcery.com>
[BZ #18196]
* sysdeps/ieee754/flt-32/s_atanf.c (__atanf): Use 2^25 not 2^34 as
threshold for large arguments.
* math/auto-libm-test-in: Add another test of atan.
* math/auto-libm-test-out: Regenerated.
diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in
index 7e5c7bb..1deb99a 100644
--- a/math/auto-libm-test-in
+++ b/math/auto-libm-test-in
@@ -239,6 +239,7 @@ atan 0x1p-5
atan 2.5
atan 10
atan 1e6
+atan 0x1p31
atan 0x1p-100
atan 0x1p-600
atan 0x1p-10000
diff --git a/sysdeps/ieee754/flt-32/s_atanf.c b/sysdeps/ieee754/flt-32/s_atanf.c
index 1593918..be2addb 100644
--- a/sysdeps/ieee754/flt-32/s_atanf.c
+++ b/sysdeps/ieee754/flt-32/s_atanf.c
@@ -60,7 +60,7 @@ float __atanf(float x)
GET_FLOAT_WORD(hx,x);
ix = hx&0x7fffffff;
- if(ix>=0x50800000) { /* if |x| >= 2^34 */
+ if(ix>=0x4c000000) { /* if |x| >= 2^25 */
if(ix>0x7f800000)
return x+x; /* NaN */
if(hx>0) return atanhi[3]+atanlo[3];
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Libc-alpha
mailing list