ULP generation bug
Andreas Schwab
schwab@suse.de
Tue Oct 16 11:19:00 GMT 2001
This fixes the generation of the ULP file (with --ulps-file
--ignore-max-ulp=yes). For example, the ULP value for "Imaginary part of:
cpow (e + 0 i, 0 + 2 * M_PIl i) == 1.0 + 0.0 i" is not really 1.1030 for
IEEE double, but rather a wee bit larger, so that you still get a failure.
With this patch all printed ULP values are now rounded up to the next
whole number. I have also fixed print_complex_max_error to respect
ignore_max_ulp.
Andreas.
2001-10-16 Andreas Schwab <schwab@suse.de>
* math/libm-test.inc (print_ulps): Print ulp values rounded to
next whole number.
(print_function_ulps): Likewise.
(print_complex_function_ulps): Likewise.
(print_max_error): Likewise.
(print_complex_max_error): Likewise. Handle ignore_max_ulp.
--- math/libm-test.inc.~1.41.~ Tue Aug 28 10:08:19 2001
+++ math/libm-test.inc Tue Oct 16 20:04:45 2001
@@ -250,9 +250,10 @@
if (output_ulps)
{
fprintf (ulps_file, "Test \"%s\":\n", test_name);
- fprintf (ulps_file, "%s: % .4" PRINTF_NEXPR "\n",
+ fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
CHOOSE("ldouble", "double", "float",
- "ildouble", "idouble", "ifloat"), ulp);
+ "ildouble", "idouble", "ifloat"),
+ FUNC(ceil) (ulp));
}
}
@@ -262,9 +263,10 @@
if (output_ulps)
{
fprintf (ulps_file, "Function: \"%s\":\n", function_name);
- fprintf (ulps_file, "%s: % .4" PRINTF_NEXPR "\n",
+ fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
CHOOSE("ldouble", "double", "float",
- "ildouble", "idouble", "ifloat"), ulp);
+ "ildouble", "idouble", "ifloat"),
+ FUNC(ceil) (ulp));
}
}
@@ -278,16 +280,18 @@
if (real_ulp != 0.0)
{
fprintf (ulps_file, "Function: Real part of \"%s\":\n", function_name);
- fprintf (ulps_file, "%s: % .4" PRINTF_NEXPR "\n",
+ fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
CHOOSE("ldouble", "double", "float",
- "ildouble", "idouble", "ifloat"), real_ulp);
+ "ildouble", "idouble", "ifloat"),
+ FUNC(ceil) (real_ulp));
}
if (imag_ulp != 0.0)
{
fprintf (ulps_file, "Function: Imaginary part of \"%s\":\n", function_name);
- fprintf (ulps_file, "%s: % .4" PRINTF_NEXPR "\n",
+ fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
CHOOSE("ldouble", "double", "float",
- "ildouble", "idouble", "ifloat"), imag_ulp);
+ "ildouble", "idouble", "ifloat"),
+ FUNC(ceil) (imag_ulp));
}
@@ -336,8 +340,8 @@
if (print_screen_max_error (ok, xfail))
{
printf ("Maximal error of `%s'\n", func_name);
- printf (" is : % .4" PRINTF_NEXPR " ulp\n", max_error);
- printf (" accepted: % .4" PRINTF_NEXPR " ulp\n", allowed);
+ printf (" is : %.0" PRINTF_NEXPR " ulp\n", FUNC(ceil) (max_error));
+ printf (" accepted: %.0" PRINTF_NEXPR " ulp\n", FUNC(ceil) (allowed));
}
update_stats (ok, xfail);
@@ -350,8 +354,10 @@
{
int ok = 0;
- if ((real_max_error <= __real__ allowed)
- && (imag_max_error <= __imag__ allowed))
+ if ((real_max_error == 0 && imag_max_error == 0)
+ || (real_max_error <= __real__ allowed
+ && imag_max_error <= __imag__ allowed
+ && !ignore_max_ulp))
{
ok = 1;
}
@@ -363,11 +369,15 @@
if (print_screen_max_error (ok, xfail))
{
printf ("Maximal error of real part of: %s\n", func_name);
- printf (" is : % .4" PRINTF_NEXPR " ulp\n", real_max_error);
- printf (" accepted: % .4" PRINTF_NEXPR " ulp\n", __real__ allowed);
+ printf (" is : %.0" PRINTF_NEXPR " ulp\n",
+ FUNC(ceil) (real_max_error));
+ printf (" accepted: %.0" PRINTF_NEXPR " ulp\n",
+ FUNC(ceil) (__real__ allowed));
printf ("Maximal error of imaginary part of: %s\n", func_name);
- printf (" is : % .4" PRINTF_NEXPR " ulp\n", imag_max_error);
- printf (" accepted: % .4" PRINTF_NEXPR " ulp\n", __imag__ allowed);
+ printf (" is : %.0" PRINTF_NEXPR " ulp\n",
+ FUNC(ceil) (imag_max_error));
+ printf (" accepted: %.0" PRINTF_NEXPR " ulp\n",
+ FUNC(ceil) (__imag__ allowed));
}
update_stats (ok, xfail);
--
Andreas Schwab "And now for something
Andreas.Schwab@suse.de completely different."
SuSE Labs, SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
More information about the Libc-hacker
mailing list