X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fmath.in.h;h=9d73c5e5bb23f7ff3a343e879de24641d6e81275;hb=1276a2c5f24c0c932426aca9c899fa524d2443f2;hp=40983a96404cc191d391c487a81a2bfbcde705af;hpb=77e408383e7944caaf77cb068e670238aa7ee905;p=gnulib.git diff --git a/lib/math.in.h b/lib/math.in.h index 40983a964..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@ @@ -1388,6 +1479,29 @@ _GL_WARN_ON_USE (log2l, "log2l is unportable - " #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) @@ -1411,6 +1525,29 @@ _GL_WARN_ON_USE (logb, "logb is unportable - " # 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@ @@ -2135,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 */