This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix ulps calculation for subnormals (bug 14064)

On 05/06/2012 02:44 PM, Joseph S. Myers wrote:
When fixing problems with exp10 I noted a problem, bug 14064, with how calculates ulps values for subnormal expected results,
so causing last-bit errors to be wrongly reported as huge numbers of

I propose this patch to fix this bug.  Tested x86_64,
x86 and (together with my exp10 patch
<>, where the
error is now reported as 1ulp not 35184372088832ulp) powerpc.

Does this fix any other values?

2012-05-06 Joseph Myers<>

	[BZ #14064]
	* math/ (check_float_internal): Correct ulp
	calculation for subnormal expected results.

diff --git a/math/ b/math/
index 59192ed..86ec315 100644
--- a/math/
+++ b/math/
@@ -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);
-	  ulp = (FUNC(ldexp) (diff, MANT_DIG)
-		 / FUNC(ldexp) (1.0, FUNC(ilogb) (expected)));
+	  ulp = (FUNC(ldexp) (diff, MANT_DIG) / min_value);

This is fine. Could you add a comment as well to explain why it's done this way?

 Andreas Jaeger aj@{,} Twitter/Identica: jaegerandi
  SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
   GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
    GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]