about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2015-03-24 23:06:28 +0000
committerJoseph Myers <joseph@codesourcery.com>2015-03-24 23:06:28 +0000
commit7c84a5042ff1ca7b97093079b25eb5e0e7e7e1a2 (patch)
treeb0576568e92b0f4f4169f391bf398669203423c1 /sysdeps
parent7e9c7b9b689d9d8f24a4a7f9723f0290c0cbdbd0 (diff)
downloadglibc-7c84a5042ff1ca7b97093079b25eb5e0e7e7e1a2.tar.gz
glibc-7c84a5042ff1ca7b97093079b25eb5e0e7e7e1a2.tar.xz
glibc-7c84a5042ff1ca7b97093079b25eb5e0e7e7e1a2.zip
Add more tests of log2.
In testing for x86_64 on an AMD processor, I observed libm test
failures of the form:

testing long double (without inline functions)
Failure: Test: log2_downward (0x2.b7e151628aed4p+0)
Result:
 is:          1.44269504088896356633e+00   0xb.8aa3b295c17f67600000p-3
 should be:   1.44269504088896356622e+00   0xb.8aa3b295c17f67500000p-3
 difference:  1.08420217248550443400e-19   0x8.00000000000000000000p-66
 ulp       :  1.0000
 max.ulp   :  0.0000
Maximal error of `log2_downward'
 is      : 1 ulp
 accepted: 0 ulp

These issues arise because the maximum ulps when regenerating on one
processor are not the same as on another processor, so regeneration on
several processors may be needed when updating libm-test-ulps to avoid
failures for some users testing glibc - but such regeneration on
multiple processors is inconvenient.  Causes can be: on x86 and, for
x86_64, for long double, variation in results of x87 instructions for
transcendental operations between processors; on x86, variation in
compiler excess precision between compiler versions and
configurations; on any processor where the compiler may contract
expressions using fused multiply-add, variation in what contraction
occurs.

Although it's hard to be sure libm-test-ulps covers all ulps that may
be seen in any configuration for the given architecture, in practice
it helps simply to add wider test coverage to make it more likely
that, when testing on one processor, the ulps seen are the biggest
that can be seen for that function on that processor, and hopefully
they are also the biggest that can be seen for that function in other
configurations for that architecture.  Thus, this patch adds some
tests of log2 that increase the ulps I see on x86_64 on an Intel
processor, so that hopefully future from-scratch regenerations on that
processor will produce ulps big enough not to have errors from testing
on AMD processors.  These tests were found by randomly generating
inputs and seeing what produced ulps larger than those currently in
libm-test-ulps.  Of course such increases also improve the accuracy of
the empirical table of known ulps generated from libm-test-ulps files
that goes in the manual.

Tested for x86_64 and x86 and ulps updated accordingly.

	* math/auto-libm-test-in: Add more tests of log2.
	* math/auto-libm-test-out: Regenerated.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/i386/fpu/libm-test-ulps8
-rw-r--r--sysdeps/x86_64/fpu/libm-test-ulps26
2 files changed, 26 insertions, 8 deletions
diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps
index 302ea4c2b9..e03dbaeeae 100644
--- a/sysdeps/i386/fpu/libm-test-ulps
+++ b/sysdeps/i386/fpu/libm-test-ulps
@@ -1651,6 +1651,14 @@ ifloat: 1
 ildouble: 1
 ldouble: 1
 
+Function: "log2":
+ildouble: 1
+ldouble: 1
+
+Function: "log2_downward":
+ildouble: 1
+ldouble: 1
+
 Function: "log2_towardzero":
 double: 1
 float: 1
diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
index 5cfb73f900..39dfff8e1e 100644
--- a/sysdeps/x86_64/fpu/libm-test-ulps
+++ b/sysdeps/x86_64/fpu/libm-test-ulps
@@ -1735,24 +1735,34 @@ ifloat: 1
 ildouble: 1
 ldouble: 1
 
+Function: "log2":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
 Function: "log2_downward":
-double: 2
-float: 2
-idouble: 2
-ifloat: 2
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+ildouble: 1
+ldouble: 1
 
 Function: "log2_towardzero":
 double: 1
-float: 1
+float: 2
 idouble: 1
-ifloat: 1
+ifloat: 2
 ildouble: 1
 ldouble: 1
 
 Function: "log2_upward":
-double: 2
+double: 3
 float: 2
-idouble: 2
+idouble: 3
 ifloat: 2
 ildouble: 1
 ldouble: 1