This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
RE: "esparanoia" tests fail [PATCH]
- From: DARIN JOHNSON <darin at usa dot net>
- To: <newlib at sources dot redhat dot com>
- Date: Fri, 28 Oct 2005 18:02:11 -0700
- Subject: RE: "esparanoia" tests fail [PATCH]
- Z-usanet-msgid: XID370JJCBcN0164X28
I found the cause of some of the defects reported by esparanoia.
There was a bad endian-ness test in s_mathcnst.c. A patch is below.
Single-precision (hardware-FP, mpc5200) now passes the tests with no
defects or flaws. Double-precision has 1 flaw and 2 defects
remaining, but there are no serious defects anymore (which raises the
esparanoia rating to "Acceptable"). The flaw is just that square
roots aren't chopped or rounded correctly, which I'm not too worried
about.
The 2 defects are:
COMMENT: sqrt( X * X ) - X = 7.10542735760100186e-15 rather than 0.
COMMENT: sqrt(X) is non-monotonic for X near 2.00000000000000000e+00
I can get rid of these by modifying or replacing the sqrt algorithm.
Since I'm not a math whiz and don't trust the algorithms, I'm not
including that code here. But if someone is interested I can show
what I did.
Darin Johnson
darin@usa.net
--------------------
diff -Naur newlib-1.13.0-orig/newlib/libm/mathfp/s_mathcnst.c
newlib-1.13.0/newl
ib/libm/mathfp/s_mathcnst.c
--- newlib-1.13.0-orig/newlib/libm/mathfp/s_mathcnst.c 2005-10-28
17:42:08.9918
82000 -0700
+++ newlib-1.13.0/newlib/libm/mathfp/s_mathcnst.c 2005-10-28
17:40:40.6648
87600 -0700
@@ -12,7 +12,7 @@
ufloat z_infinity_f = { 0x7f800000 };
ufloat z_notanum_f = { 0xffd00000 };
-#ifdef ___IEEE_LITTLE_ENDIAN
+#ifdef ___IEEE_BIG_ENDIAN
udouble z_hugeval = { 0x7ff00000, 0 };
udouble z_infinity = { 0x7ff00000, 0 };
udouble z_notanum = { 0xfff80000, 0 };
@@ -20,5 +20,5 @@
udouble z_hugeval = { 0, 0x7ff00000 };
udouble z_infinity = { 0, 0x7ff00000 };
udouble z_notanum = { 0, 0xfff80000 };
-#endif /* ___IEEE_LITTLE_ENDIAN */
+#endif /* ___IEEE_BIG_ENDIAN */