1 // -*- C++ -*- C forwarding header.
 
    3 // Copyright (C) 1997-2014 Free Software Foundation, Inc.
 
    5 // This file is part of the GNU ISO C++ Library.  This library is free
 
    6 // software; you can redistribute it and/or modify it under the
 
    7 // terms of the GNU General Public License as published by the
 
    8 // Free Software Foundation; either version 3, or (at your option)
 
   11 // This library is distributed in the hope that it will be useful,
 
   12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 
   13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
   14 // GNU General Public License for more details.
 
   16 // Under Section 7 of GPL version 3, you are granted additional
 
   17 // permissions described in the GCC Runtime Library Exception, version
 
   18 // 3.1, as published by the Free Software Foundation.
 
   20 // You should have received a copy of the GNU General Public License and
 
   21 // a copy of the GCC Runtime Library Exception along with this program;
 
   22 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
   23 // <http://www.gnu.org/licenses/>.
 
   25 /** @file include/cmath
 
   26  *  This is a Standard C++ Library file.  You should @c \#include this file
 
   27  *  in your programs, rather than any of the @a *.h implementation files.
 
   29  *  This is the C++ version of the Standard C Library header @c math.h,
 
   30  *  and its contents are (mostly) the same as that header, but are all
 
   31  *  contained in the namespace @c std (except for names which are defined
 
   36 // ISO C++ 14882: 26.5  C library
 
   39 #pragma GCC system_header
 
   41 #include <bits/c++config.h>
 
   42 #include <bits/cpp_type_traits.h>
 
   43 #include <ext/type_traits.h>
 
   46 #ifndef _GLIBCXX_CMATH
 
   47 #define _GLIBCXX_CMATH 1
 
   49 // Get rid of those macros defined in <math.h> in lieu of real functions.
 
   75 namespace std _GLIBCXX_VISIBILITY(default)
 
   77 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   79 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
 
   80   inline _GLIBCXX_CONSTEXPR double
 
   82   { return __builtin_fabs(__x); }
 
   85 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
 
   86   inline _GLIBCXX_CONSTEXPR float
 
   88   { return __builtin_fabsf(__x); }
 
   90   inline _GLIBCXX_CONSTEXPR long double
 
   92   { return __builtin_fabsl(__x); }
 
   95   template<typename _Tp>
 
   96     inline _GLIBCXX_CONSTEXPR
 
   97     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
 
  100     { return __builtin_fabs(__x); }
 
  104 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
 
  105   inline _GLIBCXX_CONSTEXPR float
 
  107   { return __builtin_acosf(__x); }
 
  109   inline _GLIBCXX_CONSTEXPR long double
 
  110   acos(long double __x)
 
  111   { return __builtin_acosl(__x); }
 
  114   template<typename _Tp>
 
  115     inline _GLIBCXX_CONSTEXPR
 
  116     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
  119     { return __builtin_acos(__x); }
 
  123 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
 
  124   inline _GLIBCXX_CONSTEXPR float
 
  126   { return __builtin_asinf(__x); }
 
  128   inline _GLIBCXX_CONSTEXPR long double
 
  129   asin(long double __x)
 
  130   { return __builtin_asinl(__x); }
 
  133   template<typename _Tp>
 
  134     inline _GLIBCXX_CONSTEXPR
 
  135     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
 
  138     { return __builtin_asin(__x); }
 
  142 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
 
  143   inline _GLIBCXX_CONSTEXPR float
 
  145   { return __builtin_atanf(__x); }
 
  147   inline _GLIBCXX_CONSTEXPR long double
 
  148   atan(long double __x)
 
  149   { return __builtin_atanl(__x); }
 
  152   template<typename _Tp>
 
  153     inline _GLIBCXX_CONSTEXPR
 
  154     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
 
  157     { return __builtin_atan(__x); }
 
  161 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
 
  162   inline _GLIBCXX_CONSTEXPR float
 
  163   atan2(float __y, float __x)
 
  164   { return __builtin_atan2f(__y, __x); }
 
  166   inline _GLIBCXX_CONSTEXPR long double
 
  167   atan2(long double __y, long double __x)
 
  168   { return __builtin_atan2l(__y, __x); }
 
  171   template<typename _Tp, typename _Up>
 
  172     inline _GLIBCXX_CONSTEXPR
 
  173     typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
 
  174     atan2(_Tp __y, _Up __x)
 
  176       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
 
  177       return atan2(__type(__y), __type(__x));
 
  182 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
 
  183   inline _GLIBCXX_CONSTEXPR float
 
  185   { return __builtin_ceilf(__x); }
 
  187   inline _GLIBCXX_CONSTEXPR long double
 
  188   ceil(long double __x)
 
  189   { return __builtin_ceill(__x); }
 
  192   template<typename _Tp>
 
  193     inline _GLIBCXX_CONSTEXPR
 
  194     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
  197     { return __builtin_ceil(__x); }
 
  201 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
 
  202   inline _GLIBCXX_CONSTEXPR float
 
  204   { return __builtin_cosf(__x); }
 
  206   inline _GLIBCXX_CONSTEXPR long double
 
  208   { return __builtin_cosl(__x); }
 
  211   template<typename _Tp>
 
  212     inline _GLIBCXX_CONSTEXPR
 
  213     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
 
  216     { return __builtin_cos(__x); }
 
  220 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
 
  221   inline _GLIBCXX_CONSTEXPR float
 
  223   { return __builtin_coshf(__x); }
 
  225   inline _GLIBCXX_CONSTEXPR long double
 
  226   cosh(long double __x)
 
  227   { return __builtin_coshl(__x); }
 
  230   template<typename _Tp>
 
  231     inline _GLIBCXX_CONSTEXPR
 
  232     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
 
  235     { return __builtin_cosh(__x); }
 
  239 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
 
  240   inline _GLIBCXX_CONSTEXPR float
 
  242   { return __builtin_expf(__x); }
 
  244   inline _GLIBCXX_CONSTEXPR long double
 
  246   { return __builtin_expl(__x); }
 
  249   template<typename _Tp>
 
  250     inline _GLIBCXX_CONSTEXPR
 
  251     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
 
  254     { return __builtin_exp(__x); }
 
  258 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
 
  259   inline _GLIBCXX_CONSTEXPR float
 
  261   { return __builtin_fabsf(__x); }
 
  263   inline _GLIBCXX_CONSTEXPR long double
 
  264   fabs(long double __x)
 
  265   { return __builtin_fabsl(__x); }
 
  268   template<typename _Tp>
 
  269     inline _GLIBCXX_CONSTEXPR
 
  270     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
 
  273     { return __builtin_fabs(__x); }
 
  277 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
 
  278   inline _GLIBCXX_CONSTEXPR float
 
  280   { return __builtin_floorf(__x); }
 
  282   inline _GLIBCXX_CONSTEXPR long double
 
  283   floor(long double __x)
 
  284   { return __builtin_floorl(__x); }
 
  287   template<typename _Tp>
 
  288     inline _GLIBCXX_CONSTEXPR
 
  289     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
 
  292     { return __builtin_floor(__x); }
 
  296 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
 
  297   inline _GLIBCXX_CONSTEXPR float
 
  298   fmod(float __x, float __y)
 
  299   { return __builtin_fmodf(__x, __y); }
 
  301   inline _GLIBCXX_CONSTEXPR long double
 
  302   fmod(long double __x, long double __y)
 
  303   { return __builtin_fmodl(__x, __y); }
 
  306   template<typename _Tp, typename _Up>
 
  307     inline _GLIBCXX_CONSTEXPR
 
  308     typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
 
  309     fmod(_Tp __x, _Up __y)
 
  311       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
 
  312       return fmod(__type(__x), __type(__y));
 
  317 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
 
  319   frexp(float __x, int* __exp)
 
  320   { return __builtin_frexpf(__x, __exp); }
 
  323   frexp(long double __x, int* __exp)
 
  324   { return __builtin_frexpl(__x, __exp); }
 
  327   template<typename _Tp>
 
  328     inline _GLIBCXX_CONSTEXPR
 
  329     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
  331     frexp(_Tp __x, int* __exp)
 
  332     { return __builtin_frexp(__x, __exp); }
 
  336 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
 
  337   inline _GLIBCXX_CONSTEXPR float
 
  338   ldexp(float __x, int __exp)
 
  339   { return __builtin_ldexpf(__x, __exp); }
 
  341   inline _GLIBCXX_CONSTEXPR long double
 
  342   ldexp(long double __x, int __exp)
 
  343   { return __builtin_ldexpl(__x, __exp); }
 
  346   template<typename _Tp>
 
  347     inline _GLIBCXX_CONSTEXPR
 
  348     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
  350     ldexp(_Tp __x, int __exp)
 
  351     { return __builtin_ldexp(__x, __exp); }
 
  355 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
 
  356   inline _GLIBCXX_CONSTEXPR float
 
  358   { return __builtin_logf(__x); }
 
  360   inline _GLIBCXX_CONSTEXPR long double
 
  362   { return __builtin_logl(__x); }
 
  365   template<typename _Tp>
 
  366     inline _GLIBCXX_CONSTEXPR
 
  367     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
  370     { return __builtin_log(__x); }
 
  374 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
 
  375   inline _GLIBCXX_CONSTEXPR float
 
  377   { return __builtin_log10f(__x); }
 
  379   inline _GLIBCXX_CONSTEXPR long double
 
  380   log10(long double __x)
 
  381   { return __builtin_log10l(__x); }
 
  384   template<typename _Tp>
 
  385     inline _GLIBCXX_CONSTEXPR
 
  386     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
 
  389     { return __builtin_log10(__x); }
 
  393 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
 
  395   modf(float __x, float* __iptr)
 
  396   { return __builtin_modff(__x, __iptr); }
 
  399   modf(long double __x, long double* __iptr)
 
  400   { return __builtin_modfl(__x, __iptr); }
 
  405 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
 
  406   inline _GLIBCXX_CONSTEXPR float
 
  407   pow(float __x, float __y)
 
  408   { return __builtin_powf(__x, __y); }
 
  410   inline _GLIBCXX_CONSTEXPR long double
 
  411   pow(long double __x, long double __y)
 
  412   { return __builtin_powl(__x, __y); }
 
  414 #if __cplusplus < 201103L
 
  415   // _GLIBCXX_RESOLVE_LIB_DEFECTS
 
  416   // DR 550. What should the return type of pow(float,int) be?
 
  418   pow(double __x, int __i)
 
  419   { return __builtin_powi(__x, __i); }
 
  422   pow(float __x, int __n)
 
  423   { return __builtin_powif(__x, __n); }
 
  426   pow(long double __x, int __n)
 
  427   { return __builtin_powil(__x, __n); }
 
  431   template<typename _Tp, typename _Up>
 
  432     inline _GLIBCXX_CONSTEXPR
 
  433     typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
 
  434     pow(_Tp __x, _Up __y)
 
  436       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
 
  437       return pow(__type(__x), __type(__y));
 
  442 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
 
  443   inline _GLIBCXX_CONSTEXPR float
 
  445   { return __builtin_sinf(__x); }
 
  447   inline _GLIBCXX_CONSTEXPR long double
 
  449   { return __builtin_sinl(__x); }
 
  452   template<typename _Tp>
 
  453     inline _GLIBCXX_CONSTEXPR
 
  454     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
  457     { return __builtin_sin(__x); }
 
  461 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
 
  462   inline _GLIBCXX_CONSTEXPR float
 
  464   { return __builtin_sinhf(__x); }
 
  466   inline _GLIBCXX_CONSTEXPR long double
 
  467   sinh(long double __x)
 
  468   { return __builtin_sinhl(__x); }
 
  471   template<typename _Tp>
 
  472     inline _GLIBCXX_CONSTEXPR
 
  473     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
  476     { return __builtin_sinh(__x); }
 
  480 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
 
  481   inline _GLIBCXX_CONSTEXPR float
 
  483   { return __builtin_sqrtf(__x); }
 
  485   inline _GLIBCXX_CONSTEXPR long double
 
  486   sqrt(long double __x)
 
  487   { return __builtin_sqrtl(__x); }
 
  490   template<typename _Tp>
 
  491     inline _GLIBCXX_CONSTEXPR
 
  492     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
  495     { return __builtin_sqrt(__x); }
 
  499 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
 
  500   inline _GLIBCXX_CONSTEXPR float
 
  502   { return __builtin_tanf(__x); }
 
  504   inline _GLIBCXX_CONSTEXPR long double
 
  506   { return __builtin_tanl(__x); }
 
  509   template<typename _Tp>
 
  510     inline _GLIBCXX_CONSTEXPR
 
  511     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
  514     { return __builtin_tan(__x); }
 
  518 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
 
  519   inline _GLIBCXX_CONSTEXPR float
 
  521   { return __builtin_tanhf(__x); }
 
  523   inline _GLIBCXX_CONSTEXPR long double
 
  524   tanh(long double __x)
 
  525   { return __builtin_tanhl(__x); }
 
  528   template<typename _Tp>
 
  529     inline _GLIBCXX_CONSTEXPR
 
  530     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
  533     { return __builtin_tanh(__x); }
 
  535 _GLIBCXX_END_NAMESPACE_VERSION
 
  538 #if _GLIBCXX_USE_C99_MATH
 
  539 #if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
 
  541 // These are possible macros imported from C99-land.
 
  549 #undef isgreaterequal
 
  555 namespace std _GLIBCXX_VISIBILITY(default)
 
  557 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
  559 #if __cplusplus >= 201103L
 
  561   fpclassify(float __x)
 
  562   { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
 
  563                FP_SUBNORMAL, FP_ZERO, __x); }
 
  566   fpclassify(double __x)
 
  567   { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
 
  568                FP_SUBNORMAL, FP_ZERO, __x); }
 
  571   fpclassify(long double __x)
 
  572   { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
 
  573                FP_SUBNORMAL, FP_ZERO, __x); }
 
  575   template<typename _Tp>
 
  576     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
 
  579     { return __x != 0 ? FP_NORMAL : FP_ZERO; }
 
  583   { return __builtin_isfinite(__x); }
 
  587   { return __builtin_isfinite(__x); }
 
  590   isfinite(long double __x)
 
  591   { return __builtin_isfinite(__x); }
 
  593   template<typename _Tp>
 
  594     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
 
  601   { return __builtin_isinf(__x); }
 
  605   { return __builtin_isinf(__x); }
 
  608   isinf(long double __x)
 
  609   { return __builtin_isinf(__x); }
 
  611   template<typename _Tp>
 
  612     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
 
  619   { return __builtin_isnan(__x); }
 
  623   { return __builtin_isnan(__x); }
 
  626   isnan(long double __x)
 
  627   { return __builtin_isnan(__x); }
 
  629   template<typename _Tp>
 
  630     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
 
  637   { return __builtin_isnormal(__x); }
 
  641   { return __builtin_isnormal(__x); }
 
  644   isnormal(long double __x)
 
  645   { return __builtin_isnormal(__x); }
 
  647   template<typename _Tp>
 
  648     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
 
  651     { return __x != 0 ? true : false; }
 
  653   // The front-end doesn't provide a type generic builtin (libstdc++/58625).
 
  656   { return __builtin_signbitf(__x); }
 
  660   { return __builtin_signbit(__x); }
 
  663   signbit(long double __x)
 
  664   { return __builtin_signbitl(__x); }
 
  666   template<typename _Tp>
 
  667     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
 
  670     { return __x < 0 ? true : false; }
 
  673   isgreater(float __x, float __y)
 
  674   { return __builtin_isgreater(__x, __y); }
 
  677   isgreater(double __x, double __y)
 
  678   { return __builtin_isgreater(__x, __y); }
 
  681   isgreater(long double __x, long double __y)
 
  682   { return __builtin_isgreater(__x, __y); }
 
  684   template<typename _Tp, typename _Up>
 
  686     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
 
  687                && __is_arithmetic<_Up>::__value), bool>::__type
 
  688     isgreater(_Tp __x, _Up __y)
 
  690       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
 
  691       return __builtin_isgreater(__type(__x), __type(__y));
 
  695   isgreaterequal(float __x, float __y)
 
  696   { return __builtin_isgreaterequal(__x, __y); }
 
  699   isgreaterequal(double __x, double __y)
 
  700   { return __builtin_isgreaterequal(__x, __y); }
 
  703   isgreaterequal(long double __x, long double __y)
 
  704   { return __builtin_isgreaterequal(__x, __y); }
 
  706   template<typename _Tp, typename _Up>
 
  708     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
 
  709                && __is_arithmetic<_Up>::__value), bool>::__type
 
  710     isgreaterequal(_Tp __x, _Up __y)
 
  712       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
 
  713       return __builtin_isgreaterequal(__type(__x), __type(__y));
 
  717   isless(float __x, float __y)
 
  718   { return __builtin_isless(__x, __y); }
 
  721   isless(double __x, double __y)
 
  722   { return __builtin_isless(__x, __y); }
 
  725   isless(long double __x, long double __y)
 
  726   { return __builtin_isless(__x, __y); }
 
  728   template<typename _Tp, typename _Up>
 
  730     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
 
  731                && __is_arithmetic<_Up>::__value), bool>::__type
 
  732     isless(_Tp __x, _Up __y)
 
  734       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
 
  735       return __builtin_isless(__type(__x), __type(__y));
 
  739   islessequal(float __x, float __y)
 
  740   { return __builtin_islessequal(__x, __y); }
 
  743   islessequal(double __x, double __y)
 
  744   { return __builtin_islessequal(__x, __y); }
 
  747   islessequal(long double __x, long double __y)
 
  748   { return __builtin_islessequal(__x, __y); }
 
  750   template<typename _Tp, typename _Up>
 
  752     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
 
  753                && __is_arithmetic<_Up>::__value), bool>::__type
 
  754     islessequal(_Tp __x, _Up __y)
 
  756       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
 
  757       return __builtin_islessequal(__type(__x), __type(__y));
 
  761   islessgreater(float __x, float __y)
 
  762   { return __builtin_islessgreater(__x, __y); }
 
  765   islessgreater(double __x, double __y)
 
  766   { return __builtin_islessgreater(__x, __y); }
 
  769   islessgreater(long double __x, long double __y)
 
  770   { return __builtin_islessgreater(__x, __y); }
 
  772   template<typename _Tp, typename _Up>
 
  774     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
 
  775                && __is_arithmetic<_Up>::__value), bool>::__type
 
  776     islessgreater(_Tp __x, _Up __y)
 
  778       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
 
  779       return __builtin_islessgreater(__type(__x), __type(__y));
 
  783   isunordered(float __x, float __y)
 
  784   { return __builtin_isunordered(__x, __y); }
 
  787   isunordered(double __x, double __y)
 
  788   { return __builtin_isunordered(__x, __y); }
 
  791   isunordered(long double __x, long double __y)
 
  792   { return __builtin_isunordered(__x, __y); }
 
  794   template<typename _Tp, typename _Up>
 
  796     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
 
  797                && __is_arithmetic<_Up>::__value), bool>::__type
 
  798     isunordered(_Tp __x, _Up __y)
 
  800       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
 
  801       return __builtin_isunordered(__type(__x), __type(__y));
 
  806   template<typename _Tp>
 
  807     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
 
  811       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
 
  812       return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
 
  813                  FP_SUBNORMAL, FP_ZERO, __type(__f));
 
  816   template<typename _Tp>
 
  817     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
 
  821       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
 
  822       return __builtin_isfinite(__type(__f));
 
  825   template<typename _Tp>
 
  826     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
 
  830       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
 
  831       return __builtin_isinf(__type(__f));
 
  834   template<typename _Tp>
 
  835     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
 
  839       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
 
  840       return __builtin_isnan(__type(__f));
 
  843   template<typename _Tp>
 
  844     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
 
  848       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
 
  849       return __builtin_isnormal(__type(__f));
 
  852   template<typename _Tp>
 
  853     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
 
  857       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
 
  858       return __builtin_signbit(__type(__f));
 
  861   template<typename _Tp>
 
  862     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
 
  864     isgreater(_Tp __f1, _Tp __f2)
 
  866       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
 
  867       return __builtin_isgreater(__type(__f1), __type(__f2));
 
  870   template<typename _Tp>
 
  871     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
 
  873     isgreaterequal(_Tp __f1, _Tp __f2)
 
  875       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
 
  876       return __builtin_isgreaterequal(__type(__f1), __type(__f2));
 
  879   template<typename _Tp>
 
  880     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
 
  882     isless(_Tp __f1, _Tp __f2)
 
  884       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
 
  885       return __builtin_isless(__type(__f1), __type(__f2));
 
  888   template<typename _Tp>
 
  889     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
 
  891     islessequal(_Tp __f1, _Tp __f2)
 
  893       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
 
  894       return __builtin_islessequal(__type(__f1), __type(__f2));
 
  897   template<typename _Tp>
 
  898     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
 
  900     islessgreater(_Tp __f1, _Tp __f2)
 
  902       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
 
  903       return __builtin_islessgreater(__type(__f1), __type(__f2));
 
  906   template<typename _Tp>
 
  907     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
 
  909     isunordered(_Tp __f1, _Tp __f2)
 
  911       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
 
  912       return __builtin_isunordered(__type(__f1), __type(__f2));
 
  917 _GLIBCXX_END_NAMESPACE_VERSION
 
  920 #endif /* _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC */
 
  923 #if __cplusplus >= 201103L
 
  925 #ifdef _GLIBCXX_USE_C99_MATH_TR1
 
 1033 namespace std _GLIBCXX_VISIBILITY(default)
 
 1035 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 1147   using ::nexttowardf;
 
 1148   using ::nexttowardl;
 
 1182   /// Additional overloads.
 
 1185   { return __builtin_acoshf(__x); }
 
 1187   constexpr long double
 
 1188   acosh(long double __x)
 
 1189   { return __builtin_acoshl(__x); }
 
 1191   template<typename _Tp>
 
 1192     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
 1195     { return __builtin_acosh(__x); }
 
 1199   { return __builtin_asinhf(__x); }
 
 1201   constexpr long double
 
 1202   asinh(long double __x)
 
 1203   { return __builtin_asinhl(__x); }
 
 1205   template<typename _Tp>
 
 1206     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
 1209     { return __builtin_asinh(__x); }
 
 1213   { return __builtin_atanhf(__x); }
 
 1215   constexpr long double
 
 1216   atanh(long double __x)
 
 1217   { return __builtin_atanhl(__x); }
 
 1219   template<typename _Tp>
 
 1220     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
 1223     { return __builtin_atanh(__x); }
 
 1227   { return __builtin_cbrtf(__x); }
 
 1229   constexpr long double
 
 1230   cbrt(long double __x)
 
 1231   { return __builtin_cbrtl(__x); }
 
 1233   template<typename _Tp>
 
 1234     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
 1237     { return __builtin_cbrt(__x); }
 
 1240   copysign(float __x, float __y)
 
 1241   { return __builtin_copysignf(__x, __y); }
 
 1243   constexpr long double
 
 1244   copysign(long double __x, long double __y)
 
 1245   { return __builtin_copysignl(__x, __y); }
 
 1247   template<typename _Tp, typename _Up>
 
 1248     constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
 
 1249     copysign(_Tp __x, _Up __y)
 
 1251       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
 
 1252       return copysign(__type(__x), __type(__y));
 
 1257   { return __builtin_erff(__x); }
 
 1259   constexpr long double
 
 1260   erf(long double __x)
 
 1261   { return __builtin_erfl(__x); }
 
 1263   template<typename _Tp>
 
 1264     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
 1267     { return __builtin_erf(__x); }
 
 1271   { return __builtin_erfcf(__x); }
 
 1273   constexpr long double
 
 1274   erfc(long double __x)
 
 1275   { return __builtin_erfcl(__x); }
 
 1277   template<typename _Tp>
 
 1278     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
 1281     { return __builtin_erfc(__x); }
 
 1285   { return __builtin_exp2f(__x); }
 
 1287   constexpr long double
 
 1288   exp2(long double __x)
 
 1289   { return __builtin_exp2l(__x); }
 
 1291   template<typename _Tp>
 
 1292     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
 1295     { return __builtin_exp2(__x); }
 
 1299   { return __builtin_expm1f(__x); }
 
 1301   constexpr long double
 
 1302   expm1(long double __x)
 
 1303   { return __builtin_expm1l(__x); }
 
 1305   template<typename _Tp>
 
 1306     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
 1309     { return __builtin_expm1(__x); }
 
 1312   fdim(float __x, float __y)
 
 1313   { return __builtin_fdimf(__x, __y); }
 
 1315   constexpr long double
 
 1316   fdim(long double __x, long double __y)
 
 1317   { return __builtin_fdiml(__x, __y); }
 
 1319   template<typename _Tp, typename _Up>
 
 1320     constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
 
 1321     fdim(_Tp __x, _Up __y)
 
 1323       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
 
 1324       return fdim(__type(__x), __type(__y));
 
 1328   fma(float __x, float __y, float __z)
 
 1329   { return __builtin_fmaf(__x, __y, __z); }
 
 1331   constexpr long double
 
 1332   fma(long double __x, long double __y, long double __z)
 
 1333   { return __builtin_fmal(__x, __y, __z); }
 
 1335   template<typename _Tp, typename _Up, typename _Vp>
 
 1336     constexpr typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type
 
 1337     fma(_Tp __x, _Up __y, _Vp __z)
 
 1339       typedef typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type __type;
 
 1340       return fma(__type(__x), __type(__y), __type(__z));
 
 1344   fmax(float __x, float __y)
 
 1345   { return __builtin_fmaxf(__x, __y); }
 
 1347   constexpr long double
 
 1348   fmax(long double __x, long double __y)
 
 1349   { return __builtin_fmaxl(__x, __y); }
 
 1351   template<typename _Tp, typename _Up>
 
 1352     constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
 
 1353     fmax(_Tp __x, _Up __y)
 
 1355       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
 
 1356       return fmax(__type(__x), __type(__y));
 
 1360   fmin(float __x, float __y)
 
 1361   { return __builtin_fminf(__x, __y); }
 
 1363   constexpr long double
 
 1364   fmin(long double __x, long double __y)
 
 1365   { return __builtin_fminl(__x, __y); }
 
 1367   template<typename _Tp, typename _Up>
 
 1368     constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
 
 1369     fmin(_Tp __x, _Up __y)
 
 1371       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
 
 1372       return fmin(__type(__x), __type(__y));
 
 1376   hypot(float __x, float __y)
 
 1377   { return __builtin_hypotf(__x, __y); }
 
 1379   constexpr long double
 
 1380   hypot(long double __x, long double __y)
 
 1381   { return __builtin_hypotl(__x, __y); }
 
 1383   template<typename _Tp, typename _Up>
 
 1384     constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
 
 1385     hypot(_Tp __x, _Up __y)
 
 1387       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
 
 1388       return hypot(__type(__x), __type(__y));
 
 1393   { return __builtin_ilogbf(__x); }
 
 1396   ilogb(long double __x)
 
 1397   { return __builtin_ilogbl(__x); }
 
 1399   template<typename _Tp>
 
 1401     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
 1404     { return __builtin_ilogb(__x); }
 
 1408   { return __builtin_lgammaf(__x); }
 
 1410   constexpr long double
 
 1411   lgamma(long double __x)
 
 1412   { return __builtin_lgammal(__x); }
 
 1414   template<typename _Tp>
 
 1415     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
 1418     { return __builtin_lgamma(__x); }
 
 1422   { return __builtin_llrintf(__x); }
 
 1425   llrint(long double __x)
 
 1426   { return __builtin_llrintl(__x); }
 
 1428   template<typename _Tp>
 
 1429     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
 1432     { return __builtin_llrint(__x); }
 
 1436   { return __builtin_llroundf(__x); }
 
 1439   llround(long double __x)
 
 1440   { return __builtin_llroundl(__x); }
 
 1442   template<typename _Tp>
 
 1443     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
 1446     { return __builtin_llround(__x); }
 
 1450   { return __builtin_log1pf(__x); }
 
 1452   constexpr long double
 
 1453   log1p(long double __x)
 
 1454   { return __builtin_log1pl(__x); }
 
 1456   template<typename _Tp>
 
 1457     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
 1460     { return __builtin_log1p(__x); }
 
 1465   { return __builtin_log2f(__x); }
 
 1467   constexpr long double
 
 1468   log2(long double __x)
 
 1469   { return __builtin_log2l(__x); }
 
 1471   template<typename _Tp>
 
 1472     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
 1475     { return __builtin_log2(__x); }
 
 1479   { return __builtin_logbf(__x); }
 
 1481   constexpr long double
 
 1482   logb(long double __x)
 
 1483   { return __builtin_logbl(__x); }
 
 1485   template<typename _Tp>
 
 1486     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
 1489     { return __builtin_logb(__x); }
 
 1493   { return __builtin_lrintf(__x); }
 
 1496   lrint(long double __x)
 
 1497   { return __builtin_lrintl(__x); }
 
 1499   template<typename _Tp>
 
 1500     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
 1503     { return __builtin_lrint(__x); }
 
 1507   { return __builtin_lroundf(__x); }
 
 1510   lround(long double __x)
 
 1511   { return __builtin_lroundl(__x); }
 
 1513   template<typename _Tp>
 
 1514     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
 1517     { return __builtin_lround(__x); }
 
 1520   nearbyint(float __x)
 
 1521   { return __builtin_nearbyintf(__x); }
 
 1523   constexpr long double
 
 1524   nearbyint(long double __x)
 
 1525   { return __builtin_nearbyintl(__x); }
 
 1527   template<typename _Tp>
 
 1528     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
 1531     { return __builtin_nearbyint(__x); }
 
 1534   nextafter(float __x, float __y)
 
 1535   { return __builtin_nextafterf(__x, __y); }
 
 1537   constexpr long double
 
 1538   nextafter(long double __x, long double __y)
 
 1539   { return __builtin_nextafterl(__x, __y); }
 
 1541   template<typename _Tp, typename _Up>
 
 1542     constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
 
 1543     nextafter(_Tp __x, _Up __y)
 
 1545       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
 
 1546       return nextafter(__type(__x), __type(__y));
 
 1550   nexttoward(float __x, long double __y)
 
 1551   { return __builtin_nexttowardf(__x, __y); }
 
 1553   constexpr long double
 
 1554   nexttoward(long double __x, long double __y)
 
 1555   { return __builtin_nexttowardl(__x, __y); }
 
 1557   template<typename _Tp>
 
 1558     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
 1560     nexttoward(_Tp __x, long double __y)
 
 1561     { return __builtin_nexttoward(__x, __y); }
 
 1564   remainder(float __x, float __y)
 
 1565   { return __builtin_remainderf(__x, __y); }
 
 1567   constexpr long double
 
 1568   remainder(long double __x, long double __y)
 
 1569   { return __builtin_remainderl(__x, __y); }
 
 1571   template<typename _Tp, typename _Up>
 
 1572     constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
 
 1573     remainder(_Tp __x, _Up __y)
 
 1575       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
 
 1576       return remainder(__type(__x), __type(__y));
 
 1580   remquo(float __x, float __y, int* __pquo)
 
 1581   { return __builtin_remquof(__x, __y, __pquo); }
 
 1584   remquo(long double __x, long double __y, int* __pquo)
 
 1585   { return __builtin_remquol(__x, __y, __pquo); }
 
 1587   template<typename _Tp, typename _Up>
 
 1588     inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
 
 1589     remquo(_Tp __x, _Up __y, int* __pquo)
 
 1591       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
 
 1592       return remquo(__type(__x), __type(__y), __pquo);
 
 1597   { return __builtin_rintf(__x); }
 
 1599   constexpr long double
 
 1600   rint(long double __x)
 
 1601   { return __builtin_rintl(__x); }
 
 1603   template<typename _Tp>
 
 1604     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
 1607     { return __builtin_rint(__x); }
 
 1611   { return __builtin_roundf(__x); }
 
 1613   constexpr long double
 
 1614   round(long double __x)
 
 1615   { return __builtin_roundl(__x); }
 
 1617   template<typename _Tp>
 
 1618     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
 1621     { return __builtin_round(__x); }
 
 1624   scalbln(float __x, long __ex)
 
 1625   { return __builtin_scalblnf(__x, __ex); }
 
 1627   constexpr long double
 
 1628   scalbln(long double __x, long __ex)
 
 1629   { return __builtin_scalblnl(__x, __ex); }
 
 1631   template<typename _Tp>
 
 1632     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
 1634     scalbln(_Tp __x, long __ex)
 
 1635     { return __builtin_scalbln(__x, __ex); }
 
 1638   scalbn(float __x, int __ex)
 
 1639   { return __builtin_scalbnf(__x, __ex); }
 
 1641   constexpr long double
 
 1642   scalbn(long double __x, int __ex)
 
 1643   { return __builtin_scalbnl(__x, __ex); }
 
 1645   template<typename _Tp>
 
 1646     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
 1648     scalbn(_Tp __x, int __ex)
 
 1649     { return __builtin_scalbn(__x, __ex); }
 
 1653   { return __builtin_tgammaf(__x); }
 
 1655   constexpr long double
 
 1656   tgamma(long double __x)
 
 1657   { return __builtin_tgammal(__x); }
 
 1659   template<typename _Tp>
 
 1660     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
 1663     { return __builtin_tgamma(__x); }
 
 1667   { return __builtin_truncf(__x); }
 
 1669   constexpr long double
 
 1670   trunc(long double __x)
 
 1671   { return __builtin_truncl(__x); }
 
 1673   template<typename _Tp>
 
 1674     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
 
 1677     { return __builtin_trunc(__x); }
 
 1679 _GLIBCXX_END_NAMESPACE_VERSION
 
 1682 #endif // _GLIBCXX_USE_C99_MATH_TR1