summary refs log tree commit diff
path: root/math
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2015-05-14 23:51:09 +0000
committerJoseph Myers <joseph@codesourcery.com>2015-05-14 23:51:09 +0000
commit9a71f1fcf53615c00b5f9e5da4bba92bccb0efb4 (patch)
tree803585f46a9049a90164009e560b8f25e262faa0 /math
parent0b7a5f920163d03806d7c5d9d1c83b16942c9496 (diff)
downloadglibc-9a71f1fcf53615c00b5f9e5da4bba92bccb0efb4.tar.gz
glibc-9a71f1fcf53615c00b5f9e5da4bba92bccb0efb4.tar.xz
glibc-9a71f1fcf53615c00b5f9e5da4bba92bccb0efb4.zip
Fix atanf spurious underflows (bug 18196).
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.
Diffstat (limited to 'math')
-rw-r--r--math/auto-libm-test-in1
-rw-r--r--math/auto-libm-test-out25
2 files changed, 26 insertions, 0 deletions
diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in
index 7e5c7bb254..1deb99ad0d 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/math/auto-libm-test-out b/math/auto-libm-test-out
index 7c8a3fb8ff..9f6bbbbf6f 100644
--- a/math/auto-libm-test-out
+++ b/math/auto-libm-test-out
@@ -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