Fix libm-test.inc ulps calculation for subnormals (bug 14064)
Joseph S. Myers
joseph@codesourcery.com
Sun May 6 12:44:00 GMT 2012
When fixing problems with exp10 I noted a problem, bug 14064, with how
libm-test.inc calculates ulps values for subnormal expected results,
so causing last-bit errors to be wrongly reported as huge numbers of
ulps.
I propose this patch to fix this libm-test.inc bug. Tested x86_64,
x86 and (together with my exp10 patch
<http://sourceware.org/ml/libc-alpha/2012-05/msg00201.html>, where the
error is now reported as 1ulp not 35184372088832ulp) powerpc.
2012-05-06 Joseph Myers <joseph@codesourcery.com>
[BZ #14064]
* math/libm-test.inc (check_float_internal): Correct ulp
calculation for subnormal expected results.
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 59192ed..86ec315 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -503,8 +503,7 @@ check_float_internal (const char *test_name, FLOAT computed, FLOAT expected,
ulp = diff / FUNC(ldexp) (1.0, FUNC(ilogb) (expected) - MANT_DIG);
break;
case FP_SUBNORMAL:
- ulp = (FUNC(ldexp) (diff, MANT_DIG)
- / FUNC(ldexp) (1.0, FUNC(ilogb) (expected)));
+ ulp = (FUNC(ldexp) (diff, MANT_DIG) / min_value);
break;
default:
/* It should never happen. */
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Libc-alpha
mailing list