Mercurial > hg > octave-jordi > gnulib-hg
changeset 15799:f1d36de2d2bb
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>.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Fri, 30 Sep 2011 03:56:26 +0200 |
parents | 858def0f1a5f |
children | d79b27b411b7 |
files | ChangeLog doc/posix-headers/float.texi lib/float.c lib/float.in.h m4/float_h.m4 |
diffstat | 5 files changed, 28 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +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.
--- a/doc/posix-headers/float.texi +++ b/doc/posix-headers/float.texi @@ -14,8 +14,9 @@ @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:
--- a/lib/float.c +++ b/lib/float.c @@ -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__
--- a/lib/float.in.h +++ b/lib/float.in.h @@ -109,7 +109,8 @@ #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 @@ # 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:
--- a/m4/float_h.m4 +++ b/m4/float_h.m4 @@ -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 @@ ;; 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