aboutsummaryrefslogtreecommitdiff
path: root/math
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2015-09-26 00:27:06 +0000
committerJoseph Myers <joseph@codesourcery.com>2015-09-26 00:27:06 +0000
commitfa752c698146ca3e9f7747d33059fbef9bb02b0e (patch)
treea41295f8a99770d272a53c714effd0f5749b2735 /math
parent6ace39382120dd0668b2168591611f71b04ac8f3 (diff)
downloadglibc-fa752c698146ca3e9f7747d33059fbef9bb02b0e.zip
glibc-fa752c698146ca3e9f7747d33059fbef9bb02b0e.tar.gz
glibc-fa752c698146ca3e9f7747d33059fbef9bb02b0e.tar.bz2
Fix powf inaccuracy (bug 18956).
The flt-32 version of powf can be inaccurate because of bugs in the extra-precision calculation of (x-1)/(x+1) or (x-1.5)/(x+1.5) as part of calculating log(x) with extra precision: a constant used (as part of adding 1 or 1.5 through integer arithmetic) is incorrect, and then the code fails to mask a computed high part before using it in arithmetic that relies on s_h*t_h being exactly representable. This patch fixes these bugs. Tested for x86_64 and x86. x86_64 ulps for powf removed and regenerated to reflect reduced ulps from the increased accuracy for existing tests. [BZ #18956] * sysdeps/ieee754/flt-32/e_powf.c (__ieee754_powf): Add 0x00400000 not 0x0040000 for high bit of mantissa. Mask with 0xfffff000 when extracting high part. * math/auto-libm-test-in: Add another test of pow. * math/auto-libm-test-out: Regenerated. * sysdeps/x86_64/fpu/libm-test-ulps: Update.
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 4b93857..e86be23 100644
--- a/math/auto-libm-test-in
+++ b/math/auto-libm-test-in
@@ -3219,6 +3219,7 @@ pow 0x1.ce78f2p+0 -0x2.7f1f78p+4
pow 0xf.fffffp+124 -0x5.b5b648p+0
pow 0x1.430d4cp+0 0x5.0e462p+4
pow 0x9.8b82ap-4 -0x1.99907ap+12
+pow 0xd.73035p-4 -0x1.47bb8p+8
sin 0
sin -0
diff --git a/math/auto-libm-test-out b/math/auto-libm-test-out
index 4126a7c..bcfa832 100644
--- a/math/auto-libm-test-out
+++ b/math/auto-libm-test-out
@@ -226489,6 +226489,31 @@ pow 0x9.8b82ap-4 -0x1.99907ap+12
= pow tonearest ldbl-128ibm 0x9.8b82ap-4L -0x1.99907ap+12L : plus_infty : inexact-ok overflow errno-erange
= pow towardzero ldbl-128ibm 0x9.8b82ap-4L -0x1.99907ap+12L : 0xf.ffffffffffffbffffffffffffcp+1020L : inexact-ok overflow errno-erange-ok
= pow upward ldbl-128ibm 0x9.8b82ap-4L -0x1.99907ap+12L : plus_infty : inexact-ok overflow errno-erange
+pow 0xd.73035p-4 -0x1.47bb8p+8
+= pow downward flt-32 0xd.73035p-4f -0x1.47bb8p+8f : 0x4.52398p+80f : inexact-ok
+= pow tonearest flt-32 0xd.73035p-4f -0x1.47bb8p+8f : 0x4.523988p+80f : inexact-ok
+= pow towardzero flt-32 0xd.73035p-4f -0x1.47bb8p+8f : 0x4.52398p+80f : inexact-ok
+= pow upward flt-32 0xd.73035p-4f -0x1.47bb8p+8f : 0x4.523988p+80f : inexact-ok
+= pow downward dbl-64 0xd.73035p-4 -0x1.47bb8p+8 : 0x4.523987c590d3p+80 : inexact-ok
+= pow tonearest dbl-64 0xd.73035p-4 -0x1.47bb8p+8 : 0x4.523987c590d3p+80 : inexact-ok
+= pow towardzero dbl-64 0xd.73035p-4 -0x1.47bb8p+8 : 0x4.523987c590d3p+80 : inexact-ok
+= pow upward dbl-64 0xd.73035p-4 -0x1.47bb8p+8 : 0x4.523987c590d34p+80 : inexact-ok
+= pow downward ldbl-96-intel 0xd.73035p-4L -0x1.47bb8p+8L : 0x4.523987c590d3192p+80L : inexact-ok
+= pow tonearest ldbl-96-intel 0xd.73035p-4L -0x1.47bb8p+8L : 0x4.523987c590d31928p+80L : inexact-ok
+= pow towardzero ldbl-96-intel 0xd.73035p-4L -0x1.47bb8p+8L : 0x4.523987c590d3192p+80L : inexact-ok
+= pow upward ldbl-96-intel 0xd.73035p-4L -0x1.47bb8p+8L : 0x4.523987c590d31928p+80L : inexact-ok
+= pow downward ldbl-96-m68k 0xd.73035p-4L -0x1.47bb8p+8L : 0x4.523987c590d3192p+80L : inexact-ok
+= pow tonearest ldbl-96-m68k 0xd.73035p-4L -0x1.47bb8p+8L : 0x4.523987c590d31928p+80L : inexact-ok
+= pow towardzero ldbl-96-m68k 0xd.73035p-4L -0x1.47bb8p+8L : 0x4.523987c590d3192p+80L : inexact-ok
+= pow upward ldbl-96-m68k 0xd.73035p-4L -0x1.47bb8p+8L : 0x4.523987c590d31928p+80L : inexact-ok
+= pow downward ldbl-128 0xd.73035p-4L -0x1.47bb8p+8L : 0x4.523987c590d3192757b32fb92c7p+80L : inexact-ok
+= pow tonearest ldbl-128 0xd.73035p-4L -0x1.47bb8p+8L : 0x4.523987c590d3192757b32fb92c74p+80L : inexact-ok
+= pow towardzero ldbl-128 0xd.73035p-4L -0x1.47bb8p+8L : 0x4.523987c590d3192757b32fb92c7p+80L : inexact-ok
+= pow upward ldbl-128 0xd.73035p-4L -0x1.47bb8p+8L : 0x4.523987c590d3192757b32fb92c74p+80L : inexact-ok
+= pow downward ldbl-128ibm 0xd.73035p-4L -0x1.47bb8p+8L : 0x4.523987c590d3192757b32fb92cp+80L : inexact-ok
+= pow tonearest ldbl-128ibm 0xd.73035p-4L -0x1.47bb8p+8L : 0x4.523987c590d3192757b32fb92cp+80L : inexact-ok
+= pow towardzero ldbl-128ibm 0xd.73035p-4L -0x1.47bb8p+8L : 0x4.523987c590d3192757b32fb92cp+80L : inexact-ok
+= pow upward ldbl-128ibm 0xd.73035p-4L -0x1.47bb8p+8L : 0x4.523987c590d3192757b32fb92ep+80L : inexact-ok
sin 0
= sin downward flt-32 0x0p+0f : 0x0p+0f : inexact-ok
= sin tonearest flt-32 0x0p+0f : 0x0p+0f : inexact-ok