This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Fix libm-test.inc ulps calculation for subnormals (bug 14064)
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: libc-alpha at sourceware dot org
- Date: Sun, 6 May 2012 12:44:41 +0000 (UTC)
- Subject: Fix libm-test.inc ulps calculation for subnormals (bug 14064)
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