Back to index

nagios-plugins  1.4.16
math.in.h
Go to the documentation of this file.
00001 /* A GNU-like <math.h>.
00002 
00003    Copyright (C) 2002-2003, 2007-2010 Free Software Foundation, Inc.
00004 
00005    This program is free software: you can redistribute it and/or modify
00006    it under the terms of the GNU General Public License as published by
00007    the Free Software Foundation; either version 3 of the License, or
00008    (at your option) any later version.
00009 
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.
00014 
00015    You should have received a copy of the GNU General Public License
00016    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00017 
00018 #ifndef _GL_MATH_H
00019 
00020 #if __GNUC__ >= 3
00021 @PRAGMA_SYSTEM_HEADER@
00022 #endif
00023 
00024 /* The include_next requires a split double-inclusion guard.  */
00025 #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_MATH_H@
00026 
00027 #ifndef _GL_MATH_H
00028 #define _GL_MATH_H
00029 
00030 
00031 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
00032 
00033 /* The definition of _GL_ARG_NONNULL is copied here.  */
00034 
00035 /* The definition of _GL_WARN_ON_USE is copied here.  */
00036 
00037 /* Helper macros to define a portability warning for the
00038    classification macro FUNC called with VALUE.  POSIX declares the
00039    classification macros with an argument of real-floating (that is,
00040    one of float, double, or long double).  */
00041 #define _GL_WARN_REAL_FLOATING_DECL(func) \
00042 static inline int                                                   \
00043 rpl_ ## func ## f (float f)                                         \
00044 {                                                                   \
00045   return func (f);                                                  \
00046 }                                                                   \
00047 static inline int                                                   \
00048 rpl_ ## func ## d (double d)                                        \
00049 {                                                                   \
00050   return func (d);                                                  \
00051 }                                                                   \
00052 static inline int                                                   \
00053 rpl_ ## func ## l (long double l)                                   \
00054 {                                                                   \
00055   return func (l);                                                  \
00056 }                                                                   \
00057 _GL_WARN_ON_USE (rpl_ ## func ## f, #func " is unportable - "       \
00058                  "use gnulib module " #func " for portability");    \
00059 _GL_WARN_ON_USE (rpl_ ## func ## d, #func " is unportable - "       \
00060                  "use gnulib module " #func " for portability");    \
00061 _GL_WARN_ON_USE (rpl_ ## func ## l, #func " is unportable - "       \
00062                  "use gnulib module " #func " for portability")
00063 #define _GL_WARN_REAL_FLOATING_IMPL(func, value) \
00064   (sizeof (value) == sizeof (float) ? rpl_ ## func ## f (value)     \
00065    : sizeof (value) == sizeof (double) ? rpl_ ## func ## d (value)  \
00066    : rpl_ ## func ## l (value))
00067 
00068 
00069 /* POSIX allows platforms that don't support NAN.  But all major
00070    machines in the past 15 years have supported something close to
00071    IEEE NaN, so we define this unconditionally.  We also must define
00072    it on platforms like Solaris 10, where NAN is present but defined
00073    as a function pointer rather than a floating point constant.  */
00074 #if !defined NAN || @REPLACE_NAN@
00075 # undef NAN
00076   /* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0.  */
00077 # ifdef __DECC
00078 static float
00079 _NaN ()
00080 {
00081   static float zero = 0.0f;
00082   return zero / zero;
00083 }
00084 #  define NAN (_NaN())
00085 # else
00086 #  define NAN (0.0f / 0.0f)
00087 # endif
00088 #endif
00089 
00090 /* Solaris 10 defines HUGE_VAL, but as a function pointer rather
00091    than a floating point constant.  */
00092 #if @REPLACE_HUGE_VAL@
00093 # undef HUGE_VAL
00094 # define HUGE_VAL (1.0 / 0.0)
00095 #endif
00096 
00097 
00098 /* Write x as
00099      x = mantissa * 2^exp
00100    where
00101      If x finite and nonzero: 0.5 <= |mantissa| < 1.0.
00102      If x is zero: mantissa = x, exp = 0.
00103      If x is infinite or NaN: mantissa = x, exp unspecified.
00104    Store exp in *EXPPTR and return mantissa.  */
00105 #if @GNULIB_FREXP@
00106 # if @REPLACE_FREXP@
00107 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00108 #   define frexp rpl_frexp
00109 #  endif
00110 _GL_FUNCDECL_RPL (frexp, double, (double x, int *expptr) _GL_ARG_NONNULL ((2)));
00111 _GL_CXXALIAS_RPL (frexp, double, (double x, int *expptr));
00112 # else
00113 _GL_CXXALIAS_SYS (frexp, double, (double x, int *expptr));
00114 # endif
00115 _GL_CXXALIASWARN (frexp);
00116 #elif defined GNULIB_POSIXCHECK
00117 # undef frexp
00118 /* Assume frexp is always declared.  */
00119 _GL_WARN_ON_USE (frexp, "frexp is unportable - "
00120                  "use gnulib module frexp for portability");
00121 #endif
00122 
00123 
00124 #if @GNULIB_LOGB@
00125 # if !@HAVE_DECL_LOGB@
00126 _GL_EXTERN_C double logb (double x);
00127 # endif
00128 #elif defined GNULIB_POSIXCHECK
00129 # undef logb
00130 # if HAVE_RAW_DECL_LOGB
00131 _GL_WARN_ON_USE (logb, "logb is unportable - "
00132                  "use gnulib module logb for portability");
00133 # endif
00134 #endif
00135 
00136 
00137 #if @GNULIB_ACOSL@
00138 # if !@HAVE_ACOSL@ || !@HAVE_DECL_ACOSL@
00139 _GL_FUNCDECL_SYS (acosl, long double, (long double x));
00140 # endif
00141 _GL_CXXALIAS_SYS (acosl, long double, (long double x));
00142 _GL_CXXALIASWARN (acosl);
00143 #elif defined GNULIB_POSIXCHECK
00144 # undef acosl
00145 # if HAVE_RAW_DECL_ACOSL
00146 _GL_WARN_ON_USE (acosl, "acosl is unportable - "
00147                  "use gnulib module mathl for portability");
00148 # endif
00149 #endif
00150 
00151 
00152 #if @GNULIB_ASINL@
00153 # if !@HAVE_ASINL@ || !@HAVE_DECL_ASINL@
00154 _GL_FUNCDECL_SYS (asinl, long double, (long double x));
00155 # endif
00156 _GL_CXXALIAS_SYS (asinl, long double, (long double x));
00157 _GL_CXXALIASWARN (asinl);
00158 #elif defined GNULIB_POSIXCHECK
00159 # undef asinl
00160 # if HAVE_RAW_DECL_ASINL
00161 _GL_WARN_ON_USE (asinl, "asinl is unportable - "
00162                  "use gnulib module mathl for portability");
00163 # endif
00164 #endif
00165 
00166 
00167 #if @GNULIB_ATANL@
00168 # if !@HAVE_ATANL@ || !@HAVE_DECL_ATANL@
00169 _GL_FUNCDECL_SYS (atanl, long double, (long double x));
00170 # endif
00171 _GL_CXXALIAS_SYS (atanl, long double, (long double x));
00172 _GL_CXXALIASWARN (atanl);
00173 #elif defined GNULIB_POSIXCHECK
00174 # undef atanl
00175 # if HAVE_RAW_DECL_ATANL
00176 _GL_WARN_ON_USE (atanl, "atanl is unportable - "
00177                  "use gnulib module mathl for portability");
00178 # endif
00179 #endif
00180 
00181 
00182 #if @GNULIB_CEILF@
00183 # if @REPLACE_CEILF@
00184 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00185 #   define ceilf rpl_ceilf
00186 #  endif
00187 _GL_FUNCDECL_RPL (ceilf, float, (float x));
00188 _GL_CXXALIAS_RPL (ceilf, float, (float x));
00189 # else
00190 #  if !@HAVE_DECL_CEILF@
00191 _GL_FUNCDECL_SYS (ceilf, float, (float x));
00192 #  endif
00193 _GL_CXXALIAS_SYS (ceilf, float, (float x));
00194 # endif
00195 _GL_CXXALIASWARN (ceilf);
00196 #elif defined GNULIB_POSIXCHECK
00197 # undef ceilf
00198 # if HAVE_RAW_DECL_CEILF
00199 _GL_WARN_ON_USE (ceilf, "ceilf is unportable - "
00200                  "use gnulib module ceilf for portability");
00201 # endif
00202 #endif
00203 
00204 #if @GNULIB_CEILL@
00205 # if @REPLACE_CEILL@
00206 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00207 #   define ceill rpl_ceill
00208 #  endif
00209 _GL_FUNCDECL_RPL (ceill, long double, (long double x));
00210 _GL_CXXALIAS_RPL (ceill, long double, (long double x));
00211 # else
00212 #  if !@HAVE_DECL_CEILL@
00213 _GL_FUNCDECL_SYS (ceill, long double, (long double x));
00214 #  endif
00215 _GL_CXXALIAS_SYS (ceill, long double, (long double x));
00216 # endif
00217 _GL_CXXALIASWARN (ceill);
00218 #elif defined GNULIB_POSIXCHECK
00219 # undef ceill
00220 # if HAVE_RAW_DECL_CEILL
00221 _GL_WARN_ON_USE (ceill, "ceill is unportable - "
00222                  "use gnulib module ceill for portability");
00223 # endif
00224 #endif
00225 
00226 
00227 #if @GNULIB_COSL@
00228 # if !@HAVE_COSL@ || !@HAVE_DECL_COSL@
00229 _GL_FUNCDECL_SYS (cosl, long double, (long double x));
00230 # endif
00231 _GL_CXXALIAS_SYS (cosl, long double, (long double x));
00232 _GL_CXXALIASWARN (cosl);
00233 #elif defined GNULIB_POSIXCHECK
00234 # undef cosl
00235 # if HAVE_RAW_DECL_COSL
00236 _GL_WARN_ON_USE (cosl, "cosl is unportable - "
00237                  "use gnulib module mathl for portability");
00238 # endif
00239 #endif
00240 
00241 
00242 #if @GNULIB_EXPL@
00243 # if !@HAVE_EXPL@ || !@HAVE_DECL_EXPL@
00244 _GL_FUNCDECL_SYS (expl, long double, (long double x));
00245 # endif
00246 _GL_CXXALIAS_SYS (expl, long double, (long double x));
00247 _GL_CXXALIASWARN (expl);
00248 #elif defined GNULIB_POSIXCHECK
00249 # undef expl
00250 # if HAVE_RAW_DECL_EXPL
00251 _GL_WARN_ON_USE (expl, "expl is unportable - "
00252                  "use gnulib module mathl for portability");
00253 # endif
00254 #endif
00255 
00256 
00257 #if @GNULIB_FLOORF@
00258 # if @REPLACE_FLOORF@
00259 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00260 #   define floorf rpl_floorf
00261 #  endif
00262 _GL_FUNCDECL_RPL (floorf, float, (float x));
00263 _GL_CXXALIAS_RPL (floorf, float, (float x));
00264 #else
00265 #  if !@HAVE_DECL_FLOORF@
00266 _GL_FUNCDECL_SYS (floorf, float, (float x));
00267 #  endif
00268 _GL_CXXALIAS_SYS (floorf, float, (float x));
00269 # endif
00270 _GL_CXXALIASWARN (floorf);
00271 #elif defined GNULIB_POSIXCHECK
00272 # undef floorf
00273 # if HAVE_RAW_DECL_FLOORF
00274 _GL_WARN_ON_USE (floorf, "floorf is unportable - "
00275                  "use gnulib module floorf for portability");
00276 # endif
00277 #endif
00278 
00279 #if @GNULIB_FLOORL@
00280 # if @REPLACE_FLOORL@
00281 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00282 #   define floorl rpl_floorl
00283 #  endif
00284 _GL_FUNCDECL_RPL (floorl, long double, (long double x));
00285 _GL_CXXALIAS_RPL (floorl, long double, (long double x));
00286 # else
00287 #  if !@HAVE_DECL_FLOORL@
00288 _GL_FUNCDECL_SYS (floorl, long double, (long double x));
00289 #  endif
00290 _GL_CXXALIAS_SYS (floorl, long double, (long double x));
00291 # endif
00292 _GL_CXXALIASWARN (floorl);
00293 #elif defined GNULIB_POSIXCHECK
00294 # undef floorl
00295 # if HAVE_RAW_DECL_FLOORL
00296 _GL_WARN_ON_USE (floorl, "floorl is unportable - "
00297                  "use gnulib module floorl for portability");
00298 # endif
00299 #endif
00300 
00301 
00302 /* Write x as
00303      x = mantissa * 2^exp
00304    where
00305      If x finite and nonzero: 0.5 <= |mantissa| < 1.0.
00306      If x is zero: mantissa = x, exp = 0.
00307      If x is infinite or NaN: mantissa = x, exp unspecified.
00308    Store exp in *EXPPTR and return mantissa.  */
00309 #if @GNULIB_FREXPL@ && @REPLACE_FREXPL@
00310 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00311 #  define frexpl rpl_frexpl
00312 # endif
00313 _GL_FUNCDECL_RPL (frexpl, long double,
00314                   (long double x, int *expptr) _GL_ARG_NONNULL ((2)));
00315 _GL_CXXALIAS_RPL (frexpl, long double, (long double x, int *expptr));
00316 #else
00317 # if !@HAVE_DECL_FREXPL@
00318 _GL_FUNCDECL_SYS (frexpl, long double,
00319                   (long double x, int *expptr) _GL_ARG_NONNULL ((2)));
00320 # endif
00321 # if @GNULIB_FREXPL@
00322 _GL_CXXALIAS_SYS (frexpl, long double, (long double x, int *expptr));
00323 # endif
00324 #endif
00325 #if @GNULIB_FREXPL@ && !(@REPLACE_FREXPL@ && !@HAVE_DECL_FREXPL@)
00326 _GL_CXXALIASWARN (frexpl);
00327 #endif
00328 #if !@GNULIB_FREXPL@ && defined GNULIB_POSIXCHECK
00329 # undef frexpl
00330 # if HAVE_RAW_DECL_FREXPL
00331 _GL_WARN_ON_USE (frexpl, "frexpl is unportable - "
00332                  "use gnulib module frexpl for portability");
00333 # endif
00334 #endif
00335 
00336 
00337 /* Return x * 2^exp.  */
00338 #if @GNULIB_LDEXPL@ && @REPLACE_LDEXPL@
00339 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00340 #  define ldexpl rpl_ldexpl
00341 # endif
00342 _GL_FUNCDECL_RPL (ldexpl, long double, (long double x, int exp));
00343 _GL_CXXALIAS_RPL (ldexpl, long double, (long double x, int exp));
00344 #else
00345 # if !@HAVE_DECL_LDEXPL@
00346 _GL_FUNCDECL_SYS (ldexpl, long double, (long double x, int exp));
00347 # endif
00348 # if @GNULIB_LDEXPL@
00349 _GL_CXXALIAS_SYS (ldexpl, long double, (long double x, int exp));
00350 # endif
00351 #endif
00352 #if @GNULIB_LDEXPL@
00353 _GL_CXXALIASWARN (ldexpl);
00354 #endif
00355 #if !@GNULIB_LDEXPL@ && defined GNULIB_POSIXCHECK
00356 # undef ldexpl
00357 # if HAVE_RAW_DECL_LDEXPL
00358 _GL_WARN_ON_USE (ldexpl, "ldexpl is unportable - "
00359                  "use gnulib module ldexpl for portability");
00360 # endif
00361 #endif
00362 
00363 
00364 #if @GNULIB_LOGL@
00365 # if !@HAVE_LOGL@ || !@HAVE_DECL_LOGL@
00366 _GL_FUNCDECL_SYS (logl, long double, (long double x));
00367 # endif
00368 _GL_CXXALIAS_SYS (logl, long double, (long double x));
00369 _GL_CXXALIASWARN (logl);
00370 #elif defined GNULIB_POSIXCHECK
00371 # undef logl
00372 # if HAVE_RAW_DECL_LOGL
00373 _GL_WARN_ON_USE (logl, "logl is unportable - "
00374                  "use gnulib module mathl for portability");
00375 # endif
00376 #endif
00377 
00378 
00379 #if @GNULIB_ROUNDF@
00380 # if @REPLACE_ROUNDF@
00381 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00382 #   undef roundf
00383 #   define roundf rpl_roundf
00384 #  endif
00385 _GL_FUNCDECL_RPL (roundf, float, (float x));
00386 _GL_CXXALIAS_RPL (roundf, float, (float x));
00387 # else
00388 #  if !@HAVE_DECL_ROUNDF@
00389 _GL_FUNCDECL_SYS (roundf, float, (float x));
00390 #  endif
00391 _GL_CXXALIAS_SYS (roundf, float, (float x));
00392 # endif
00393 _GL_CXXALIASWARN (roundf);
00394 #elif defined GNULIB_POSIXCHECK
00395 # undef roundf
00396 # if HAVE_RAW_DECL_ROUNDF
00397 _GL_WARN_ON_USE (roundf, "roundf is unportable - "
00398                  "use gnulib module roundf for portability");
00399 # endif
00400 #endif
00401 
00402 #if @GNULIB_ROUND@
00403 # if @REPLACE_ROUND@
00404 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00405 #   undef round
00406 #   define round rpl_round
00407 #  endif
00408 _GL_FUNCDECL_RPL (round, double, (double x));
00409 _GL_CXXALIAS_RPL (round, double, (double x));
00410 # else
00411 #  if !@HAVE_DECL_ROUND@
00412 _GL_FUNCDECL_SYS (round, double, (double x));
00413 #  endif
00414 _GL_CXXALIAS_SYS (round, double, (double x));
00415 # endif
00416 _GL_CXXALIASWARN (round);
00417 #elif defined GNULIB_POSIXCHECK
00418 # undef round
00419 # if HAVE_RAW_DECL_ROUND
00420 _GL_WARN_ON_USE (round, "round is unportable - "
00421                  "use gnulib module round for portability");
00422 # endif
00423 #endif
00424 
00425 #if @GNULIB_ROUNDL@
00426 # if @REPLACE_ROUNDL@
00427 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00428 #   undef roundl
00429 #   define roundl rpl_roundl
00430 #  endif
00431 _GL_FUNCDECL_RPL (roundl, long double, (long double x));
00432 _GL_CXXALIAS_RPL (roundl, long double, (long double x));
00433 # else
00434 #  if !@HAVE_DECL_ROUNDL@
00435 _GL_FUNCDECL_SYS (roundl, long double, (long double x));
00436 #  endif
00437 _GL_CXXALIAS_SYS (roundl, long double, (long double x));
00438 # endif
00439 _GL_CXXALIASWARN (roundl);
00440 #elif defined GNULIB_POSIXCHECK
00441 # undef roundl
00442 # if HAVE_RAW_DECL_ROUNDL
00443 _GL_WARN_ON_USE (roundl, "roundl is unportable - "
00444                  "use gnulib module roundl for portability");
00445 # endif
00446 #endif
00447 
00448 
00449 #if @GNULIB_SINL@
00450 # if !@HAVE_SINL@ || !@HAVE_DECL_SINL@
00451 _GL_FUNCDECL_SYS (sinl, long double, (long double x));
00452 # endif
00453 _GL_CXXALIAS_SYS (sinl, long double, (long double x));
00454 _GL_CXXALIASWARN (sinl);
00455 #elif defined GNULIB_POSIXCHECK
00456 # undef sinl
00457 # if HAVE_RAW_DECL_SINL
00458 _GL_WARN_ON_USE (sinl, "sinl is unportable - "
00459                  "use gnulib module mathl for portability");
00460 # endif
00461 #endif
00462 
00463 
00464 #if @GNULIB_SQRTL@
00465 # if !@HAVE_SQRTL@ || !@HAVE_DECL_SQRTL@
00466 _GL_FUNCDECL_SYS (sqrtl, long double, (long double x));
00467 # endif
00468 _GL_CXXALIAS_SYS (sqrtl, long double, (long double x));
00469 _GL_CXXALIASWARN (sqrtl);
00470 #elif defined GNULIB_POSIXCHECK
00471 # undef sqrtl
00472 # if HAVE_RAW_DECL_SQRTL
00473 _GL_WARN_ON_USE (sqrtl, "sqrtl is unportable - "
00474                  "use gnulib module mathl for portability");
00475 # endif
00476 #endif
00477 
00478 
00479 #if @GNULIB_TANL@
00480 # if !@HAVE_TANL@ || !@HAVE_DECL_TANL@
00481 _GL_FUNCDECL_SYS (tanl, long double, (long double x));
00482 # endif
00483 _GL_CXXALIAS_SYS (tanl, long double, (long double x));
00484 _GL_CXXALIASWARN (tanl);
00485 #elif defined GNULIB_POSIXCHECK
00486 # undef tanl
00487 # if HAVE_RAW_DECL_TANL
00488 _GL_WARN_ON_USE (tanl, "tanl is unportable - "
00489                  "use gnulib module mathl for portability");
00490 # endif
00491 #endif
00492 
00493 
00494 #if @GNULIB_TRUNCF@
00495 # if !@HAVE_DECL_TRUNCF@
00496 _GL_FUNCDECL_SYS (truncf, float, (float x));
00497 # endif
00498 _GL_CXXALIAS_SYS (truncf, float, (float x));
00499 _GL_CXXALIASWARN (truncf);
00500 #elif defined GNULIB_POSIXCHECK
00501 # undef truncf
00502 # if HAVE_RAW_DECL_TRUNCF
00503 _GL_WARN_ON_USE (truncf, "truncf is unportable - "
00504                  "use gnulib module truncf for portability");
00505 # endif
00506 #endif
00507 
00508 #if @GNULIB_TRUNC@
00509 # if !@HAVE_DECL_TRUNC@
00510 _GL_FUNCDECL_SYS (trunc, double, (double x));
00511 # endif
00512 _GL_CXXALIAS_SYS (trunc, double, (double x));
00513 _GL_CXXALIASWARN (trunc);
00514 #elif defined GNULIB_POSIXCHECK
00515 # undef trunc
00516 # if HAVE_RAW_DECL_TRUNC
00517 _GL_WARN_ON_USE (trunc, "trunc is unportable - "
00518                  "use gnulib module trunc for portability");
00519 # endif
00520 #endif
00521 
00522 #if @GNULIB_TRUNCL@
00523 # if @REPLACE_TRUNCL@
00524 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00525 #   undef truncl
00526 #   define truncl rpl_truncl
00527 #  endif
00528 _GL_FUNCDECL_RPL (truncl, long double, (long double x));
00529 _GL_CXXALIAS_RPL (truncl, long double, (long double x));
00530 # else
00531 #  if !@HAVE_DECL_TRUNCL@
00532 _GL_FUNCDECL_SYS (truncl, long double, (long double x));
00533 #  endif
00534 _GL_CXXALIAS_SYS (truncl, long double, (long double x));
00535 # endif
00536 _GL_CXXALIASWARN (truncl);
00537 #elif defined GNULIB_POSIXCHECK
00538 # undef truncl
00539 # if HAVE_RAW_DECL_TRUNCL
00540 _GL_WARN_ON_USE (truncl, "truncl is unportable - "
00541                  "use gnulib module truncl for portability");
00542 # endif
00543 #endif
00544 
00545 
00546 #if @GNULIB_ISFINITE@
00547 # if @REPLACE_ISFINITE@
00548 _GL_EXTERN_C int gl_isfinitef (float x);
00549 _GL_EXTERN_C int gl_isfinited (double x);
00550 _GL_EXTERN_C int gl_isfinitel (long double x);
00551 #  undef isfinite
00552 #  define isfinite(x) \
00553    (sizeof (x) == sizeof (long double) ? gl_isfinitel (x) : \
00554     sizeof (x) == sizeof (double) ? gl_isfinited (x) : \
00555     gl_isfinitef (x))
00556 # endif
00557 #elif defined GNULIB_POSIXCHECK
00558 # if defined isfinite
00559 _GL_WARN_REAL_FLOATING_DECL (isfinite);
00560 #  undef isfinite
00561 #  define isfinite(x) _GL_WARN_REAL_FLOATING_IMPL (isfinite, x)
00562 # endif
00563 #endif
00564 
00565 
00566 #if @GNULIB_ISINF@
00567 # if @REPLACE_ISINF@
00568 _GL_EXTERN_C int gl_isinff (float x);
00569 _GL_EXTERN_C int gl_isinfd (double x);
00570 _GL_EXTERN_C int gl_isinfl (long double x);
00571 #  undef isinf
00572 #  define isinf(x) \
00573    (sizeof (x) == sizeof (long double) ? gl_isinfl (x) : \
00574     sizeof (x) == sizeof (double) ? gl_isinfd (x) : \
00575     gl_isinff (x))
00576 # endif
00577 #elif defined GNULIB_POSIXCHECK
00578 # if defined isinf
00579 _GL_WARN_REAL_FLOATING_DECL (isinf);
00580 #  undef isinf
00581 #  define isinf(x) _GL_WARN_REAL_FLOATING_IMPL (isinf, x)
00582 # endif
00583 #endif
00584 
00585 
00586 #if @GNULIB_ISNANF@
00587 /* Test for NaN for 'float' numbers.  */
00588 # if @HAVE_ISNANF@
00589 /* The original <math.h> included above provides a declaration of isnan macro
00590    or (older) isnanf function.  */
00591 #  if __GNUC__ >= 4
00592     /* GCC 4.0 and newer provides three built-ins for isnan.  */
00593 #   undef isnanf
00594 #   define isnanf(x) __builtin_isnanf ((float)(x))
00595 #  elif defined isnan
00596 #   undef isnanf
00597 #   define isnanf(x) isnan ((float)(x))
00598 #  endif
00599 # else
00600 /* Test whether X is a NaN.  */
00601 #  undef isnanf
00602 #  define isnanf rpl_isnanf
00603 _GL_EXTERN_C int isnanf (float x);
00604 # endif
00605 #endif
00606 
00607 #if @GNULIB_ISNAND@
00608 /* Test for NaN for 'double' numbers.
00609    This function is a gnulib extension, unlike isnan() which applied only
00610    to 'double' numbers earlier but now is a type-generic macro.  */
00611 # if @HAVE_ISNAND@
00612 /* The original <math.h> included above provides a declaration of isnan macro.  */
00613 #  if __GNUC__ >= 4
00614     /* GCC 4.0 and newer provides three built-ins for isnan.  */
00615 #   undef isnand
00616 #   define isnand(x) __builtin_isnan ((double)(x))
00617 #  else
00618 #   undef isnand
00619 #   define isnand(x) isnan ((double)(x))
00620 #  endif
00621 # else
00622 /* Test whether X is a NaN.  */
00623 #  undef isnand
00624 #  define isnand rpl_isnand
00625 _GL_EXTERN_C int isnand (double x);
00626 # endif
00627 #endif
00628 
00629 #if @GNULIB_ISNANL@
00630 /* Test for NaN for 'long double' numbers.  */
00631 # if @HAVE_ISNANL@
00632 /* The original <math.h> included above provides a declaration of isnan macro or (older) isnanl function.  */
00633 #  if __GNUC__ >= 4
00634     /* GCC 4.0 and newer provides three built-ins for isnan.  */
00635 #   undef isnanl
00636 #   define isnanl(x) __builtin_isnanl ((long double)(x))
00637 #  elif defined isnan
00638 #   undef isnanl
00639 #   define isnanl(x) isnan ((long double)(x))
00640 #  endif
00641 # else
00642 /* Test whether X is a NaN.  */
00643 #  undef isnanl
00644 #  define isnanl rpl_isnanl
00645 _GL_EXTERN_C int isnanl (long double x);
00646 # endif
00647 #endif
00648 
00649 /* This must come *after* the snippets for GNULIB_ISNANF and GNULIB_ISNANL!  */
00650 #if @GNULIB_ISNAN@
00651 # if @REPLACE_ISNAN@
00652 /* We can't just use the isnanf macro (e.g.) as exposed by
00653    isnanf.h (e.g.) here, because those may end up being macros
00654    that recursively expand back to isnan.  So use the gnulib
00655    replacements for them directly. */
00656 #  if @HAVE_ISNANF@ && __GNUC__ >= 4
00657 #   define gl_isnan_f(x) __builtin_isnan ((float)(x))
00658 #  else
00659 _GL_EXTERN_C int rpl_isnanf (float x);
00660 #   define gl_isnan_f(x) rpl_isnanf (x)
00661 #  endif
00662 #  if @HAVE_ISNAND@ && __GNUC__ >= 4
00663 #   define gl_isnan_d(x) __builtin_isnan ((double)(x))
00664 #  else
00665 _GL_EXTERN_C int rpl_isnand (double x);
00666 #   define gl_isnan_d(x) rpl_isnand (x)
00667 #  endif
00668 #  if @HAVE_ISNANL@ && __GNUC__ >= 4
00669 #   define gl_isnan_l(x) __builtin_isnan ((long double)(x))
00670 #  else
00671 _GL_EXTERN_C int rpl_isnanl (long double x);
00672 #   define gl_isnan_l(x) rpl_isnanl (x)
00673 #  endif
00674 #  undef isnan
00675 #  define isnan(x) \
00676    (sizeof (x) == sizeof (long double) ? gl_isnan_l (x) : \
00677     sizeof (x) == sizeof (double) ? gl_isnan_d (x) : \
00678     gl_isnan_f (x))
00679 # endif
00680 #elif defined GNULIB_POSIXCHECK
00681 # if defined isnan
00682 _GL_WARN_REAL_FLOATING_DECL (isnan);
00683 #  undef isnan
00684 #  define isnan(x) _GL_WARN_REAL_FLOATING_IMPL (isnan, x)
00685 # endif
00686 #endif
00687 
00688 
00689 #if @GNULIB_SIGNBIT@
00690 # if @REPLACE_SIGNBIT_USING_GCC@
00691 #  undef signbit
00692    /* GCC 4.0 and newer provides three built-ins for signbit.  */
00693 #  define signbit(x) \
00694    (sizeof (x) == sizeof (long double) ? __builtin_signbitl (x) : \
00695     sizeof (x) == sizeof (double) ? __builtin_signbit (x) : \
00696     __builtin_signbitf (x))
00697 # endif
00698 # if @REPLACE_SIGNBIT@
00699 #  undef signbit
00700 _GL_EXTERN_C int gl_signbitf (float arg);
00701 _GL_EXTERN_C int gl_signbitd (double arg);
00702 _GL_EXTERN_C int gl_signbitl (long double arg);
00703 #  if __GNUC__ >= 2 && !__STRICT_ANSI__
00704 #   if defined FLT_SIGNBIT_WORD && defined FLT_SIGNBIT_BIT && !defined gl_signbitf
00705 #    define gl_signbitf_OPTIMIZED_MACRO
00706 #    define gl_signbitf(arg) \
00707        ({ union { float _value;                                         \
00708                   unsigned int _word[(sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \
00709                 } _m;                                                   \
00710           _m._value = (arg);                                            \
00711           (_m._word[FLT_SIGNBIT_WORD] >> FLT_SIGNBIT_BIT) & 1;          \
00712         })
00713 #   endif
00714 #   if defined DBL_SIGNBIT_WORD && defined DBL_SIGNBIT_BIT && !defined gl_signbitd
00715 #    define gl_signbitd_OPTIMIZED_MACRO
00716 #    define gl_signbitd(arg) \
00717        ({ union { double _value;                                                \
00718                   unsigned int _word[(sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \
00719                 } _m;                                                   \
00720           _m._value = (arg);                                            \
00721           (_m._word[DBL_SIGNBIT_WORD] >> DBL_SIGNBIT_BIT) & 1;          \
00722         })
00723 #   endif
00724 #   if defined LDBL_SIGNBIT_WORD && defined LDBL_SIGNBIT_BIT && !defined gl_signbitl
00725 #    define gl_signbitl_OPTIMIZED_MACRO
00726 #    define gl_signbitl(arg) \
00727        ({ union { long double _value;                                   \
00728                   unsigned int _word[(sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \
00729                 } _m;                                                   \
00730           _m._value = (arg);                                            \
00731           (_m._word[LDBL_SIGNBIT_WORD] >> LDBL_SIGNBIT_BIT) & 1;                \
00732         })
00733 #   endif
00734 #  endif
00735 #  define signbit(x) \
00736    (sizeof (x) == sizeof (long double) ? gl_signbitl (x) : \
00737     sizeof (x) == sizeof (double) ? gl_signbitd (x) : \
00738     gl_signbitf (x))
00739 # endif
00740 #elif defined GNULIB_POSIXCHECK
00741 # if defined signbit
00742 _GL_WARN_REAL_FLOATING_DECL (signbit);
00743 #  undef signbit
00744 #  define signbit(x) _GL_WARN_REAL_FLOATING_IMPL (signbit, x)
00745 # endif
00746 #endif
00747 
00748 
00749 #endif /* _GL_MATH_H */
00750 #endif /* _GL_MATH_H */