cmath

Go to the documentation of this file.
00001 // -*- C++ -*- C forwarding header.
00002 
00003 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
00004 // 2006, 2007, 2008, 2009, 2010
00005 // Free Software Foundation, Inc.
00006 //
00007 // This file is part of the GNU ISO C++ Library.  This library is free
00008 // software; you can redistribute it and/or modify it under the
00009 // terms of the GNU General Public License as published by the
00010 // Free Software Foundation; either version 3, or (at your option)
00011 // any later version.
00012 
00013 // This library is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 // GNU General Public License for more details.
00017 
00018 // Under Section 7 of GPL version 3, you are granted additional
00019 // permissions described in the GCC Runtime Library Exception, version
00020 // 3.1, as published by the Free Software Foundation.
00021 
00022 // You should have received a copy of the GNU General Public License and
00023 // a copy of the GCC Runtime Library Exception along with this program;
00024 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
00025 // <http://www.gnu.org/licenses/>.
00026 
00027 /** @file include/cmath
00028  *  This is a Standard C++ Library file.  You should @c \#include this file
00029  *  in your programs, rather than any of the @a *.h implementation files.
00030  *
00031  *  This is the C++ version of the Standard C Library header @c math.h,
00032  *  and its contents are (mostly) the same as that header, but are all
00033  *  contained in the namespace @c std (except for names which are defined
00034  *  as macros in C).
00035  */
00036 
00037 //
00038 // ISO C++ 14882: 26.5  C library
00039 //
00040 
00041 #pragma GCC system_header
00042 
00043 #include <bits/c++config.h>
00044 #include <bits/cpp_type_traits.h>
00045 #include <ext/type_traits.h>
00046 #include <math.h>
00047 
00048 #ifndef _GLIBCXX_CMATH
00049 #define _GLIBCXX_CMATH 1
00050 
00051 // Get rid of those macros defined in <math.h> in lieu of real functions.
00052 #undef abs
00053 #undef div
00054 #undef acos
00055 #undef asin
00056 #undef atan
00057 #undef atan2
00058 #undef ceil
00059 #undef cos
00060 #undef cosh
00061 #undef exp
00062 #undef fabs
00063 #undef floor
00064 #undef fmod
00065 #undef frexp
00066 #undef ldexp
00067 #undef log
00068 #undef log10
00069 #undef modf
00070 #undef pow
00071 #undef sin
00072 #undef sinh
00073 #undef sqrt
00074 #undef tan
00075 #undef tanh
00076 
00077 _GLIBCXX_BEGIN_NAMESPACE(std)
00078 
00079   inline double
00080   abs(double __x)
00081   { return __builtin_fabs(__x); }
00082 
00083   inline float
00084   abs(float __x)
00085   { return __builtin_fabsf(__x); }
00086 
00087   inline long double
00088   abs(long double __x)
00089   { return __builtin_fabsl(__x); }
00090 
00091   template<typename _Tp>
00092     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
00093                        double>::__type
00094     abs(_Tp __x)
00095     { return __builtin_fabs(__x); }
00096 
00097   using ::acos;
00098 
00099   inline float
00100   acos(float __x)
00101   { return __builtin_acosf(__x); }
00102 
00103   inline long double
00104   acos(long double __x)
00105   { return __builtin_acosl(__x); }
00106 
00107   template<typename _Tp>
00108     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
00109                        double>::__type
00110     acos(_Tp __x)
00111     { return __builtin_acos(__x); }
00112 
00113   using ::asin;
00114 
00115   inline float
00116   asin(float __x)
00117   { return __builtin_asinf(__x); }
00118 
00119   inline long double
00120   asin(long double __x)
00121   { return __builtin_asinl(__x); }
00122 
00123   template<typename _Tp>
00124     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00125                        double>::__type
00126     asin(_Tp __x)
00127     { return __builtin_asin(__x); }
00128 
00129   using ::atan;
00130 
00131   inline float
00132   atan(float __x)
00133   { return __builtin_atanf(__x); }
00134 
00135   inline long double
00136   atan(long double __x)
00137   { return __builtin_atanl(__x); }
00138 
00139   template<typename _Tp>
00140     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
00141                        double>::__type
00142     atan(_Tp __x)
00143     { return __builtin_atan(__x); }
00144 
00145   using ::atan2;
00146 
00147   inline float
00148   atan2(float __y, float __x)
00149   { return __builtin_atan2f(__y, __x); }
00150 
00151   inline long double
00152   atan2(long double __y, long double __x)
00153   { return __builtin_atan2l(__y, __x); }
00154 
00155   template<typename _Tp, typename _Up>
00156     inline
00157     typename __gnu_cxx::__promote_2<
00158     typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
00159                     && __is_arithmetic<_Up>::__value,
00160                     _Tp>::__type, _Up>::__type
00161     atan2(_Tp __y, _Up __x)
00162     {
00163       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
00164       return atan2(__type(__y), __type(__x));
00165     }
00166 
00167   using ::ceil;
00168 
00169   inline float
00170   ceil(float __x)
00171   { return __builtin_ceilf(__x); }
00172 
00173   inline long double
00174   ceil(long double __x)
00175   { return __builtin_ceill(__x); }
00176 
00177   template<typename _Tp>
00178     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
00179                        double>::__type
00180     ceil(_Tp __x)
00181     { return __builtin_ceil(__x); }
00182 
00183   using ::cos;
00184 
00185   inline float
00186   cos(float __x)
00187   { return __builtin_cosf(__x); }
00188 
00189   inline long double
00190   cos(long double __x)
00191   { return __builtin_cosl(__x); }
00192 
00193   template<typename _Tp>
00194     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
00195                        double>::__type
00196     cos(_Tp __x)
00197     { return __builtin_cos(__x); }
00198 
00199   using ::cosh;
00200 
00201   inline float
00202   cosh(float __x)
00203   { return __builtin_coshf(__x); }
00204 
00205   inline long double
00206   cosh(long double __x)
00207   { return __builtin_coshl(__x); }
00208 
00209   template<typename _Tp>
00210     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
00211                        double>::__type
00212     cosh(_Tp __x)
00213     { return __builtin_cosh(__x); }
00214 
00215   using ::exp;
00216 
00217   inline float
00218   exp(float __x)
00219   { return __builtin_expf(__x); }
00220 
00221   inline long double
00222   exp(long double __x)
00223   { return __builtin_expl(__x); }
00224 
00225   template<typename _Tp>
00226     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
00227                        double>::__type
00228     exp(_Tp __x)
00229     { return __builtin_exp(__x); }
00230 
00231   using ::fabs;
00232 
00233   inline float
00234   fabs(float __x)
00235   { return __builtin_fabsf(__x); }
00236 
00237   inline long double
00238   fabs(long double __x)
00239   { return __builtin_fabsl(__x); }
00240 
00241   template<typename _Tp>
00242     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
00243                        double>::__type
00244     fabs(_Tp __x)
00245     { return __builtin_fabs(__x); }
00246 
00247   using ::floor;
00248 
00249   inline float
00250   floor(float __x)
00251   { return __builtin_floorf(__x); }
00252 
00253   inline long double
00254   floor(long double __x)
00255   { return __builtin_floorl(__x); }
00256 
00257   template<typename _Tp>
00258     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
00259                        double>::__type
00260     floor(_Tp __x)
00261     { return __builtin_floor(__x); }
00262 
00263   using ::fmod;
00264 
00265   inline float
00266   fmod(float __x, float __y)
00267   { return __builtin_fmodf(__x, __y); }
00268 
00269   inline long double
00270   fmod(long double __x, long double __y)
00271   { return __builtin_fmodl(__x, __y); }
00272 
00273   using ::frexp;
00274 
00275   inline float
00276   frexp(float __x, int* __exp)
00277   { return __builtin_frexpf(__x, __exp); }
00278 
00279   inline long double
00280   frexp(long double __x, int* __exp)
00281   { return __builtin_frexpl(__x, __exp); }
00282 
00283   template<typename _Tp>
00284     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
00285                        double>::__type
00286     frexp(_Tp __x, int* __exp)
00287     { return __builtin_frexp(__x, __exp); }
00288 
00289   using ::ldexp;
00290 
00291   inline float
00292   ldexp(float __x, int __exp)
00293   { return __builtin_ldexpf(__x, __exp); }
00294 
00295   inline long double
00296   ldexp(long double __x, int __exp)
00297   { return __builtin_ldexpl(__x, __exp); }
00298 
00299   template<typename _Tp>
00300     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
00301                        double>::__type
00302   ldexp(_Tp __x, int __exp)
00303   { return __builtin_ldexp(__x, __exp); }
00304 
00305   using ::log;
00306 
00307   inline float
00308   log(float __x)
00309   { return __builtin_logf(__x); }
00310 
00311   inline long double
00312   log(long double __x)
00313   { return __builtin_logl(__x); }
00314 
00315   template<typename _Tp>
00316     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
00317                        double>::__type
00318     log(_Tp __x)
00319     { return __builtin_log(__x); }
00320 
00321   using ::log10;
00322 
00323   inline float
00324   log10(float __x)
00325   { return __builtin_log10f(__x); }
00326 
00327   inline long double
00328   log10(long double __x)
00329   { return __builtin_log10l(__x); }
00330 
00331   template<typename _Tp>
00332     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
00333                        double>::__type
00334     log10(_Tp __x)
00335     { return __builtin_log10(__x); }
00336 
00337   using ::modf;
00338 
00339   inline float
00340   modf(float __x, float* __iptr)
00341   { return __builtin_modff(__x, __iptr); }
00342 
00343   inline long double
00344   modf(long double __x, long double* __iptr)
00345   { return __builtin_modfl(__x, __iptr); }
00346 
00347   using ::pow;
00348 
00349   inline float
00350   pow(float __x, float __y)
00351   { return __builtin_powf(__x, __y); }
00352 
00353   inline long double
00354   pow(long double __x, long double __y)
00355   { return __builtin_powl(__x, __y); }
00356 
00357 #ifndef __GXX_EXPERIMENTAL_CXX0X__
00358   // _GLIBCXX_RESOLVE_LIB_DEFECTS
00359   // DR 550. What should the return type of pow(float,int) be?
00360   inline double
00361   pow(double __x, int __i)
00362   { return __builtin_powi(__x, __i); }
00363 
00364   inline float
00365   pow(float __x, int __n)
00366   { return __builtin_powif(__x, __n); }
00367 
00368   inline long double
00369   pow(long double __x, int __n)
00370   { return __builtin_powil(__x, __n); }
00371 #endif
00372 
00373   template<typename _Tp, typename _Up>
00374     inline
00375     typename __gnu_cxx::__promote_2<
00376     typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
00377                     && __is_arithmetic<_Up>::__value,
00378                     _Tp>::__type, _Up>::__type
00379     pow(_Tp __x, _Up __y)
00380     {
00381       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
00382       return pow(__type(__x), __type(__y));
00383     }
00384 
00385   using ::sin;
00386 
00387   inline float
00388   sin(float __x)
00389   { return __builtin_sinf(__x); }
00390 
00391   inline long double
00392   sin(long double __x)
00393   { return __builtin_sinl(__x); }
00394 
00395   template<typename _Tp>
00396     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
00397                        double>::__type
00398     sin(_Tp __x)
00399     { return __builtin_sin(__x); }
00400 
00401   using ::sinh;
00402 
00403   inline float
00404   sinh(float __x)
00405   { return __builtin_sinhf(__x); }
00406 
00407   inline long double
00408   sinh(long double __x)
00409   { return __builtin_sinhl(__x); }
00410 
00411   template<typename _Tp>
00412     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
00413                        double>::__type
00414     sinh(_Tp __x)
00415     { return __builtin_sinh(__x); }
00416 
00417   using ::sqrt;
00418 
00419   inline float
00420   sqrt(float __x)
00421   { return __builtin_sqrtf(__x); }
00422 
00423   inline long double
00424   sqrt(long double __x)
00425   { return __builtin_sqrtl(__x); }
00426 
00427   template<typename _Tp>
00428     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
00429                        double>::__type
00430     sqrt(_Tp __x)
00431     { return __builtin_sqrt(__x); }
00432 
00433   using ::tan;
00434 
00435   inline float
00436   tan(float __x)
00437   { return __builtin_tanf(__x); }
00438 
00439   inline long double
00440   tan(long double __x)
00441   { return __builtin_tanl(__x); }
00442 
00443   template<typename _Tp>
00444     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
00445                        double>::__type
00446     tan(_Tp __x)
00447     { return __builtin_tan(__x); }
00448 
00449   using ::tanh;
00450 
00451   inline float
00452   tanh(float __x)
00453   { return __builtin_tanhf(__x); }
00454 
00455   inline long double
00456   tanh(long double __x)
00457   { return __builtin_tanhl(__x); }
00458 
00459   template<typename _Tp>
00460     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
00461                        double>::__type
00462     tanh(_Tp __x)
00463     { return __builtin_tanh(__x); }
00464 
00465 _GLIBCXX_END_NAMESPACE
00466 
00467 #if _GLIBCXX_USE_C99_MATH
00468 #if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
00469 
00470 // These are possible macros imported from C99-land.
00471 #undef fpclassify
00472 #undef isfinite
00473 #undef isinf
00474 #undef isnan
00475 #undef isnormal
00476 #undef signbit
00477 #undef isgreater
00478 #undef isgreaterequal
00479 #undef isless
00480 #undef islessequal
00481 #undef islessgreater
00482 #undef isunordered
00483 
00484 _GLIBCXX_BEGIN_NAMESPACE(std)
00485 
00486 #ifdef __GXX_EXPERIMENTAL_CXX0X__
00487   inline int
00488   fpclassify(float __x)
00489   { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
00490                 FP_SUBNORMAL, FP_ZERO, __x); }
00491 
00492   inline int
00493   fpclassify(double __x)
00494   { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
00495                 FP_SUBNORMAL, FP_ZERO, __x); }
00496 
00497   inline int
00498   fpclassify(long double __x)
00499   { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
00500                 FP_SUBNORMAL, FP_ZERO, __x); }
00501 
00502   template<typename _Tp>
00503     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00504                        int>::__type
00505     fpclassify(_Tp __x)
00506     { return __x != 0 ? FP_NORMAL : FP_ZERO; }
00507 
00508   inline bool
00509   isfinite(float __x)
00510   { return __builtin_isfinite(__x); }
00511 
00512   inline bool
00513   isfinite(double __x)
00514   { return __builtin_isfinite(__x); }
00515 
00516   inline bool
00517   isfinite(long double __x)
00518   { return __builtin_isfinite(__x); }
00519 
00520   template<typename _Tp>
00521     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00522                        bool>::__type
00523     isfinite(_Tp __x)
00524     { return true; }
00525 
00526   inline bool
00527   isinf(float __x)
00528   { return __builtin_isinf(__x); }
00529 
00530   inline bool
00531   isinf(double __x)
00532   { return __builtin_isinf(__x); }
00533 
00534   inline bool
00535   isinf(long double __x)
00536   { return __builtin_isinf(__x); }
00537 
00538   template<typename _Tp>
00539     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00540                        bool>::__type
00541     isinf(_Tp __x)
00542     { return false; }
00543 
00544   inline bool
00545   isnan(float __x)
00546   { return __builtin_isnan(__x); }
00547 
00548   inline bool
00549   isnan(double __x)
00550   { return __builtin_isnan(__x); }
00551 
00552   inline bool
00553   isnan(long double __x)
00554   { return __builtin_isnan(__x); }
00555 
00556   template<typename _Tp>
00557     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00558                        bool>::__type
00559     isnan(_Tp __x)
00560     { return false; }
00561 
00562   inline bool
00563   isnormal(float __x)
00564   { return __builtin_isnormal(__x); }
00565 
00566   inline bool
00567   isnormal(double __x)
00568   { return __builtin_isnormal(__x); }
00569 
00570   inline bool
00571   isnormal(long double __x)
00572   { return __builtin_isnormal(__x); }
00573 
00574   template<typename _Tp>
00575     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00576                        bool>::__type
00577     isnormal(_Tp __x)
00578     { return __x != 0 ? true : false; }
00579 
00580   inline bool
00581   signbit(float __x)
00582   { return __builtin_signbit(__x); }
00583 
00584   inline bool
00585   signbit(double __x)
00586   { return __builtin_signbit(__x); }
00587 
00588   inline bool
00589   signbit(long double __x)
00590   { return __builtin_signbit(__x); }
00591 
00592   template<typename _Tp>
00593     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00594                        bool>::__type
00595     signbit(_Tp __x)
00596     { return __x < 0 ? true : false; }
00597 
00598   inline bool
00599   isgreater(float __x, float __y)
00600   { return __builtin_isgreater(__x, __y); }
00601 
00602   inline bool
00603   isgreater(double __x, double __y)
00604   { return __builtin_isgreater(__x, __y); }
00605 
00606   inline bool
00607   isgreater(long double __x, long double __y)
00608   { return __builtin_isgreater(__x, __y); }
00609 
00610   template<typename _Tp, typename _Up>
00611     inline typename
00612     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
00613                 && __is_arithmetic<_Up>::__value), bool>::__type
00614     isgreater(_Tp __x, _Up __y)
00615     {
00616       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
00617       return __builtin_isgreater(__type(__x), __type(__y));
00618     }
00619 
00620   inline bool
00621   isgreaterequal(float __x, float __y)
00622   { return __builtin_isgreaterequal(__x, __y); }
00623 
00624   inline bool
00625   isgreaterequal(double __x, double __y)
00626   { return __builtin_isgreaterequal(__x, __y); }
00627 
00628   inline bool
00629   isgreaterequal(long double __x, long double __y)
00630   { return __builtin_isgreaterequal(__x, __y); }
00631 
00632   template<typename _Tp, typename _Up>
00633     inline typename
00634     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
00635                 && __is_arithmetic<_Up>::__value), bool>::__type
00636     isgreaterequal(_Tp __x, _Up __y)
00637     {
00638       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
00639       return __builtin_isgreaterequal(__type(__x), __type(__y));
00640     }
00641 
00642   inline bool
00643   isless(float __x, float __y)
00644   { return __builtin_isless(__x, __y); }
00645 
00646   inline bool
00647   isless(double __x, double __y)
00648   { return __builtin_isless(__x, __y); }
00649 
00650   inline bool
00651   isless(long double __x, long double __y)
00652   { return __builtin_isless(__x, __y); }
00653 
00654   template<typename _Tp, typename _Up>
00655     inline typename
00656     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
00657                 && __is_arithmetic<_Up>::__value), bool>::__type
00658     isless(_Tp __x, _Up __y)
00659     {
00660       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
00661       return __builtin_isless(__type(__x), __type(__y));
00662     }
00663 
00664   inline bool
00665   islessequal(float __x, float __y)
00666   { return __builtin_islessequal(__x, __y); }
00667 
00668   inline bool
00669   islessequal(double __x, double __y)
00670   { return __builtin_islessequal(__x, __y); }
00671 
00672   inline bool
00673   islessequal(long double __x, long double __y)
00674   { return __builtin_islessequal(__x, __y); }
00675 
00676   template<typename _Tp, typename _Up>
00677     inline typename
00678     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
00679                 && __is_arithmetic<_Up>::__value), bool>::__type
00680     islessequal(_Tp __x, _Up __y)
00681     {
00682       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
00683       return __builtin_islessequal(__type(__x), __type(__y));
00684     }
00685 
00686   inline bool
00687   islessgreater(float __x, float __y)
00688   { return __builtin_islessgreater(__x, __y); }
00689 
00690   inline bool
00691   islessgreater(double __x, double __y)
00692   { return __builtin_islessgreater(__x, __y); }
00693 
00694   inline bool
00695   islessgreater(long double __x, long double __y)
00696   { return __builtin_islessgreater(__x, __y); }
00697 
00698   template<typename _Tp, typename _Up>
00699     inline typename
00700     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
00701                 && __is_arithmetic<_Up>::__value), bool>::__type
00702     islessgreater(_Tp __x, _Up __y)
00703     {
00704       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
00705       return __builtin_islessgreater(__type(__x), __type(__y));
00706     }
00707 
00708   inline bool
00709   isunordered(float __x, float __y)
00710   { return __builtin_isunordered(__x, __y); }
00711 
00712   inline bool
00713   isunordered(double __x, double __y)
00714   { return __builtin_isunordered(__x, __y); }
00715 
00716   inline bool
00717   isunordered(long double __x, long double __y)
00718   { return __builtin_isunordered(__x, __y); }
00719 
00720   template<typename _Tp, typename _Up>
00721     inline typename
00722     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
00723                 && __is_arithmetic<_Up>::__value), bool>::__type
00724     isunordered(_Tp __x, _Up __y)
00725     {
00726       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
00727       return __builtin_isunordered(__type(__x), __type(__y));
00728     }
00729 
00730 #else
00731 
00732   template<typename _Tp>
00733     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00734                        int>::__type
00735     fpclassify(_Tp __f)
00736     {
00737       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00738       return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
00739                   FP_SUBNORMAL, FP_ZERO, __type(__f));
00740     }
00741 
00742   template<typename _Tp>
00743     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00744                        int>::__type
00745     isfinite(_Tp __f)
00746     {
00747       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00748       return __builtin_isfinite(__type(__f));
00749     }
00750 
00751   template<typename _Tp>
00752     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00753                        int>::__type
00754     isinf(_Tp __f)
00755     {
00756       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00757       return __builtin_isinf(__type(__f));
00758     }
00759 
00760   template<typename _Tp>
00761     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00762                        int>::__type
00763     isnan(_Tp __f)
00764     {
00765       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00766       return __builtin_isnan(__type(__f));
00767     }
00768 
00769   template<typename _Tp>
00770     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00771                        int>::__type
00772     isnormal(_Tp __f)
00773     {
00774       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00775       return __builtin_isnormal(__type(__f));
00776     }
00777 
00778   template<typename _Tp>
00779     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00780                        int>::__type
00781     signbit(_Tp __f)
00782     {
00783       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00784       return __builtin_signbit(__type(__f));
00785     }
00786 
00787   template<typename _Tp>
00788     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00789                        int>::__type
00790     isgreater(_Tp __f1, _Tp __f2)
00791     {
00792       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00793       return __builtin_isgreater(__type(__f1), __type(__f2));
00794     }
00795 
00796   template<typename _Tp>
00797     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00798                        int>::__type
00799     isgreaterequal(_Tp __f1, _Tp __f2)
00800     {
00801       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00802       return __builtin_isgreaterequal(__type(__f1), __type(__f2));
00803     }
00804 
00805   template<typename _Tp>
00806     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00807                        int>::__type
00808     isless(_Tp __f1, _Tp __f2)
00809     {
00810       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00811       return __builtin_isless(__type(__f1), __type(__f2));
00812     }
00813 
00814   template<typename _Tp>
00815     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00816                        int>::__type
00817     islessequal(_Tp __f1, _Tp __f2)
00818     {
00819       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00820       return __builtin_islessequal(__type(__f1), __type(__f2));
00821     }
00822 
00823   template<typename _Tp>
00824     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00825                        int>::__type
00826     islessgreater(_Tp __f1, _Tp __f2)
00827     {
00828       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00829       return __builtin_islessgreater(__type(__f1), __type(__f2));
00830     }
00831 
00832   template<typename _Tp>
00833     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00834                        int>::__type
00835     isunordered(_Tp __f1, _Tp __f2)
00836     {
00837       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00838       return __builtin_isunordered(__type(__f1), __type(__f2));
00839     }
00840 
00841 #endif
00842 
00843 _GLIBCXX_END_NAMESPACE
00844 
00845 #endif /* _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC */
00846 #endif
00847 
00848 #ifdef __GXX_EXPERIMENTAL_CXX0X__
00849 #  if defined(_GLIBCXX_INCLUDE_AS_TR1)
00850 #    error C++0x header cannot be included from TR1 header
00851 #  endif
00852 #  if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
00853 #    include <tr1_impl/cmath>
00854 #  else
00855 #    define _GLIBCXX_INCLUDE_AS_CXX0X
00856 #    define _GLIBCXX_BEGIN_NAMESPACE_TR1
00857 #    define _GLIBCXX_END_NAMESPACE_TR1
00858 #    define _GLIBCXX_TR1
00859 #    include <tr1_impl/cmath>
00860 #    undef _GLIBCXX_TR1
00861 #    undef _GLIBCXX_END_NAMESPACE_TR1
00862 #    undef _GLIBCXX_BEGIN_NAMESPACE_TR1
00863 #    undef _GLIBCXX_INCLUDE_AS_CXX0X
00864 #  endif
00865 #endif
00866 
00867 #endif