From 32944e37e8920120354fb459317c5d14b590039b Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 8 Aug 2024 03:21:34 +0200 Subject: [PATCH] math: Fix INFINITY and NAN on mingw. * doc/posix-headers/math.texi: Mention this mingw bug. * lib/math.in.h (INFINITY, NAN): Replace also on mingw. --- ChangeLog | 6 ++++++ doc/posix-headers/math.texi | 2 +- lib/math.in.h | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 380874aa2d..1eb55af770 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2024-08-07 Bruno Haible + + math: Fix INFINITY and NAN on mingw. + * doc/posix-headers/math.texi: Mention this mingw bug. + * lib/math.in.h (INFINITY, NAN): Replace also on mingw. + 2024-08-07 Bruno Haible doc: Update for OpenBSD 7.5. diff --git a/doc/posix-headers/math.texi b/doc/posix-headers/math.texi index 6f07b1e58c..fb72b94a08 100644 --- a/doc/posix-headers/math.texi +++ b/doc/posix-headers/math.texi @@ -55,7 +55,7 @@ FreeBSD 5.2, AIX 7.1. @item @code{INFINITY} and @code{NAN} are of type @code{double} instead of @code{float} on some platforms: -FreeBSD 7.1. +FreeBSD 7.1, mingw 5.0. @item The macros @code{NAN}, @code{HUGE_VALL}, and @code{INFINITY} are not diff --git a/lib/math.in.h b/lib/math.in.h index 7b1302d883..2fcba31c76 100644 --- a/lib/math.in.h +++ b/lib/math.in.h @@ -161,7 +161,7 @@ static void (*_gl_math_fix_itold) (long double *, int) = _Qp_itoq; /* Ensure that INFINITY is a constant expression, of type 'float'. */ -#if !defined INFINITY || (defined __FreeBSD__ && __FreeBSD__ < 8) || defined _AIX +#if !defined INFINITY || (defined __FreeBSD__ && __FreeBSD__ < 8) || defined _AIX || defined __MINGW32__ # undef INFINITY # if defined __GNUC__ || defined __clang__ # define INFINITY (__builtin_inff ()) @@ -176,7 +176,7 @@ static void (*_gl_math_fix_itold) (long double *, int) = _Qp_itoq; it on platforms like Solaris 10, where NAN is present but defined as a function pointer rather than a floating point constant. Also ensure that it is a constant expression, of type 'float'. */ -#if !defined NAN || @REPLACE_NAN@ || (defined __FreeBSD__ && __FreeBSD__ < 8) || defined _AIX +#if !defined NAN || @REPLACE_NAN@ || (defined __FreeBSD__ && __FreeBSD__ < 8) || defined _AIX || defined __MINGW32__ # if !GNULIB_defined_NAN # undef NAN /* The Compaq (ex-DEC) C 6.4 compiler and the Microsoft MSVC 9 compiler -- 2.39.5