"esparanoia" tests fail [PATCH]
Jeff Johnston
jjohnstn@redhat.com
Mon Oct 31 20:32:00 GMT 2005
DARIN JOHNSON wrote:
> 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.
>
Thanks Darin for catching this. One thing puzzles me though. The macro
in question was wrong in two ways. It had a triple underscore whereas
the endian macros everywhere else in newlib only have two underscores.
I modified this when I checked in your patch, but theoretically, you
should have always fallen into the #else.
> 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 */
>
>
>
More information about the Newlib
mailing list