/* A GNU-like <math.h>.
- Copyright (C) 2002-2003, 2007-2016 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 2007-2020 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _@GUARD_PREFIX@_MATH_H
#ifndef _@GUARD_PREFIX@_MATH_H
#define _@GUARD_PREFIX@_MATH_H
+/* On OpenVMS, NAN, INFINITY, and HUGEVAL macros are defined in <fp.h>. */
+#if defined __VMS && ! defined NAN
+# include <fp.h>
+#endif
+
#ifndef _GL_INLINE_HEADER_BEGIN
#error "Please include config.h first."
#endif
{ \
return func (l); \
}
-# define _GL_MATH_CXX_REAL_FLOATING_DECL_2(func) \
+# define _GL_MATH_CXX_REAL_FLOATING_DECL_2(func,rpl_func,rettype) \
_GL_BEGIN_NAMESPACE \
-inline int \
-func (float f) \
+inline rettype \
+rpl_func (float f) \
{ \
return _gl_cxx_ ## func ## f (f); \
} \
-inline int \
-func (double d) \
+inline rettype \
+rpl_func (double d) \
{ \
return _gl_cxx_ ## func ## d (d); \
} \
-inline int \
-func (long double l) \
+inline rettype \
+rpl_func (long double l) \
{ \
return _gl_cxx_ ## func ## l (l); \
} \
classification macros with an argument of real-floating (that is,
one of float, double, or long double). */
#define _GL_WARN_REAL_FLOATING_DECL(func) \
-_GL_MATH_INLINE int \
-rpl_ ## func ## f (float f) \
-{ \
- return func (f); \
-} \
-_GL_MATH_INLINE int \
-rpl_ ## func ## d (double d) \
-{ \
- return func (d); \
-} \
-_GL_MATH_INLINE int \
-rpl_ ## func ## l (long double l) \
-{ \
- return func (l); \
-} \
-_GL_WARN_ON_USE (rpl_ ## func ## f, #func " is unportable - " \
- "use gnulib module " #func " for portability"); \
-_GL_WARN_ON_USE (rpl_ ## func ## d, #func " is unportable - " \
- "use gnulib module " #func " for portability"); \
-_GL_WARN_ON_USE (rpl_ ## func ## l, #func " is unportable - " \
- "use gnulib module " #func " for portability")
+_GL_MATH_INLINE int \
+_GL_WARN_ON_USE_ATTRIBUTE (#func " is unportable - " \
+ "use gnulib module " #func " for portability") \
+rpl_ ## func ## f (float f) \
+{ \
+ return func (f); \
+} \
+_GL_MATH_INLINE int \
+_GL_WARN_ON_USE_ATTRIBUTE (#func " is unportable - " \
+ "use gnulib module " #func " for portability") \
+rpl_ ## func ## d (double d) \
+{ \
+ return func (d); \
+} \
+_GL_MATH_INLINE int \
+_GL_WARN_ON_USE_ATTRIBUTE (#func " is unportable - " \
+ "use gnulib module " #func " for portability") \
+rpl_ ## func ## l (long double l) \
+{ \
+ return func (l); \
+}
#define _GL_WARN_REAL_FLOATING_IMPL(func, value) \
(sizeof (value) == sizeof (float) ? rpl_ ## func ## f (value) \
: sizeof (value) == sizeof (double) ? rpl_ ## func ## d (value) \
#endif
-/* Ensure FP_ILOGB0 and FP_ILOGBNAN are defined. */
-#if !(defined FP_ILOGB0 && defined FP_ILOGBNAN)
+#if defined FP_ILOGB0 && defined FP_ILOGBNAN
+ /* Ensure FP_ILOGB0 and FP_ILOGBNAN are correct. */
+# if defined __HAIKU__
+ /* Haiku: match what ilogb() does */
+# undef FP_ILOGB0
+# undef FP_ILOGBNAN
+# define FP_ILOGB0 (- 2147483647 - 1) /* INT_MIN */
+# define FP_ILOGBNAN (- 2147483647 - 1) /* INT_MIN */
+# endif
+#else
+ /* Ensure FP_ILOGB0 and FP_ILOGBNAN are defined. */
# if defined __NetBSD__ || defined __sgi
/* NetBSD, IRIX 6.5: match what ilogb() does */
# define FP_ILOGB0 (- 2147483647 - 1) /* INT_MIN */
#if @GNULIB_ACOSF@
-# if !@HAVE_ACOSF@
-# undef acosf
+# if @REPLACE_ACOSF@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef acosf
+# define acosf rpl_acosf
+# endif
+_GL_FUNCDECL_RPL (acosf, float, (float x));
+_GL_CXXALIAS_RPL (acosf, float, (float x));
+# else
+# if !@HAVE_ACOSF@
+# undef acosf
_GL_FUNCDECL_SYS (acosf, float, (float x));
-# endif
+# endif
_GL_CXXALIAS_SYS (acosf, float, (float x));
+# endif
_GL_CXXALIASWARN (acosf);
#elif defined GNULIB_POSIXCHECK
# undef acosf
#if @GNULIB_ASINF@
-# if !@HAVE_ASINF@
-# undef asinf
+# if @REPLACE_ASINF@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef asinf
+# define asinf rpl_asinf
+# endif
+_GL_FUNCDECL_RPL (asinf, float, (float x));
+_GL_CXXALIAS_RPL (asinf, float, (float x));
+# else
+# if !@HAVE_ASINF@
+# undef asinf
_GL_FUNCDECL_SYS (asinf, float, (float x));
-# endif
+# endif
_GL_CXXALIAS_SYS (asinf, float, (float x));
+# endif
_GL_CXXALIASWARN (asinf);
#elif defined GNULIB_POSIXCHECK
# undef asinf
#if @GNULIB_ATANF@
-# if !@HAVE_ATANF@
-# undef atanf
+# if @REPLACE_ATANF@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef atanf
+# define atanf rpl_atanf
+# endif
+_GL_FUNCDECL_RPL (atanf, float, (float x));
+_GL_CXXALIAS_RPL (atanf, float, (float x));
+# else
+# if !@HAVE_ATANF@
+# undef atanf
_GL_FUNCDECL_SYS (atanf, float, (float x));
-# endif
+# endif
_GL_CXXALIAS_SYS (atanf, float, (float x));
+# endif
_GL_CXXALIASWARN (atanf);
#elif defined GNULIB_POSIXCHECK
# undef atanf
#if @GNULIB_ATAN2F@
-# if !@HAVE_ATAN2F@
-# undef atan2f
+# if @REPLACE_ATAN2F@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef atan2f
+# define atan2f rpl_atan2f
+# endif
+_GL_FUNCDECL_RPL (atan2f, float, (float y, float x));
+_GL_CXXALIAS_RPL (atan2f, float, (float y, float x));
+# else
+# if !@HAVE_ATAN2F@
+# undef atan2f
_GL_FUNCDECL_SYS (atan2f, float, (float y, float x));
-# endif
+# endif
_GL_CXXALIAS_SYS (atan2f, float, (float y, float x));
+# endif
_GL_CXXALIASWARN (atan2f);
#elif defined GNULIB_POSIXCHECK
# undef atan2f
_GL_FUNCDECL_SYS (cbrt, double, (double x));
# endif
_GL_CXXALIAS_SYS (cbrt, double, (double x));
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (cbrt);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef cbrt
# if HAVE_RAW_DECL_CBRT
# else
_GL_CXXALIAS_SYS (ceil, double, (double x));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (ceil);
+# endif
#endif
#if @GNULIB_CEILL@
#if @GNULIB_COPYSIGNF@
# if !@HAVE_DECL_COPYSIGNF@
+# undef copysignf
_GL_FUNCDECL_SYS (copysignf, float, (float x, float y));
# endif
_GL_CXXALIAS_SYS (copysignf, float, (float x, float y));
_GL_FUNCDECL_SYS (copysign, double, (double x, double y));
# endif
_GL_CXXALIAS_SYS (copysign, double, (double x, double y));
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (copysign);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef copysign
# if HAVE_RAW_DECL_COPYSIGN
#if @GNULIB_COSF@
-# if !@HAVE_COSF@
-# undef cosf
+# if @REPLACE_COSF@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef cosf
+# define cosf rpl_cosf
+# endif
+_GL_FUNCDECL_RPL (cosf, float, (float x));
+_GL_CXXALIAS_RPL (cosf, float, (float x));
+# else
+# if !@HAVE_COSF@
+# undef cosf
_GL_FUNCDECL_SYS (cosf, float, (float x));
-# endif
+# endif
_GL_CXXALIAS_SYS (cosf, float, (float x));
+# endif
_GL_CXXALIASWARN (cosf);
#elif defined GNULIB_POSIXCHECK
# undef cosf
#if @GNULIB_COSHF@
-# if !@HAVE_COSHF@
-# undef coshf
+# if @REPLACE_COSHF@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef coshf
+# define coshf rpl_coshf
+# endif
+_GL_FUNCDECL_RPL (coshf, float, (float x));
+_GL_CXXALIAS_RPL (coshf, float, (float x));
+# else
+# if !@HAVE_COSHF@
+# undef coshf
_GL_FUNCDECL_SYS (coshf, float, (float x));
-# endif
+# endif
_GL_CXXALIAS_SYS (coshf, float, (float x));
+# endif
_GL_CXXALIASWARN (coshf);
#elif defined GNULIB_POSIXCHECK
# undef coshf
#if @GNULIB_EXPF@
-# if !@HAVE_EXPF@
-# undef expf
+# if @REPLACE_EXPF@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef expf
+# define expf rpl_expf
+# endif
+_GL_FUNCDECL_RPL (expf, float, (float x));
+_GL_CXXALIAS_RPL (expf, float, (float x));
+# else
+# if !@HAVE_EXPF@
+# undef expf
_GL_FUNCDECL_SYS (expf, float, (float x));
-# endif
+# endif
_GL_CXXALIAS_SYS (expf, float, (float x));
+# endif
_GL_CXXALIASWARN (expf);
#elif defined GNULIB_POSIXCHECK
# undef expf
#endif
#if @GNULIB_EXPL@
-# if !@HAVE_EXPL@ || !@HAVE_DECL_EXPL@
-# undef expl
+# if @REPLACE_EXPL@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef expl
+# define expl rpl_expl
+# endif
+_GL_FUNCDECL_RPL (expl, long double, (long double x));
+_GL_CXXALIAS_RPL (expl, long double, (long double x));
+# else
+# if !@HAVE_EXPL@ || !@HAVE_DECL_EXPL@
+# undef expl
_GL_FUNCDECL_SYS (expl, long double, (long double x));
-# endif
+# endif
_GL_CXXALIAS_SYS (expl, long double, (long double x));
+# endif
_GL_CXXALIASWARN (expl);
#elif defined GNULIB_POSIXCHECK
# undef expl
# endif
_GL_CXXALIAS_SYS (exp2, double, (double x));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (exp2);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef exp2
# if HAVE_RAW_DECL_EXP2
# endif
_GL_CXXALIAS_SYS (expm1, double, (double x));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (expm1);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef expm1
# if HAVE_RAW_DECL_EXPM1
#endif
#if @GNULIB_EXPM1L@
-# if !@HAVE_DECL_EXPM1L@
-# undef expm1l
+# if @REPLACE_EXPM1L@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef expm1l
+# define expm1l rpl_expm1l
+# endif
+_GL_FUNCDECL_RPL (expm1l, long double, (long double x));
+_GL_CXXALIAS_RPL (expm1l, long double, (long double x));
+# else
+# if !@HAVE_DECL_EXPM1L@
+# undef expm1l
+# if !(defined __cplusplus && defined _AIX)
_GL_FUNCDECL_SYS (expm1l, long double, (long double x));
-# endif
+# endif
+# endif
_GL_CXXALIAS_SYS (expm1l, long double, (long double x));
+# endif
_GL_CXXALIASWARN (expm1l);
#elif defined GNULIB_POSIXCHECK
# undef expm1l
# else
_GL_CXXALIAS_SYS (floor, double, (double x));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (floor);
+# endif
#endif
#if @GNULIB_FLOORL@
_GL_CXXALIAS_RPL (fmaf, float, (float x, float y, float z));
# else
# if !@HAVE_FMAF@
+# undef fmaf
_GL_FUNCDECL_SYS (fmaf, float, (float x, float y, float z));
# endif
_GL_CXXALIAS_SYS (fmaf, float, (float x, float y, float z));
_GL_CXXALIAS_RPL (fma, double, (double x, double y, double z));
# else
# if !@HAVE_FMA@
+# undef fma
_GL_FUNCDECL_SYS (fma, double, (double x, double y, double z));
# endif
_GL_CXXALIAS_SYS (fma, double, (double x, double y, double z));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (fma);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef fma
# if HAVE_RAW_DECL_FMA
# else
# if !@HAVE_FMAL@
# undef fmal
+# if !(defined __cplusplus && defined _AIX)
_GL_FUNCDECL_SYS (fmal, long double,
(long double x, long double y, long double z));
+# endif
# endif
_GL_CXXALIAS_SYS (fmal, long double,
(long double x, long double y, long double z));
# else
_GL_CXXALIAS_SYS (fmod, double, (double x, double y));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (fmod);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef fmod
# if HAVE_RAW_DECL_FMOD
# else
_GL_CXXALIAS_SYS (frexp, double, (double x, int *expptr));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN1 (frexp, double, (double x, int *expptr));
+# endif
#elif defined GNULIB_POSIXCHECK
# undef frexp
/* Assume frexp is always declared. */
# else
_GL_CXXALIAS_SYS (hypot, double, (double x, double y));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (hypot);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef hypot
# if HAVE_RAW_DECL_HYPOT
# endif
_GL_CXXALIAS_SYS (ilogb, int, (double x));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (ilogb);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef ilogb
# if HAVE_RAW_DECL_ILOGB
#endif
#if @GNULIB_ILOGBL@
-# if !@HAVE_ILOGBL@
+# if @REPLACE_ILOGBL@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef ilogbl
+# define ilogbl rpl_ilogbl
+# endif
+_GL_FUNCDECL_RPL (ilogbl, int, (long double x));
+_GL_CXXALIAS_RPL (ilogbl, int, (long double x));
+# else
+# if !@HAVE_ILOGBL@
_GL_FUNCDECL_SYS (ilogbl, int, (long double x));
-# endif
+# endif
_GL_CXXALIAS_SYS (ilogbl, int, (long double x));
+# endif
_GL_CXXALIASWARN (ilogbl);
#elif defined GNULIB_POSIXCHECK
# undef ilogbl
# else
_GL_CXXALIAS_SYS (log, double, (double x));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (log);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef log
# if HAVE_RAW_DECL_LOG
# else
_GL_CXXALIAS_SYS (log10, double, (double x));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (log10);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef log10
# if HAVE_RAW_DECL_LOG10
# endif
_GL_CXXALIAS_SYS (log1p, double, (double x));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (log1p);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef log1p
# if HAVE_RAW_DECL_LOG1P
# endif
_GL_CXXALIAS_SYS (log2, double, (double x));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (log2);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef log2
# if HAVE_RAW_DECL_LOG2
# endif
_GL_CXXALIAS_SYS (logb, double, (double x));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (logb);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef logb
# if HAVE_RAW_DECL_LOGB
# else
_GL_CXXALIAS_SYS (modf, double, (double x, double *iptr));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (modf);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef modf
# if HAVE_RAW_DECL_MODF
# endif
_GL_CXXALIAS_SYS (remainder, double, (double x, double y));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (remainder);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef remainder
# if HAVE_RAW_DECL_REMAINDER
# else
# if !@HAVE_DECL_REMAINDERL@
# undef remainderl
+# if !(defined __cplusplus && defined _AIX)
_GL_FUNCDECL_SYS (remainderl, long double, (long double x, long double y));
+# endif
# endif
_GL_CXXALIAS_SYS (remainderl, long double, (long double x, long double y));
# endif
_GL_FUNCDECL_SYS (rint, double, (double x));
# endif
_GL_CXXALIAS_SYS (rint, double, (double x));
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (rint);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef rint
# if HAVE_RAW_DECL_RINT
#endif
#if @GNULIB_RINTL@
-# if !@HAVE_RINTL@
+# if @REPLACE_RINTL@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef rintl
+# define rintl rpl_rintl
+# endif
+_GL_FUNCDECL_RPL (rintl, long double, (long double x));
+_GL_CXXALIAS_RPL (rintl, long double, (long double x));
+# else
+# if !@HAVE_RINTL@
_GL_FUNCDECL_SYS (rintl, long double, (long double x));
-# endif
+# endif
_GL_CXXALIAS_SYS (rintl, long double, (long double x));
+# endif
_GL_CXXALIASWARN (rintl);
#elif defined GNULIB_POSIXCHECK
# undef rintl
# endif
_GL_CXXALIAS_SYS (round, double, (double x));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (round);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef round
# if HAVE_RAW_DECL_ROUND
# else
# if !@HAVE_DECL_ROUNDL@
# undef roundl
+# if !(defined __cplusplus && defined _AIX)
_GL_FUNCDECL_SYS (roundl, long double, (long double x));
+# endif
# endif
_GL_CXXALIAS_SYS (roundl, long double, (long double x));
# endif
#if @GNULIB_SINF@
-# if !@HAVE_SINF@
-# undef sinf
+# if @REPLACE_SINF@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef sinf
+# define sinf rpl_sinf
+# endif
+_GL_FUNCDECL_RPL (sinf, float, (float x));
+_GL_CXXALIAS_RPL (sinf, float, (float x));
+# else
+# if !@HAVE_SINF@
+ # undef sinf
_GL_FUNCDECL_SYS (sinf, float, (float x));
-# endif
+# endif
_GL_CXXALIAS_SYS (sinf, float, (float x));
+# endif
_GL_CXXALIASWARN (sinf);
#elif defined GNULIB_POSIXCHECK
# undef sinf
#if @GNULIB_SINHF@
-# if !@HAVE_SINHF@
-# undef sinhf
+# if @REPLACE_SINHF@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef sinhf
+# define sinhf rpl_sinhf
+# endif
+_GL_FUNCDECL_RPL (sinhf, float, (float x));
+_GL_CXXALIAS_RPL (sinhf, float, (float x));
+# else
+# if !@HAVE_SINHF@
+# undef sinhf
_GL_FUNCDECL_SYS (sinhf, float, (float x));
-# endif
+# endif
_GL_CXXALIAS_SYS (sinhf, float, (float x));
+# endif
_GL_CXXALIASWARN (sinhf);
#elif defined GNULIB_POSIXCHECK
# undef sinhf
#if @GNULIB_SQRTF@
-# if !@HAVE_SQRTF@
-# undef sqrtf
+# if @REPLACE_SQRTF@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef sqrtf
+# define sqrtf rpl_sqrtf
+# endif
+_GL_FUNCDECL_RPL (sqrtf, float, (float x));
+_GL_CXXALIAS_RPL (sqrtf, float, (float x));
+# else
+# if !@HAVE_SQRTF@
+# undef sqrtf
_GL_FUNCDECL_SYS (sqrtf, float, (float x));
-# endif
+# endif
_GL_CXXALIAS_SYS (sqrtf, float, (float x));
+# endif
_GL_CXXALIASWARN (sqrtf);
#elif defined GNULIB_POSIXCHECK
# undef sqrtf
#if @GNULIB_TANF@
-# if !@HAVE_TANF@
-# undef tanf
+# if @REPLACE_TANF@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef tanf
+# define tanf rpl_tanf
+# endif
+_GL_FUNCDECL_RPL (tanf, float, (float x));
+_GL_CXXALIAS_RPL (tanf, float, (float x));
+# else
+# if !@HAVE_TANF@
+# undef tanf
_GL_FUNCDECL_SYS (tanf, float, (float x));
-# endif
+# endif
_GL_CXXALIAS_SYS (tanf, float, (float x));
+# endif
_GL_CXXALIASWARN (tanf);
#elif defined GNULIB_POSIXCHECK
# undef tanf
#if @GNULIB_TANHF@
-# if !@HAVE_TANHF@
-# undef tanhf
+# if @REPLACE_TANHF@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef tanhf
+# define tanhf rpl_tanhf
+# endif
+_GL_FUNCDECL_RPL (tanhf, float, (float x));
+_GL_CXXALIAS_RPL (tanhf, float, (float x));
+# else
+# if !@HAVE_TANHF@
+# undef tanhf
_GL_FUNCDECL_SYS (tanhf, float, (float x));
-# endif
+# endif
_GL_CXXALIAS_SYS (tanhf, float, (float x));
+# endif
_GL_CXXALIASWARN (tanhf);
#elif defined GNULIB_POSIXCHECK
# undef tanhf
# endif
_GL_CXXALIAS_SYS (trunc, double, (double x));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (trunc);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef trunc
# if HAVE_RAW_DECL_TRUNC
# if defined isfinite || defined GNULIB_NAMESPACE
_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isfinite)
# undef isfinite
-_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite)
+# if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined _AIX))
+ /* This platform's <cmath> possibly defines isfinite through a set of inline
+ functions. */
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite, rpl_isfinite, bool)
+# define isfinite rpl_isfinite
+# else
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite, isfinite, bool)
+# endif
# endif
# endif
#elif defined GNULIB_POSIXCHECK
# if defined isinf || defined GNULIB_NAMESPACE
_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isinf)
# undef isinf
-_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isinf)
+# if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__))
+ /* This platform's <cmath> possibly defines isinf through a set of inline
+ functions. */
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isinf, rpl_isinf, bool)
+# define isinf rpl_isinf
+# else
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isinf, isinf, bool)
+# endif
# endif
# endif
#elif defined GNULIB_POSIXCHECK
# if defined isnan || defined GNULIB_NAMESPACE
_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan)
# undef isnan
-_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan)
+# if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__))
+ /* This platform's <cmath> possibly defines isnan through a set of inline
+ functions. */
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, rpl_isnan, bool)
+# define isnan rpl_isnan
+# else
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, isnan, bool)
+# endif
# endif
# else
/* Ensure isnan is a macro. */
sizeof (x) == sizeof (double) ? __builtin_signbit (x) : \
__builtin_signbitf (x))
# endif
-# if @REPLACE_SIGNBIT@
+# if @REPLACE_SIGNBIT@ && !GNULIB_defined_signbit
# undef signbit
_GL_EXTERN_C int gl_signbitf (float arg);
_GL_EXTERN_C int gl_signbitd (double arg);
(sizeof (x) == sizeof (long double) ? gl_signbitl (x) : \
sizeof (x) == sizeof (double) ? gl_signbitd (x) : \
gl_signbitf (x))
+# define GNULIB_defined_signbit 1
# endif
# ifdef __cplusplus
# if defined signbit || defined GNULIB_NAMESPACE
_GL_MATH_CXX_REAL_FLOATING_DECL_1 (signbit)
# undef signbit
-_GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit)
+# if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined _AIX))
+ /* This platform's <cmath> possibly defines signbit through a set of inline
+ functions. */
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit, rpl_signbit, bool)
+# define signbit rpl_signbit
+# else
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit, signbit, bool)
+# endif
# endif
# endif
#elif defined GNULIB_POSIXCHECK