A patch for libm-ieee754
Andreas Jaeger
aj@arthur.rhein-neckar.de
Sun Feb 22 07:42:00 GMT 1998
>>>>> H J Lu writes:
> Hi,
> It turns out those libm-ieee754 bugs are not in egcs. Here is the patch
> for glibc 2.1 to fix a few libm-ieee754 bugs. Ulrich, could you please
> take a look?
I've added all your math patches (and removed isless/islessequal i486
macros) and it's really an improvement (results for float and double
are appended below)! The functions you've fixed (and those dependend
on the correct results of e.g. exp) seem to be ok now (according to
libm-test).
scalb and gamma fail for some values. The other results are just
rounding errors, we should change the epsilons in libm-test for those
results. I'm appending a patch for BUGS (Uli, please add this to
2.1).
Btw. none of those functions are in glibc 2.0.x - log2 and exp2 are
new and exp has been rewritten recently. These are problems only in
the development tree.
Andreas
1998-02-22 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* BUGS: log2 and asin should be ok now, removed those entries and
added entries for scalb and gamma.
Index: BUGS
===================================================================
RCS file: /egcs/carton/cvsfiles/libc/BUGS,v
retrieving revision 1.20
diff -u -r1.20 BUGS
--- BUGS 1998/02/20 15:03:12 1.20
+++ BUGS 1998/02/22 14:48:35
@@ -27,8 +27,6 @@
[ **] There are problems with signal handling when using LinuxThreads.
-[ **] The libm-ieee `log2' function seems to be very inaccurate.
-
[ *] The precision of the `sinhl' and/or `asinhl' function do not seem
to be the best.
@@ -55,8 +53,12 @@
checked for errors, but the whole file containing the same
category.
[PR libc/207]
+
+[ *] The libm-ieee `gamma' function gives wrong results (at least for
+ -0.5).
-[ *] The libm-ieee `asin' function gives wrong results (at least for 0.5).
+[ *] The libm-ieee `scalb' function gives wrong results for
+ non-integral second parameters.
[ *] _IO_getline can loop forever, at least with C++
[PR libc/332]
===================================================================
Results of test-double and test-float:
testing float (without inline functions)
Fail: asin (0.7) == 0.775397496...
Result:
is: 7.75397598743438720703e-01 0x1.8d00ea00000000000000p-1
should be: 7.75397479534149169922e-01 0x1.8d00e600000000000000p-1
difference: 1.19209289550781250000e-07 0x1.00000000000000000000p-23
Fail: asinh(0.7) == 0.652666566...
Result:
is: 6.52666509151458740234e-01 0x1.4e2a4e00000000000000p-1
should be: 6.52666568756103515625e-01 0x1.4e2a5000000000000000p-1
difference: 5.96046447753906250000e-08 0x1.00000000000000000000p-24
Fail: tanh (0.7) == 0.6043677771...
Result:
is: 6.04367733001708984375e-01 0x1.356fb000000000000000p-1
should be: 6.04367792606353759766e-01 0x1.356fb200000000000000p-1
difference: 5.96046447753906250000e-08 0x1.00000000000000000000p-24
Fail: scalb (2, 0.5) == NaN
Value: 2.00000000000000000000e+00 0x1.00000000000000000000p+1
Fail: scalb (3, -2.5) == NaN
Value: 7.50000000000000000000e-01 0x1.80000000000000000000p-1
Fail: gamma (-0.5) == -2*sqrt(pi): Exception "Invalid operation" set
Fail: gamma (-0.5) == -2*sqrt(pi)
Result:
is: nan nan
should be: -3.54490780830383300781e+00 -0x1.c5bf8a00000000000000p+1
difference: nan nan
Fail: imag(ctanh(0.7 + i 1.2)) == -0.47786...
Result:
is: 4.77864027023315429688e-01 0x1.e9553000000000000000p-2
should be: 4.77864116430282592773e-01 0x1.e9553600000000000000p-2
difference: 8.94069671630859375000e-08 0x1.80000000000000000000p-24
Test suite completed:
2146 test cases plus 2134 tests for exception flags executed.
8 errors occured.
testing double (without inline functions)
Fail: scalb (2, 0.5) == NaN
Value: 2.00000000000000000000e+00 0x1.00000000000000000000p+1
Fail: scalb (3, -2.5) == NaN
Value: 7.50000000000000000000e-01 0x1.80000000000000000000p-1
Fail: gamma (-0.5) == -2*sqrt(pi): Exception "Invalid operation" set
Fail: gamma (-0.5) == -2*sqrt(pi)
Result:
is: nan nan
should be: -3.54490770181103176384e+00 -0x1.c5bf891b4ef6a0000000p+1
difference: nan nan
Fail: real(cexp(0.7 + i 1.2)) == 0.72969...
Result:
is: 7.29698909150323760109e-01 0x1.759b186d747cf0000000p-1
should be: 7.29698909150323649087e-01 0x1.759b186d747ce0000000p-1
difference: 1.11022302462515654042e-16 0x1.00000000000000000000p-53
Fail: real(ctanh(0.7 + i 1.2)) == 1.34721...
Result:
is: 1.34721973990611898486e+00 0x1.58e364936c22e0000000p+0
should be: 1.34721973990611920691e+00 0x1.58e364936c22f0000000p+0
difference: 2.22044604925031308085e-16 0x1.00000000000000000000p-52
Test suite completed:
2031 test cases plus 2019 tests for exception flags executed.
6 errors occured.
--
Andreas Jaeger aj@arthur.rhein-neckar.de jaeger@informatik.uni-kl.de
for pgp-key finger ajaeger@alma.student.uni-kl.de
More information about the Gcc
mailing list