patches/glibc/2.9/180-math-tests.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun May 03 09:50:16 2009 +0000 (2009-05-03)
branchnewlib
changeset 1366 5e5d1e6f55d3
permissions -rw-r--r--
Update the newlib devel branch with stuff from /trunk@1498.

-------- diffstat follows --------
/devel/newlib/configure | 336 176 160 0 +++++++------
/devel/newlib/Makefile.in | 12 3 9 0 -
/devel/newlib/scripts/build/kernel/linux.sh | 2 1 1 0
/devel/newlib/scripts/build/internals.sh | 1 0 1 0 -
/devel/newlib/scripts/build/libc/eglibc.sh | 1 0 1 0 -
/devel/newlib/scripts/build/mpfr.sh | 2 1 1 0
/devel/newlib/scripts/functions | 111 5 106 0 ----
/devel/newlib/scripts/config.guess | 7 5 2 0 +
/devel/newlib/scripts/config.sub | 3 2 1 0 +
/devel/newlib/scripts/saveSample.sh.in | 4 2 2 0
/devel/newlib/docs/overview.txt | 8 6 2 0 +
/devel/newlib/samples/armeb-unknown-linux-uclibc/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/sh4-unknown-linux-gnu/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/x86_64-unknown-linux-gnu/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/arm-unknown-elf/crosstool.config | 12 3 9 0 -
/devel/newlib/samples/armeb-unknown-eabi/crosstool.config | 2 0 2 0 -
/devel/newlib/samples/arm-unknown-linux-gnueabi/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/ia64-unknown-linux-gnu/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/x86_64-unknown-linux-uclibc/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/armeb-unknown-linux-gnueabi/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/powerpc-e500v2-linux-gnuspe/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/i686-nptl-linux-gnu/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/arm-unknown-linux-gnu/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/powerpc-unknown-linux-gnu/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/mips-unknown-linux-uclibc/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/arm-unknown-linux-uclibcgnueabi/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/arm-iphone-linux-gnueabi/crosstool.config | 8 4 4 0
/devel/newlib/samples/armeb-unknown-linux-gnu/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/powerpc-unknown_nofpu-linux-gnu/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/i586-geode-linux-uclibc/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/arm-unknown-linux-uclibc/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/powerpc-unknown-linux-uclibc/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/mips-unknown-elf/crosstool.config | 2 0 2 0 -
/devel/newlib/samples/powerpc-405-linux-gnu/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/armeb-unknown-linux-uclibcgnueabi/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/arm-unknown-eabi/crosstool.config | 12 3 9 0 -
/devel/newlib/samples/mipsel-unknown-linux-gnu/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/powerpc64-unknown-linux-gnu/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/alphaev56-unknown-linux-gnu/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/powerpc-860-linux-gnu/crosstool.config | 14 5 9 0 -
/devel/newlib/config/kernel/linux.in | 108 2 106 0 ----
/devel/newlib/config/global/ct-behave.in | 22 13 9 0 +
/devel/newlib/config/global/download.in | 210 15 195 0 +-------
/devel/newlib/config/libc/glibc.in | 7 7 0 0 +
/devel/newlib/config/libc/glibc-eglibc.in-common | 15 14 1 0 +
45 files changed, 382 insertions(+), 839 deletions(-)
yann@1365
     1
Original patch from: gentoo/src/patchsets/glibc/2.9/0090_all_glibc-math-tests.patch
yann@1365
     2
yann@1365
     3
-= BEGIN original header =-
yann@1365
     4
From: "Joseph S. Myers" <joseph at codesourcery dot com>
yann@1365
     5
To: libc-alpha at sourceware dot org
yann@1365
     6
Date: Tue, 15 Jul 2008 14:43:04 +0000 (UTC)
yann@1365
     7
Subject: expm1 ulps
yann@1365
     8
yann@1365
     9
If you test glibc on i686 with GCC 4.3, you get a test-ildoubl failure:
yann@1365
    10
yann@1365
    11
