bug-gnulib
[Top][All Lists]
Advanced

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

Re: math: Fix INFINITY and NAN on FreeBSD and AIX


From: Bruno Haible
Subject: Re: math: Fix INFINITY and NAN on FreeBSD and AIX
Date: Tue, 06 Aug 2024 01:06:53 +0200

Another workaround is needed on AIX, to fix these compilation errors:

With gcc:
../../gltests/test-math.c:68:13: error: initializer element is not constant
 double hd = HUGE_VAL;
             ^~~~~~~~
../../gltests/test-math.c:71:18: error: initializer element is not constant
 long double hl = HUGE_VALL;
                  ^~~~~~~~~

With xlc:
"../../gltests/test-math.c", line 68.13: 1506-221 (S) Initializer must be a 
valid constant expression.
"../../gltests/test-math.c", line 71.18: 1506-221 (S) Initializer must be a 
valid constant expression.


2024-08-05  Bruno Haible  <bruno@clisp.org>

        math: Fix HUGE_VAL and HUGE_VALL on AIX.
        * lib/math.in.h (HUGE_VAL, HUGE_VALL): Override on AIX.
        * doc/posix-headers/math.texi: Mention this AIX problem.

diff --git a/doc/posix-headers/math.texi b/doc/posix-headers/math.texi
index 92b4d1b172..6f07b1e58c 100644
--- a/doc/posix-headers/math.texi
+++ b/doc/posix-headers/math.texi
@@ -45,7 +45,7 @@
 @item
 @code{HUGE_VAL}, @code{HUGE_VALF}, @code{HUGE_VALL} are not compile time
 constants on some platforms:
-FreeBSD 5.2.
+FreeBSD 5.2, AIX 7.1.
 
 @item
 @code{INFINITY} and @code{NAN} are not compile time constants
diff --git a/lib/math.in.h b/lib/math.in.h
index 7730efb7f5..7b1302d883 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -223,7 +223,7 @@ _NaN ()
 #endif
 
 /* HUGE_VAL is a 'double' Infinity.  */
-#if !defined HUGE_VAL || (defined __FreeBSD__ && __FreeBSD__ < 6)
+#if !defined HUGE_VAL || (defined __FreeBSD__ && __FreeBSD__ < 6) || defined 
_AIX
 # undef HUGE_VAL
 # if defined _MSC_VER
 /* The Microsoft MSVC 9 compiler chokes on the expression 1.0 / 0.0.  */
@@ -236,7 +236,7 @@ _NaN ()
 #endif
 
 /* HUGE_VALL is a 'long double' Infinity.  */
-#if !defined HUGE_VALL || (defined __FreeBSD__ && __FreeBSD__ < 6)
+#if !defined HUGE_VALL || (defined __FreeBSD__ && __FreeBSD__ < 6) || defined 
_AIX
 # undef HUGE_VALL
 # if defined _MSC_VER
 /* The Microsoft MSVC 9 compiler chokes on the expression 1.0L / 0.0L.  */






reply via email to

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