]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix atanf spurious underflows (bug 18196).
authorJoseph Myers <joseph@codesourcery.com>
Thu, 14 May 2015 23:51:09 +0000 (23:51 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Thu, 14 May 2015 23:51:09 +0000 (23:51 +0000)
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.

[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.

ChangeLog
NEWS
math/auto-libm-test-in
math/auto-libm-test-out
sysdeps/ieee754/flt-32/s_atanf.c

index f6bf877b16795805f36dd5903546c9120d8a0458..1179142c92334c35d3dcb4c91965c91c82d5663c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 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.
+
        [BZ #16339]
        * sysdeps/i386/fpu/s_log1p.S (dbl_min): New object.
        (__log1p): Force underflow exception for results with small
diff --git a/NEWS b/NEWS
index a9b0138b3e866c3e7b88ec997cf6a7f6dbc942fa..c46ee35103570e1efe79e3fd6bfb5703568d30a2 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -16,8 +16,8 @@ Version 2.22
   17964, 17965, 17967, 17969, 17978, 17987, 17991, 17996, 17998, 17999,
   18007, 18019, 18020, 18029, 18030, 18032, 18036, 18038, 18039, 18042,
   18043, 18046, 18047, 18068, 18080, 18093, 18100, 18104, 18110, 18111,
-  18125, 18128, 18138, 18185, 18197, 18206, 18210, 18211, 18247, 18287,
-  18319, 18333, 18346, 18397, 18409.
+  18125, 18128, 18138, 18185, 18196, 18197, 18206, 18210, 18211, 18247,
+  18287, 18319, 18333, 18346, 18397, 18409.
 
 * Cache information can be queried via sysconf() function on s390 e.g. with
   _SC_LEVEL1_ICACHE_SIZE as argument.
index 7e5c7bb254ff3503a38ab4f38928c62889531d0d..1deb99ad0dea73d621e4cd5b3629a819b86e4b59 100644 (file)
@@ -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
index 7c8a3fb8fff11fd4ce538c40d10f6c435a915b35..9f6bbbbf6f00f2a79af7f156d205f550d34e0680 100644 (file)
@@ -7796,6 +7796,31 @@ atan 1e6
 = atan tonearest ldbl-128ibm 0xf.424p+16L : 0x1.921fa47d4b30ce822275563fcb8p+0L : inexact-ok
 = atan towardzero ldbl-128ibm 0xf.424p+16L : 0x1.921fa47d4b30ce822275563fcb8p+0L : inexact-ok
 = atan upward ldbl-128ibm 0xf.424p+16L : 0x1.921fa47d4b30ce822275563fccp+0L : inexact-ok
+atan 0x1p31
+= atan downward flt-32 0x8p+28f : 0x1.921fb4p+0f : inexact-ok
+= atan tonearest flt-32 0x8p+28f : 0x1.921fb6p+0f : inexact-ok
+= atan towardzero flt-32 0x8p+28f : 0x1.921fb4p+0f : inexact-ok
+= atan upward flt-32 0x8p+28f : 0x1.921fb6p+0f : inexact-ok
+= atan downward dbl-64 0x8p+28 : 0x1.921fb54242d18p+0 : inexact-ok
+= atan tonearest dbl-64 0x8p+28 : 0x1.921fb54242d18p+0 : inexact-ok
+= atan towardzero dbl-64 0x8p+28 : 0x1.921fb54242d18p+0 : inexact-ok
+= atan upward dbl-64 0x8p+28 : 0x1.921fb54242d19p+0 : inexact-ok
+= atan downward ldbl-96-intel 0x8p+28L : 0x1.921fb54242d18468p+0L : inexact-ok
+= atan tonearest ldbl-96-intel 0x8p+28L : 0x1.921fb54242d1846ap+0L : inexact-ok
+= atan towardzero ldbl-96-intel 0x8p+28L : 0x1.921fb54242d18468p+0L : inexact-ok
+= atan upward ldbl-96-intel 0x8p+28L : 0x1.921fb54242d1846ap+0L : inexact-ok
+= atan downward ldbl-96-m68k 0x8p+28L : 0x1.921fb54242d18468p+0L : inexact-ok
+= atan tonearest ldbl-96-m68k 0x8p+28L : 0x1.921fb54242d1846ap+0L : inexact-ok
+= atan towardzero ldbl-96-m68k 0x8p+28L : 0x1.921fb54242d18468p+0L : inexact-ok
+= atan upward ldbl-96-m68k 0x8p+28L : 0x1.921fb54242d1846ap+0L : inexact-ok
+= atan downward ldbl-128 0x8p+28L : 0x1.921fb54242d18469898cc519ac62p+0L : inexact-ok
+= atan tonearest ldbl-128 0x8p+28L : 0x1.921fb54242d18469898cc519ac63p+0L : inexact-ok
+= atan towardzero ldbl-128 0x8p+28L : 0x1.921fb54242d18469898cc519ac62p+0L : inexact-ok
+= atan upward ldbl-128 0x8p+28L : 0x1.921fb54242d18469898cc519ac63p+0L : inexact-ok
+= atan downward ldbl-128ibm 0x8p+28L : 0x1.921fb54242d18469898cc519acp+0L : inexact-ok
+= atan tonearest ldbl-128ibm 0x8p+28L : 0x1.921fb54242d18469898cc519ac8p+0L : inexact-ok
+= atan towardzero ldbl-128ibm 0x8p+28L : 0x1.921fb54242d18469898cc519acp+0L : inexact-ok
+= atan upward ldbl-128ibm 0x8p+28L : 0x1.921fb54242d18469898cc519ac8p+0L : inexact-ok
 atan 0x1p-100
 = atan downward flt-32 0x1p-100f : 0xf.fffffp-104f : inexact-ok
 = atan tonearest flt-32 0x1p-100f : 0x1p-100f : inexact-ok
index 159391894faba2598cb1d83bbd27b7c936c57341..be2addbdff842bc7a1c2eb65ece5a7f9bc7281a9 100644 (file)
@@ -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];