Failure: Test: expm1 (1) == M_El - 1.0
yann@1365
    12
Result:
yann@1365
    13
 is:          1.71828182845904523532e+00   0xd.bf0a8b14576953500000p-3
yann@1365
    14
 should be:   1.71828182845904523543e+00   0xd.bf0a8b14576953600000p-3
yann@1365
    15
 difference:  1.08420217248550443401e-19   0x8.00000000000000000000p-66
yann@1365
    16
 ulp       :  1.0000
yann@1365
    17
 max.ulp   :  0.0000
yann@1365
    18
Maximal error of `expm1'
yann@1365
    19
 is      : 1 ulp
yann@1365
    20
 accepted: 0 ulp
yann@1365
    21
yann@1365
    22
What happens is that the inline expansion of expm1l uses __builtin_expm1l,
yann@1365
    23
and GCC 4.3 optimizes calls to __builtin_expm1l with constant argument to
yann@1365
    24
a correctly rounded result using MPFR.  The result returned is thus the
yann@1365
    25
value of e-1 rounded once to long double precision.  However, the test
yann@1365
    26
expects M_El - 1.0, and the result of rounding e to long double precision,
yann@1365
    27
then subtracting 1, differs in the last place from the result of rounding
yann@1365
    28
e-1 to long double precision (the latter has smaller exponent, and the
yann@1365
    29
last bit is 1).
yann@1365
    30
yann@1365
    31
There are two obvious approaches possible to fixing this.  The first patch
yann@1365
    32
below changes the expectation to a decimal expansion for e-1 (taken from
yann@1365
    33
that of M_El) rather than doing arithmetic in the expected value.  This in
yann@1365
    34
turn requires ulps to be set for the out-of-line version of expm1.  It
yann@1365
    35
might also need ulps to be set for the inline version for older compilers
yann@1365
    36
if they should continue to pass the test, and possibly for other targets.
yann@1365
    37
The second patch below takes the alternative approach of keeping the
yann@1365
    38
existing expectation (which has the wrong bit in the last place) and
yann@1365
    39
setting ulps for the inline expansion of expm1, which avoids the risk of
yann@1365
    40
breaking the test for other targets.
yann@1365
    41
yann@1365
    42
2008-07-15  Joseph Myers  <joseph@codesourcery.com>
yann@1365
    43
yann@1365
    44
        * sysdeps/i386/fpu/libm-test-ulps: Add inline long double ulps for
yann@1365
    45
        expm1.
yann@1365
    46
yann@1365
    47
-= END original header =-
yann@1365
    48
yann@1365
    49
diff -durN glibc-2_9.orig/sysdeps/i386/fpu/libm-test-ulps glibc-2_9/sysdeps/i386/fpu/libm-test-ulps
yann@1365
    50
--- glibc-2_9.orig/sysdeps/i386/fpu/libm-test-ulps	2006-01-15 18:59:37.000000000 +0100
yann@1365
    51
+++ glibc-2_9/sysdeps/i386/fpu/libm-test-ulps	2009-02-02 22:00:47.000000000 +0100
yann@1365
    52
@@ -453,6 +453,10 @@
yann@1365
    53
 ildouble: 8
yann@1365
    54
 ldouble: 8
yann@1365
    55
 
yann@1365
    56
+# expm1
yann@1365
    57
+Test "expm1 (1) == M_El - 1.0":
yann@1365
    58
+ildouble: 1
yann@1365
    59
+
yann@1365
    60
 # gamma
yann@1365
    61
 Test "gamma (-0.5) == log(2*sqrt(pi))":
yann@1365
    62
 double: 1
yann@1365
    63
@@ -1134,6 +1138,9 @@
yann@1365
    64
 ildouble: 8
yann@1365
    65
 ldouble: 8
yann@1365
    66
 
yann@1365
    67
+Function: "expm1":
yann@1365
    68
+ildouble: 1
yann@1365
    69
+
yann@1365
    70
 Function: "gamma":
yann@1365
    71
 double: 1
yann@1365
    72
 idouble: 1