Fix libm-test.inc ulps calculation for subnormals (bug 14064)

Andreas Jaeger aj@suse.com
Sun May 6 18:09:00 GMT 2012


On 05/06/2012 02:44 PM, Joseph S. Myers wrote:
> 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.

Does this fix any other values?

> 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);

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

thanks,
Andreas
-- 
  Andreas Jaeger aj@{suse.com,opensuse.org} 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



More information about the Libc-alpha mailing list