float: Fix LDBL_MAX value on Linux/PowerPC.
authorBruno Haible <bruno@clisp.org>
Fri, 30 Sep 2011 01:56:26 +0000 (03:56 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 30 Sep 2011 01:56:26 +0000 (03:56 +0200)
* m4/float_h.m4 (gl_FLOAT_H): Set FLOAT_H and REPLACE_FLOAT_LDBL also
on Linux/PowerPC.
* lib/float.in.h (LDBL_MAX): Redefine also on Linux/PowerPC.
* lib/float.c (gl_LDBL_MAX): Also define on Linux/PowerPC.
* doc/posix-headers/float.texi: Mention Linux/PowerPC as an affected
platform.
Reported by Andreas Metzler <ametzler@downhill.at.eu.org>.

ChangeLog
doc/posix-headers/float.texi
lib/float.c
lib/float.in.h
m4/float_h.m4

index 0a63ba0..c629f0a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2011-09-29  Bruno Haible  <bruno@clisp.org>
 
+       float: Fix LDBL_MAX value on Linux/PowerPC.
+       * m4/float_h.m4 (gl_FLOAT_H): Set FLOAT_H and REPLACE_FLOAT_LDBL also
+       on Linux/PowerPC.
+       * lib/float.in.h (LDBL_MAX): Redefine also on Linux/PowerPC.
+       * lib/float.c (gl_LDBL_MAX): Also define on Linux/PowerPC.
+       * doc/posix-headers/float.texi: Mention Linux/PowerPC as an affected
+       platform.
+       Reported by Andreas Metzler <ametzler@downhill.at.eu.org>.
+
+2011-09-29  Bruno Haible  <bruno@clisp.org>
+
        doc: Improve doc about gl_EARLY.
        * doc/gnulib-tool.texi (Initial import): Mention where to place an
        AC_PROG_CC_STDC invocation.
index c222a23..f2e0e9b 100644 (file)
@@ -14,8 +14,9 @@ On OpenBSD 4.0, MirBSD 10, and BeOS, they are the same as the values of the
 @samp{double}.
 On FreeBSD/x86 6.4, they represent the incorrect 53-bit precision assumptions
 in the compiler, not the real 64-bit precision at runtime.
-On AIX 7.1 with GCC 4.2 and on IRIX 6.5, they don't reflect the
-``double double'' representation of @code{long double} correctly.
+On Linux/PowerPC with GCC 4.4, on AIX 7.1 with GCC 4.2, and on IRIX 6.5,
+they don't reflect the ``double double'' representation of @code{long double}
+correctly.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index c453d6d..b05b40c 100644 (file)
@@ -20,7 +20,7 @@
 /* Specification.  */
 #include <float.h>
 
-#if (defined _ARCH_PPC || defined _POWER) && defined _AIX && (LDBL_MANT_DIG == 106) && defined __GNUC__
+#if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined __linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__
 const union gl_long_double_union gl_LDBL_MAX =
   { { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL } };
 #elif defined __i386__
index 57b7bc9..b132035 100644 (file)
@@ -109,7 +109,8 @@ extern const union gl_long_double_union gl_LDBL_MAX;
 #endif
 
 /* On AIX 7.1 with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_MAX are
-   wrong.  */
+   wrong.
+   On Linux/PowerPC with gcc 4.4, the value of LDBL_MAX is wrong.  */
 #if (defined _ARCH_PPC || defined _POWER) && defined _AIX && (LDBL_MANT_DIG == 106) && defined __GNUC__
 # undef LDBL_MIN_EXP
 # define LDBL_MIN_EXP DBL_MIN_EXP
@@ -117,6 +118,8 @@ extern const union gl_long_double_union gl_LDBL_MAX;
 # define LDBL_MIN_10_EXP DBL_MIN_10_EXP
 # undef LDBL_MIN
 # define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */
+#endif
+#if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined __linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__
 # undef LDBL_MAX
 /* LDBL_MAX is represented as { 0x7FEFFFFF, 0xFFFFFFFF, 0x7C8FFFFF, 0xFFFFFFFF }.
    It is not easy to define:
index 261f1ac..da11c0e 100644 (file)
@@ -1,4 +1,4 @@
-# float_h.m4 serial 7
+# float_h.m4 serial 8
 dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -33,9 +33,16 @@ changequote([,])dnl
           ;;
       esac
       ;;
+    linux*)
+      case "$host_cpu" in
+        powerpc*)
+          FLOAT_H=float.h
+          ;;
+      esac
+      ;;
   esac
   case "$host_os" in
-    aix* | freebsd*)
+    aix* | freebsd* | linux*)
       if test -n "$FLOAT_H"; then
         REPLACE_FLOAT_LDBL=1
       fi