bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: test-float fails on ppc64 because DBL_MIN_EXP < LDBL_MIN_EXP


From: Bruno Haible
Subject: Re: test-float fails on ppc64 because DBL_MIN_EXP < LDBL_MIN_EXP
Date: Wed, 30 Nov 2011 02:01:13 +0100
User-agent: KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; )

Paolo Bonzini wrote:
> > due to the failure of this assertion:
> >
> >      ASSERT (LDBL_MIN_EXP<= DBL_MIN_EXP);
> >
> > It fails because of these numbers:
> >
> >      $ :|gcc -dD -E -include stddef.h -|grep -E 'L?DBL_MIN_EXP'
> >      #define __DBL_MIN_EXP__ (-1021)
> >      #define __LDBL_MIN_EXP__ (-968)
> 
> It looks like the right test would be
> 
> ASSERT (LDBL_MIN_EXP - LDBL_MANT_DIG <= DBL_MIN_EXP - DBL_MANT_DIG);

> This would be enough to assert that a double can be assigned to a long 
> double.

[without loss of accuracy]. Indeed, thanks Paolo for the nice fix. I've
applied it for you, like this:


2011-11-29  Paolo Bonzini  <address@hidden>

        float tests: Correct and re-enable assertion about LDBL_MIN_EXP.
        * tests/test-float.c (test_long_double): Correct and re-enable the
        assertion about LDBL_MIN_EXP that was disabled on 2011-08-31.

--- tests/test-float.c.orig     Wed Nov 30 01:58:31 2011
+++ tests/test-float.c  Wed Nov 30 01:52:03 2011
@@ -298,14 +298,7 @@
 
   /* Check that 'long double' is at least as wide as 'double'.  */
   ASSERT (LDBL_MANT_DIG >= DBL_MANT_DIG);
-
-  /* Normally, we would also assert this:
-       ASSERT (LDBL_MIN_EXP <= DBL_MIN_EXP);
-     but at least on powerpc64 with gcc-4.4.4, it would fail:
-     $ :|gcc -dD -E -include stddef.h -|grep -E 'L?DBL_MIN_EXP'
-     #define __DBL_MIN_EXP__ (-1021)
-     #define __LDBL_MIN_EXP__ (-968)
-  */
+  ASSERT (LDBL_MIN_EXP - LDBL_MANT_DIG <= DBL_MIN_EXP - DBL_MANT_DIG);
   ASSERT (LDBL_MAX_EXP >= DBL_MAX_EXP);
 
   /* Check the value of LDBL_DIG.  */
-- 
In memoriam Willy Cohn <http://de.wikipedia.org/wiki/Willy_Cohn>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]