X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fmath.in.h;h=9d73c5e5bb23f7ff3a343e879de24641d6e81275;hb=1276a2c5f24c0c932426aca9c899fa524d2443f2;hp=a479b6d31dc05ac830a9699c3766918a39dd2895;hpb=5f70dcfc4f65198adbce63a01a17f18b1627beee;p=gnulib.git diff --git a/lib/math.in.h b/lib/math.in.h index a479b6d31..9d73c5e5b 100644 --- a/lib/math.in.h +++ b/lib/math.in.h @@ -1,6 +1,6 @@ /* A GNU-like . - Copyright (C) 2002-2003, 2007-2012 Free Software Foundation, Inc. + Copyright (C) 2002-2003, 2007-2014 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 @@ -28,6 +28,13 @@ #ifndef _@GUARD_PREFIX@_MATH_H #define _@GUARD_PREFIX@_MATH_H +#ifndef _GL_INLINE_HEADER_BEGIN + #error "Please include config.h first." +#endif +_GL_INLINE_HEADER_BEGIN +#ifndef _GL_MATH_INLINE +# define _GL_MATH_INLINE _GL_INLINE +#endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ @@ -78,17 +85,17 @@ func (long double 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) \ -static inline int \ +_GL_MATH_INLINE int \ rpl_ ## func ## f (float f) \ { \ return func (f); \ } \ -static inline int \ +_GL_MATH_INLINE int \ rpl_ ## func ## d (double d) \ { \ return func (d); \ } \ -static inline int \ +_GL_MATH_INLINE int \ rpl_ ## func ## l (long double l) \ { \ return func (l); \ @@ -124,7 +131,7 @@ static void (*_gl_math_fix_itold) (long double *, int) = _Qp_itoq; /* The Compaq (ex-DEC) C 6.4 compiler and the Microsoft MSVC 9 compiler choke on the expression 0.0 / 0.0. */ # if defined __DECC || defined _MSC_VER -static float +_GL_MATH_INLINE float _NaN () { static float zero = 0.0f; @@ -179,6 +186,29 @@ _NaN () # endif #endif + +/* Ensure FP_ILOGB0 and FP_ILOGBNAN are defined. */ +#if !(defined FP_ILOGB0 && defined FP_ILOGBNAN) +# if defined __NetBSD__ || defined __sgi + /* NetBSD, IRIX 6.5: match what ilogb() does */ +# define FP_ILOGB0 (- 2147483647 - 1) /* INT_MIN */ +# define FP_ILOGBNAN (- 2147483647 - 1) /* INT_MIN */ +# elif defined _AIX + /* AIX 5.1: match what ilogb() does in AIX >= 5.2 */ +# define FP_ILOGB0 (- 2147483647 - 1) /* INT_MIN */ +# define FP_ILOGBNAN 2147483647 /* INT_MAX */ +# elif defined __sun + /* Solaris 9: match what ilogb() does */ +# define FP_ILOGB0 (- 2147483647) /* - INT_MAX */ +# define FP_ILOGBNAN 2147483647 /* INT_MAX */ +# else + /* Gnulib defined values. */ +# define FP_ILOGB0 (- 2147483647) /* - INT_MAX */ +# define FP_ILOGBNAN (- 2147483647 - 1) /* INT_MIN */ +# endif +#endif + + #if @GNULIB_ACOSF@ # if !@HAVE_ACOSF@ # undef acosf @@ -1064,6 +1094,67 @@ _GL_WARN_ON_USE (hypotl, "hypotl is unportable - " #endif +#if @GNULIB_ILOGBF@ +# if @REPLACE_ILOGBF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef ilogbf +# define ilogbf rpl_ilogbf +# endif +_GL_FUNCDECL_RPL (ilogbf, int, (float x)); +_GL_CXXALIAS_RPL (ilogbf, int, (float x)); +# else +# if !@HAVE_ILOGBF@ +_GL_FUNCDECL_SYS (ilogbf, int, (float x)); +# endif +_GL_CXXALIAS_SYS (ilogbf, int, (float x)); +# endif +_GL_CXXALIASWARN (ilogbf); +#elif defined GNULIB_POSIXCHECK +# undef ilogbf +# if HAVE_RAW_DECL_ILOGBF +_GL_WARN_ON_USE (ilogbf, "ilogbf is unportable - " + "use gnulib module ilogbf for portability"); +# endif +#endif + +#if @GNULIB_ILOGB@ +# if @REPLACE_ILOGB@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef ilogb +# define ilogb rpl_ilogb +# endif +_GL_FUNCDECL_RPL (ilogb, int, (double x)); +_GL_CXXALIAS_RPL (ilogb, int, (double x)); +# else +# if !@HAVE_ILOGB@ +_GL_FUNCDECL_SYS (ilogb, int, (double x)); +# endif +_GL_CXXALIAS_SYS (ilogb, int, (double x)); +# endif +_GL_CXXALIASWARN (ilogb); +#elif defined GNULIB_POSIXCHECK +# undef ilogb +# if HAVE_RAW_DECL_ILOGB +_GL_WARN_ON_USE (ilogb, "ilogb is unportable - " + "use gnulib module ilogb for portability"); +# endif +#endif + +#if @GNULIB_ILOGBL@ +# if !@HAVE_ILOGBL@ +_GL_FUNCDECL_SYS (ilogbl, int, (long double x)); +# endif +_GL_CXXALIAS_SYS (ilogbl, int, (long double x)); +_GL_CXXALIASWARN (ilogbl); +#elif defined GNULIB_POSIXCHECK +# undef ilogbl +# if HAVE_RAW_DECL_ILOGBL +_GL_WARN_ON_USE (ilogbl, "ilogbl is unportable - " + "use gnulib module ilogbl for portability"); +# endif +#endif + + /* Return x * 2^exp. */ #if @GNULIB_LDEXPF@ # if !@HAVE_LDEXPF@ @@ -1108,19 +1199,6 @@ _GL_WARN_ON_USE (ldexpl, "ldexpl is unportable - " #endif -#if @GNULIB_LOGB@ -# if !@HAVE_DECL_LOGB@ -_GL_EXTERN_C double logb (double x); -# endif -#elif defined GNULIB_POSIXCHECK -# undef logb -# if HAVE_RAW_DECL_LOGB -_GL_WARN_ON_USE (logb, "logb is unportable - " - "use gnulib module logb for portability"); -# endif -#endif - - #if @GNULIB_LOGF@ # if @REPLACE_LOGF@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -1191,11 +1269,20 @@ _GL_WARN_ON_USE (logl, "logl is unportable - " #if @GNULIB_LOG10F@ -# if !@HAVE_LOG10F@ -# undef log10f +# if @REPLACE_LOG10F@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef log10f +# define log10f rpl_log10f +# endif +_GL_FUNCDECL_RPL (log10f, float, (float x)); +_GL_CXXALIAS_RPL (log10f, float, (float x)); +# else +# if !@HAVE_LOG10F@ +# undef log10f _GL_FUNCDECL_SYS (log10f, float, (float x)); -# endif +# endif _GL_CXXALIAS_SYS (log10f, float, (float x)); +# endif _GL_CXXALIASWARN (log10f); #elif defined GNULIB_POSIXCHECK # undef log10f @@ -1205,12 +1292,41 @@ _GL_WARN_ON_USE (log10f, "log10f is unportable - " # endif #endif +#if @GNULIB_LOG10@ +# if @REPLACE_LOG10@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef log10 +# define log10 rpl_log10 +# endif +_GL_FUNCDECL_RPL (log10, double, (double x)); +_GL_CXXALIAS_RPL (log10, double, (double x)); +# else +_GL_CXXALIAS_SYS (log10, double, (double x)); +# endif +_GL_CXXALIASWARN (log10); +#elif defined GNULIB_POSIXCHECK +# undef log10 +# if HAVE_RAW_DECL_LOG10 +_GL_WARN_ON_USE (log10, "log10 has portability problems - " + "use gnulib module log10 for portability"); +# endif +#endif + #if @GNULIB_LOG10L@ -# if !@HAVE_LOG10L@ || !@HAVE_DECL_LOG10L@ -# undef log10l +# if @REPLACE_LOG10L@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef log10l +# define log10l rpl_log10l +# endif +_GL_FUNCDECL_RPL (log10l, long double, (long double x)); +_GL_CXXALIAS_RPL (log10l, long double, (long double x)); +# else +# if !@HAVE_LOG10L@ || !@HAVE_DECL_LOG10L@ +# undef log10l _GL_FUNCDECL_SYS (log10l, long double, (long double x)); -# endif +# endif _GL_CXXALIAS_SYS (log10l, long double, (long double x)); +# endif _GL_CXXALIASWARN (log10l); #elif defined GNULIB_POSIXCHECK # undef log10l @@ -1221,11 +1337,43 @@ _GL_WARN_ON_USE (log10l, "log10l is unportable - " #endif +#if @GNULIB_LOG1PF@ +# if @REPLACE_LOG1PF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef log1pf +# define log1pf rpl_log1pf +# endif +_GL_FUNCDECL_RPL (log1pf, float, (float x)); +_GL_CXXALIAS_RPL (log1pf, float, (float x)); +# else +# if !@HAVE_LOG1PF@ +_GL_FUNCDECL_SYS (log1pf, float, (float x)); +# endif +_GL_CXXALIAS_SYS (log1pf, float, (float x)); +# endif +_GL_CXXALIASWARN (log1pf); +#elif defined GNULIB_POSIXCHECK +# undef log1pf +# if HAVE_RAW_DECL_LOG1PF +_GL_WARN_ON_USE (log1pf, "log1pf is unportable - " + "use gnulib module log1pf for portability"); +# endif +#endif + #if @GNULIB_LOG1P@ -# if !@HAVE_LOG1P@ +# if @REPLACE_LOG1P@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef log1p +# define log1p rpl_log1p +# endif +_GL_FUNCDECL_RPL (log1p, double, (double x)); +_GL_CXXALIAS_RPL (log1p, double, (double x)); +# else +# if !@HAVE_LOG1P@ _GL_FUNCDECL_SYS (log1p, double, (double x)); -# endif +# endif _GL_CXXALIAS_SYS (log1p, double, (double x)); +# endif _GL_CXXALIASWARN (log1p); #elif defined GNULIB_POSIXCHECK # undef log1p @@ -1235,6 +1383,171 @@ _GL_WARN_ON_USE (log1p, "log1p has portability problems - " # endif #endif +#if @GNULIB_LOG1PL@ +# if @REPLACE_LOG1PL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef log1pl +# define log1pl rpl_log1pl +# endif +_GL_FUNCDECL_RPL (log1pl, long double, (long double x)); +_GL_CXXALIAS_RPL (log1pl, long double, (long double x)); +# else +# if !@HAVE_LOG1PL@ +_GL_FUNCDECL_SYS (log1pl, long double, (long double x)); +# endif +_GL_CXXALIAS_SYS (log1pl, long double, (long double x)); +# endif +_GL_CXXALIASWARN (log1pl); +#elif defined GNULIB_POSIXCHECK +# undef log1pl +# if HAVE_RAW_DECL_LOG1PL +_GL_WARN_ON_USE (log1pl, "log1pl has portability problems - " + "use gnulib module log1pl for portability"); +# endif +#endif + + +#if @GNULIB_LOG2F@ +# if @REPLACE_LOG2F@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef log2f +# define log2f rpl_log2f +# endif +_GL_FUNCDECL_RPL (log2f, float, (float x)); +_GL_CXXALIAS_RPL (log2f, float, (float x)); +# else +# if !@HAVE_DECL_LOG2F@ +# undef log2f +_GL_FUNCDECL_SYS (log2f, float, (float x)); +# endif +_GL_CXXALIAS_SYS (log2f, float, (float x)); +# endif +_GL_CXXALIASWARN (log2f); +#elif defined GNULIB_POSIXCHECK +# undef log2f +# if HAVE_RAW_DECL_LOG2F +_GL_WARN_ON_USE (log2f, "log2f is unportable - " + "use gnulib module log2f for portability"); +# endif +#endif + +#if @GNULIB_LOG2@ +# if @REPLACE_LOG2@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef log2 +# define log2 rpl_log2 +# endif +_GL_FUNCDECL_RPL (log2, double, (double x)); +_GL_CXXALIAS_RPL (log2, double, (double x)); +# else +# if !@HAVE_DECL_LOG2@ +# undef log2 +_GL_FUNCDECL_SYS (log2, double, (double x)); +# endif +_GL_CXXALIAS_SYS (log2, double, (double x)); +# endif +_GL_CXXALIASWARN (log2); +#elif defined GNULIB_POSIXCHECK +# undef log2 +# if HAVE_RAW_DECL_LOG2 +_GL_WARN_ON_USE (log2, "log2 is unportable - " + "use gnulib module log2 for portability"); +# endif +#endif + +#if @GNULIB_LOG2L@ +# if @REPLACE_LOG2L@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef log2l +# define log2l rpl_log2l +# endif +_GL_FUNCDECL_RPL (log2l, long double, (long double x)); +_GL_CXXALIAS_RPL (log2l, long double, (long double x)); +# else +# if !@HAVE_DECL_LOG2L@ +_GL_FUNCDECL_SYS (log2l, long double, (long double x)); +# endif +_GL_CXXALIAS_SYS (log2l, long double, (long double x)); +# endif +_GL_CXXALIASWARN (log2l); +#elif defined GNULIB_POSIXCHECK +# undef log2l +# if HAVE_RAW_DECL_LOG2L +_GL_WARN_ON_USE (log2l, "log2l is unportable - " + "use gnulib module log2l for portability"); +# endif +#endif + + +#if @GNULIB_LOGBF@ +# if @REPLACE_LOGBF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef logbf +# define logbf rpl_logbf +# endif +_GL_FUNCDECL_RPL (logbf, float, (float x)); +_GL_CXXALIAS_RPL (logbf, float, (float x)); +# else +# if !@HAVE_LOGBF@ +_GL_FUNCDECL_SYS (logbf, float, (float x)); +# endif +_GL_CXXALIAS_SYS (logbf, float, (float x)); +# endif +_GL_CXXALIASWARN (logbf); +#elif defined GNULIB_POSIXCHECK +# undef logbf +# if HAVE_RAW_DECL_LOGBF +_GL_WARN_ON_USE (logbf, "logbf is unportable - " + "use gnulib module logbf for portability"); +# endif +#endif + +#if @GNULIB_LOGB@ +# if @REPLACE_LOGB@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef logb +# define logb rpl_logb +# endif +_GL_FUNCDECL_RPL (logb, double, (double x)); +_GL_CXXALIAS_RPL (logb, double, (double x)); +# else +# if !@HAVE_DECL_LOGB@ +_GL_FUNCDECL_SYS (logb, double, (double x)); +# endif +_GL_CXXALIAS_SYS (logb, double, (double x)); +# endif +_GL_CXXALIASWARN (logb); +#elif defined GNULIB_POSIXCHECK +# undef logb +# if HAVE_RAW_DECL_LOGB +_GL_WARN_ON_USE (logb, "logb is unportable - " + "use gnulib module logb for portability"); +# endif +#endif + +#if @GNULIB_LOGBL@ +# if @REPLACE_LOGBL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef logbl +# define logbl rpl_logbl +# endif +_GL_FUNCDECL_RPL (logbl, long double, (long double x)); +_GL_CXXALIAS_RPL (logbl, long double, (long double x)); +# else +# if !@HAVE_LOGBL@ +_GL_FUNCDECL_SYS (logbl, long double, (long double x)); +# endif +_GL_CXXALIAS_SYS (logbl, long double, (long double x)); +# endif +_GL_CXXALIASWARN (logbl); +#elif defined GNULIB_POSIXCHECK +# undef logbl +# if HAVE_RAW_DECL_LOGBL +_GL_WARN_ON_USE (logbl, "logbl is unportable - " + "use gnulib module logbl for portability"); +# endif +#endif + #if @GNULIB_MODFF@ # if @REPLACE_MODFF@ @@ -1379,6 +1692,7 @@ _GL_FUNCDECL_RPL (remainderl, long double, (long double x, long double y)); _GL_CXXALIAS_RPL (remainderl, long double, (long double x, long double y)); # else # if !@HAVE_DECL_REMAINDERL@ +# undef remainderl _GL_FUNCDECL_SYS (remainderl, long double, (long double x, long double y)); # endif _GL_CXXALIAS_SYS (remainderl, long double, (long double x, long double y)); @@ -1570,11 +1884,20 @@ _GL_WARN_ON_USE (sqrtf, "sqrtf is unportable - " #endif #if @GNULIB_SQRTL@ -# if !@HAVE_SQRTL@ || !@HAVE_DECL_SQRTL@ -# undef sqrtl +# if @REPLACE_SQRTL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef sqrtl +# define sqrtl rpl_sqrtl +# endif +_GL_FUNCDECL_RPL (sqrtl, long double, (long double x)); +_GL_CXXALIAS_RPL (sqrtl, long double, (long double x)); +# else +# if !@HAVE_SQRTL@ || !@HAVE_DECL_SQRTL@ +# undef sqrtl _GL_FUNCDECL_SYS (sqrtl, long double, (long double x)); -# endif +# endif _GL_CXXALIAS_SYS (sqrtl, long double, (long double x)); +# endif _GL_CXXALIASWARN (sqrtl); #elif defined GNULIB_POSIXCHECK # undef sqrtl @@ -1949,6 +2272,7 @@ _GL_WARN_REAL_FLOATING_DECL (signbit); # endif #endif +_GL_INLINE_HEADER_END #endif /* _@GUARD_PREFIX@_MATH_H */ #endif /* _@GUARD_PREFIX@_MATH_H */