This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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: long double (was "strtold?")


On Friday 17 April 2009 23:19:33 Howland Craig D (Craig) wrote:
> Umm, I don't understand the change to machine/ieeefp.h.  The defines
> that it was using are the official names from float.h.  Adding __ as a
> prefix and suffix ties it directly to gcc.  The makes it work for gcc
> without float.h having been included, but won't it break other
> compilers?
> (There's nothing in the standards that I know of that would require
> __LDBL_MANT_DIG__ to be defined, for example.)  So perhaps it did not
> build as it was, but the way to fix it for all compilers is to add
> #include <float.h>, I think.  (Newlib doesn't require gcc, does it?)
> 				Craig

Craig,

Thanks for the heads up, you are right. The attached patch uses defines 
provided by <float.h> instead of the GCC internals.

Ken

newlib/ChangeLog:

2009-04-17  Ken Werner  <ken.werner@de.ibm.com>

        * libc/include/machine/ieeefp.h: Include <float.h> to use the defines 
          needed for _LDBL_EQ_DBL from there instead of the GCC internals.

Index: src/newlib/libc/include/machine/ieeefp.h
===================================================================
--- src.orig/newlib/libc/include/machine/ieeefp.h
+++ src/newlib/libc/include/machine/ieeefp.h
@@ -332,9 +332,10 @@
 #endif /* not __IEEE_BIG_ENDIAN */
 
 /* Check if long double is as wide as double. */
+#include <float.h>
 #if (!defined(__STRICT_ANSI__) || __STDC_VERSION__ > 199901L || \
-  defined(__cplusplus)) && defined(__LDBL_MANT_DIG__) && \
-    (__DBL_MANT_DIG__ == __LDBL_MANT_DIG__ && __LDBL_MIN_EXP__ == __DBL_MIN_EXP__ && \
-    __LDBL_MAX_EXP__ == __DBL_MAX_EXP__)
+  defined(__cplusplus)) && defined(LDBL_MANT_DIG) && \
+    (DBL_MANT_DIG == LDBL_MANT_DIG && LDBL_MIN_EXP == DBL_MIN_EXP && \
+    LDBL_MAX_EXP == DBL_MAX_EXP)
  #define _LDBL_EQ_DBL
 #endif

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