1 |
vapier 09/01/10 09:51:04 |
2 |
|
3 |
Added: 0090_all_glibc-math-tests.patch |
4 |
Log: |
5 |
add fix for math tests #254371 |
6 |
|
7 |
Revision Changes Path |
8 |
1.1 src/patchsets/glibc/2.9/0090_all_glibc-math-tests.patch |
9 |
|
10 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/glibc/2.9/0090_all_glibc-math-tests.patch?rev=1.1&view=markup |
11 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/glibc/2.9/0090_all_glibc-math-tests.patch?rev=1.1&content-type=text/plain |
12 |
|
13 |
Index: 0090_all_glibc-math-tests.patch |
14 |
=================================================================== |
15 |
From: "Joseph S. Myers" <joseph at codesourcery dot com> |
16 |
To: libc-alpha at sourceware dot org |
17 |
Date: Tue, 15 Jul 2008 14:43:04 +0000 (UTC) |
18 |
Subject: expm1 ulps |
19 |
|
20 |
If you test glibc on i686 with GCC 4.3, you get a test-ildoubl failure: |
21 |
|
22 |
Failure: Test: expm1 (1) == M_El - 1.0 |
23 |
Result: |
24 |
is: 1.71828182845904523532e+00 0xd.bf0a8b14576953500000p-3 |
25 |
should be: 1.71828182845904523543e+00 0xd.bf0a8b14576953600000p-3 |
26 |
difference: 1.08420217248550443401e-19 0x8.00000000000000000000p-66 |
27 |
ulp : 1.0000 |
28 |
max.ulp : 0.0000 |
29 |
Maximal error of `expm1' |
30 |
is : 1 ulp |
31 |
accepted: 0 ulp |
32 |
|
33 |
What happens is that the inline expansion of expm1l uses __builtin_expm1l, |
34 |
and GCC 4.3 optimizes calls to __builtin_expm1l with constant argument to |
35 |
a correctly rounded result using MPFR. The result returned is thus the |
36 |
value of e-1 rounded once to long double precision. However, the test |
37 |
expects M_El - 1.0, and the result of rounding e to long double precision, |
38 |
then subtracting 1, differs in the last place from the result of rounding |
39 |
e-1 to long double precision (the latter has smaller exponent, and the |
40 |
last bit is 1). |
41 |
|
42 |
There are two obvious approaches possible to fixing this. The first patch |
43 |
below changes the expectation to a decimal expansion for e-1 (taken from |
44 |
that of M_El) rather than doing arithmetic in the expected value. This in |
45 |
turn requires ulps to be set for the out-of-line version of expm1. It |
46 |
might also need ulps to be set for the inline version for older compilers |
47 |
if they should continue to pass the test, and possibly for other targets. |
48 |
The second patch below takes the alternative approach of keeping the |
49 |
existing expectation (which has the wrong bit in the last place) and |
50 |
setting ulps for the inline expansion of expm1, which avoids the risk of |
51 |
breaking the test for other targets. |
52 |
|
53 |
2008-07-15 Joseph Myers <joseph@××××××××××××.com> |
54 |
|
55 |
* sysdeps/i386/fpu/libm-test-ulps: Add inline long double ulps for |
56 |
expm1. |
57 |
|
58 |
Index: sysdeps/i386/fpu/libm-test-ulps |
59 |
=================================================================== |
60 |
RCS file: /cvs/glibc/libc/sysdeps/i386/fpu/libm-test-ulps,v |
61 |
retrieving revision 1.44 |
62 |
diff -u -r1.44 libm-test-ulps |
63 |
--- sysdeps/i386/fpu/libm-test-ulps 15 Jan 2006 17:59:37 -0000 1.44 |
64 |
+++ sysdeps/i386/fpu/libm-test-ulps 15 Jul 2008 14:28:47 -0000 |
65 |
@@ -453,6 +453,10 @@ |
66 |
ildouble: 8 |
67 |
ldouble: 8 |
68 |
|
69 |
+# expm1 |
70 |
+Test "expm1 (1) == M_El - 1.0": |
71 |
+ildouble: 1 |
72 |
+ |
73 |
# gamma |
74 |
Test "gamma (-0.5) == log(2*sqrt(pi))": |
75 |
double: 1 |
76 |
@@ -1134,6 +1138,9 @@ |
77 |
ildouble: 8 |
78 |
ldouble: 8 |
79 |
|
80 |
+Function: "expm1": |
81 |
+ildouble: 1 |
82 |
+ |
83 |
Function: "gamma": |
84 |
double: 1 |
85 |
idouble: 1 |