libstdc++
cmath
Go to the documentation of this file.
00001 // -*- C++ -*- C forwarding header.
00002 
00003 // Copyright (C) 1997-2017 Free Software Foundation, Inc.
00004 //
00005 // This file is part of the GNU ISO C++ Library.  This library is free
00006 // software; you can redistribute it and/or modify it under the
00007 // terms of the GNU General Public License as published by the
00008 // Free Software Foundation; either version 3, or (at your option)
00009 // any later version.
00010 
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // GNU General Public License for more details.
00015 
00016 // Under Section 7 of GPL version 3, you are granted additional
00017 // permissions described in the GCC Runtime Library Exception, version
00018 // 3.1, as published by the Free Software Foundation.
00019 
00020 // You should have received a copy of the GNU General Public License and
00021 // a copy of the GCC Runtime Library Exception along with this program;
00022 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
00023 // <http://www.gnu.org/licenses/>.
00024 
00025 /** @file include/cmath
00026  *  This is a Standard C++ Library file.  You should @c \#include this file
00027  *  in your programs, rather than any of the @a *.h implementation files.
00028  *
00029  *  This is the C++ version of the Standard C Library header @c math.h,
00030  *  and its contents are (mostly) the same as that header, but are all
00031  *  contained in the namespace @c std (except for names which are defined
00032  *  as macros in C).
00033  */
00034 
00035 //
00036 // ISO C++ 14882: 26.5  C library
00037 //
00038 
00039 #pragma GCC system_header
00040 
00041 #include <bits/c++config.h>
00042 #include <bits/cpp_type_traits.h>
00043 #include <ext/type_traits.h>
00044 #define _GLIBCXX_INCLUDE_NEXT_C_HEADERS
00045 #include_next <math.h>
00046 #undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS
00047 #include <bits/std_abs.h>
00048 
00049 #ifndef _GLIBCXX_CMATH
00050 #define _GLIBCXX_CMATH 1
00051 
00052 // Get rid of those macros defined in <math.h> in lieu of real functions.
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 extern "C++"
00078 {
00079 namespace std _GLIBCXX_VISIBILITY(default)
00080 {
00081 _GLIBCXX_BEGIN_NAMESPACE_VERSION
00082 
00083   using ::acos;
00084 
00085 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
00086   inline _GLIBCXX_CONSTEXPR float
00087   acos(float __x)
00088   { return __builtin_acosf(__x); }
00089 
00090   inline _GLIBCXX_CONSTEXPR long double
00091   acos(long double __x)
00092   { return __builtin_acosl(__x); }
00093 #endif
00094 
00095   template<typename _Tp>
00096     inline _GLIBCXX_CONSTEXPR
00097     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
00098                                     double>::__type
00099     acos(_Tp __x)
00100     { return __builtin_acos(__x); }
00101 
00102   using ::asin;
00103 
00104 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
00105   inline _GLIBCXX_CONSTEXPR float
00106   asin(float __x)
00107   { return __builtin_asinf(__x); }
00108 
00109   inline _GLIBCXX_CONSTEXPR long double
00110   asin(long double __x)
00111   { return __builtin_asinl(__x); }
00112 #endif
00113 
00114   template<typename _Tp>
00115     inline _GLIBCXX_CONSTEXPR
00116     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00117                                     double>::__type
00118     asin(_Tp __x)
00119     { return __builtin_asin(__x); }
00120 
00121   using ::atan;
00122 
00123 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
00124   inline _GLIBCXX_CONSTEXPR float
00125   atan(float __x)
00126   { return __builtin_atanf(__x); }
00127 
00128   inline _GLIBCXX_CONSTEXPR long double
00129   atan(long double __x)
00130   { return __builtin_atanl(__x); }
00131 #endif
00132 
00133   template<typename _Tp>
00134     inline _GLIBCXX_CONSTEXPR
00135     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00136                                     double>::__type
00137     atan(_Tp __x)
00138     { return __builtin_atan(__x); }
00139 
00140   using ::atan2;
00141 
00142 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
00143   inline _GLIBCXX_CONSTEXPR float
00144   atan2(float __y, float __x)
00145   { return __builtin_atan2f(__y, __x); }
00146 
00147   inline _GLIBCXX_CONSTEXPR long double
00148   atan2(long double __y, long double __x)
00149   { return __builtin_atan2l(__y, __x); }
00150 #endif
00151 
00152   template<typename _Tp, typename _Up>
00153     inline _GLIBCXX_CONSTEXPR
00154     typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
00155     atan2(_Tp __y, _Up __x)
00156     {
00157       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
00158       return atan2(__type(__y), __type(__x));
00159     }
00160 
00161   using ::ceil;
00162 
00163 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
00164   inline _GLIBCXX_CONSTEXPR float
00165   ceil(float __x)
00166   { return __builtin_ceilf(__x); }
00167 
00168   inline _GLIBCXX_CONSTEXPR long double
00169   ceil(long double __x)
00170   { return __builtin_ceill(__x); }
00171 #endif
00172 
00173   template<typename _Tp>
00174     inline _GLIBCXX_CONSTEXPR
00175     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
00176                                     double>::__type
00177     ceil(_Tp __x)
00178     { return __builtin_ceil(__x); }
00179 
00180   using ::cos;
00181 
00182 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
00183   inline _GLIBCXX_CONSTEXPR float
00184   cos(float __x)
00185   { return __builtin_cosf(__x); }
00186 
00187   inline _GLIBCXX_CONSTEXPR long double
00188   cos(long double __x)
00189   { return __builtin_cosl(__x); }
00190 #endif
00191 
00192   template<typename _Tp>
00193     inline _GLIBCXX_CONSTEXPR
00194     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 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
00202   inline _GLIBCXX_CONSTEXPR float
00203   cosh(float __x)
00204   { return __builtin_coshf(__x); }
00205 
00206   inline _GLIBCXX_CONSTEXPR long double
00207   cosh(long double __x)
00208   { return __builtin_coshl(__x); }
00209 #endif
00210 
00211   template<typename _Tp>
00212     inline _GLIBCXX_CONSTEXPR
00213     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00214                                     double>::__type
00215     cosh(_Tp __x)
00216     { return __builtin_cosh(__x); }
00217 
00218   using ::exp;
00219 
00220 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
00221   inline _GLIBCXX_CONSTEXPR float
00222   exp(float __x)
00223   { return __builtin_expf(__x); }
00224 
00225   inline _GLIBCXX_CONSTEXPR long double
00226   exp(long double __x)
00227   { return __builtin_expl(__x); }
00228 #endif
00229 
00230   template<typename _Tp>
00231     inline _GLIBCXX_CONSTEXPR
00232     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00233                                     double>::__type
00234     exp(_Tp __x)
00235     { return __builtin_exp(__x); }
00236 
00237   using ::fabs;
00238 
00239 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
00240   inline _GLIBCXX_CONSTEXPR float
00241   fabs(float __x)
00242   { return __builtin_fabsf(__x); }
00243 
00244   inline _GLIBCXX_CONSTEXPR long double
00245   fabs(long double __x)
00246   { return __builtin_fabsl(__x); }
00247 #endif
00248 
00249   template<typename _Tp>
00250     inline _GLIBCXX_CONSTEXPR
00251     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00252                                     double>::__type
00253     fabs(_Tp __x)
00254     { return __builtin_fabs(__x); }
00255 
00256   using ::floor;
00257 
00258 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
00259   inline _GLIBCXX_CONSTEXPR float
00260   floor(float __x)
00261   { return __builtin_floorf(__x); }
00262 
00263   inline _GLIBCXX_CONSTEXPR long double
00264   floor(long double __x)
00265   { return __builtin_floorl(__x); }
00266 #endif
00267 
00268   template<typename _Tp>
00269     inline _GLIBCXX_CONSTEXPR
00270     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00271                                     double>::__type
00272     floor(_Tp __x)
00273     { return __builtin_floor(__x); }
00274 
00275   using ::fmod;
00276 
00277 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
00278   inline _GLIBCXX_CONSTEXPR float
00279   fmod(float __x, float __y)
00280   { return __builtin_fmodf(__x, __y); }
00281 
00282   inline _GLIBCXX_CONSTEXPR long double
00283   fmod(long double __x, long double __y)
00284   { return __builtin_fmodl(__x, __y); }
00285 #endif
00286 
00287   template<typename _Tp, typename _Up>
00288     inline _GLIBCXX_CONSTEXPR
00289     typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
00290     fmod(_Tp __x, _Up __y)
00291     {
00292       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
00293       return fmod(__type(__x), __type(__y));
00294     }
00295 
00296   using ::frexp;
00297 
00298 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
00299   inline float
00300   frexp(float __x, int* __exp)
00301   { return __builtin_frexpf(__x, __exp); }
00302 
00303   inline long double
00304   frexp(long double __x, int* __exp)
00305   { return __builtin_frexpl(__x, __exp); }
00306 #endif
00307 
00308   template<typename _Tp>
00309     inline _GLIBCXX_CONSTEXPR
00310     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
00311                                     double>::__type
00312     frexp(_Tp __x, int* __exp)
00313     { return __builtin_frexp(__x, __exp); }
00314 
00315   using ::ldexp;
00316 
00317 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
00318   inline _GLIBCXX_CONSTEXPR float
00319   ldexp(float __x, int __exp)
00320   { return __builtin_ldexpf(__x, __exp); }
00321 
00322   inline _GLIBCXX_CONSTEXPR long double
00323   ldexp(long double __x, int __exp)
00324   { return __builtin_ldexpl(__x, __exp); }
00325 #endif
00326 
00327   template<typename _Tp>
00328     inline _GLIBCXX_CONSTEXPR
00329     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
00330                                     double>::__type
00331     ldexp(_Tp __x, int __exp)
00332     { return __builtin_ldexp(__x, __exp); }
00333 
00334   using ::log;
00335 
00336 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
00337   inline _GLIBCXX_CONSTEXPR float
00338   log(float __x)
00339   { return __builtin_logf(__x); }
00340 
00341   inline _GLIBCXX_CONSTEXPR long double
00342   log(long double __x)
00343   { return __builtin_logl(__x); }
00344 #endif
00345 
00346   template<typename _Tp>
00347     inline _GLIBCXX_CONSTEXPR
00348     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
00349                                     double>::__type
00350     log(_Tp __x)
00351     { return __builtin_log(__x); }
00352 
00353   using ::log10;
00354 
00355 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
00356   inline _GLIBCXX_CONSTEXPR float
00357   log10(float __x)
00358   { return __builtin_log10f(__x); }
00359 
00360   inline _GLIBCXX_CONSTEXPR long double
00361   log10(long double __x)
00362   { return __builtin_log10l(__x); }
00363 #endif
00364 
00365   template<typename _Tp>
00366     inline _GLIBCXX_CONSTEXPR
00367     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00368                                     double>::__type
00369     log10(_Tp __x)
00370     { return __builtin_log10(__x); }
00371 
00372   using ::modf;
00373 
00374 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
00375   inline float
00376   modf(float __x, float* __iptr)
00377   { return __builtin_modff(__x, __iptr); }
00378 
00379   inline long double
00380   modf(long double __x, long double* __iptr)
00381   { return __builtin_modfl(__x, __iptr); }
00382 #endif
00383 
00384   using ::pow;
00385 
00386 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
00387   inline _GLIBCXX_CONSTEXPR float
00388   pow(float __x, float __y)
00389   { return __builtin_powf(__x, __y); }
00390 
00391   inline _GLIBCXX_CONSTEXPR long double
00392   pow(long double __x, long double __y)
00393   { return __builtin_powl(__x, __y); }
00394 
00395 #if __cplusplus < 201103L
00396   // _GLIBCXX_RESOLVE_LIB_DEFECTS
00397   // DR 550. What should the return type of pow(float,int) be?
00398   inline double
00399   pow(double __x, int __i)
00400   { return __builtin_powi(__x, __i); }
00401 
00402   inline float
00403   pow(float __x, int __n)
00404   { return __builtin_powif(__x, __n); }
00405 
00406   inline long double
00407   pow(long double __x, int __n)
00408   { return __builtin_powil(__x, __n); }
00409 #endif
00410 #endif
00411 
00412   template<typename _Tp, typename _Up>
00413     inline _GLIBCXX_CONSTEXPR
00414     typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
00415     pow(_Tp __x, _Up __y)
00416     {
00417       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
00418       return pow(__type(__x), __type(__y));
00419     }
00420 
00421   using ::sin;
00422 
00423 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
00424   inline _GLIBCXX_CONSTEXPR float
00425   sin(float __x)
00426   { return __builtin_sinf(__x); }
00427 
00428   inline _GLIBCXX_CONSTEXPR long double
00429   sin(long double __x)
00430   { return __builtin_sinl(__x); }
00431 #endif
00432 
00433   template<typename _Tp>
00434     inline _GLIBCXX_CONSTEXPR
00435     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
00436                                     double>::__type
00437     sin(_Tp __x)
00438     { return __builtin_sin(__x); }
00439 
00440   using ::sinh;
00441 
00442 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
00443   inline _GLIBCXX_CONSTEXPR float
00444   sinh(float __x)
00445   { return __builtin_sinhf(__x); }
00446 
00447   inline _GLIBCXX_CONSTEXPR long double
00448   sinh(long double __x)
00449   { return __builtin_sinhl(__x); }
00450 #endif
00451 
00452   template<typename _Tp>
00453     inline _GLIBCXX_CONSTEXPR
00454     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
00455                                     double>::__type
00456     sinh(_Tp __x)
00457     { return __builtin_sinh(__x); }
00458 
00459   using ::sqrt;
00460 
00461 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
00462   inline _GLIBCXX_CONSTEXPR float
00463   sqrt(float __x)
00464   { return __builtin_sqrtf(__x); }
00465 
00466   inline _GLIBCXX_CONSTEXPR long double
00467   sqrt(long double __x)
00468   { return __builtin_sqrtl(__x); }
00469 #endif
00470 
00471   template<typename _Tp>
00472     inline _GLIBCXX_CONSTEXPR
00473     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
00474                                     double>::__type
00475     sqrt(_Tp __x)
00476     { return __builtin_sqrt(__x); }
00477 
00478   using ::tan;
00479 
00480 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
00481   inline _GLIBCXX_CONSTEXPR float
00482   tan(float __x)
00483   { return __builtin_tanf(__x); }
00484 
00485   inline _GLIBCXX_CONSTEXPR long double
00486   tan(long double __x)
00487   { return __builtin_tanl(__x); }
00488 #endif
00489 
00490   template<typename _Tp>
00491     inline _GLIBCXX_CONSTEXPR
00492     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
00493                                     double>::__type
00494     tan(_Tp __x)
00495     { return __builtin_tan(__x); }
00496 
00497   using ::tanh;
00498 
00499 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
00500   inline _GLIBCXX_CONSTEXPR float
00501   tanh(float __x)
00502   { return __builtin_tanhf(__x); }
00503 
00504   inline _GLIBCXX_CONSTEXPR long double
00505   tanh(long double __x)
00506   { return __builtin_tanhl(__x); }
00507 #endif
00508 
00509   template<typename _Tp>
00510     inline _GLIBCXX_CONSTEXPR
00511     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
00512                                     double>::__type
00513     tanh(_Tp __x)
00514     { return __builtin_tanh(__x); }
00515 
00516 _GLIBCXX_END_NAMESPACE_VERSION
00517 } // namespace
00518 
00519 #if _GLIBCXX_USE_C99_MATH
00520 #if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
00521 
00522 // These are possible macros imported from C99-land.
00523 #undef fpclassify
00524 #undef isfinite
00525 #undef isinf
00526 #undef isnan
00527 #undef isnormal
00528 #undef signbit
00529 #undef isgreater
00530 #undef isgreaterequal
00531 #undef isless
00532 #undef islessequal
00533 #undef islessgreater
00534 #undef isunordered
00535 
00536 namespace std _GLIBCXX_VISIBILITY(default)
00537 {
00538 _GLIBCXX_BEGIN_NAMESPACE_VERSION
00539 
00540 #if __cplusplus >= 201103L
00541 
00542 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
00543   constexpr int
00544   fpclassify(float __x)
00545   { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
00546                                 FP_SUBNORMAL, FP_ZERO, __x); }
00547 
00548   constexpr int
00549   fpclassify(double __x)
00550   { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
00551                                 FP_SUBNORMAL, FP_ZERO, __x); }
00552 
00553   constexpr int
00554   fpclassify(long double __x)
00555   { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
00556                                 FP_SUBNORMAL, FP_ZERO, __x); }
00557 #endif
00558 
00559 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
00560   template<typename _Tp>
00561     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00562                                               int>::__type
00563     fpclassify(_Tp __x)
00564     { return __x != 0 ? FP_NORMAL : FP_ZERO; }
00565 #endif
00566 
00567 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
00568   constexpr bool
00569   isfinite(float __x)
00570   { return __builtin_isfinite(__x); }
00571 
00572   constexpr bool
00573   isfinite(double __x)
00574   { return __builtin_isfinite(__x); }
00575 
00576   constexpr bool
00577   isfinite(long double __x)
00578   { return __builtin_isfinite(__x); }
00579 #endif
00580 
00581 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
00582   template<typename _Tp>
00583     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00584                                               bool>::__type
00585     isfinite(_Tp __x)
00586     { return true; }
00587 #endif
00588 
00589 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
00590   constexpr bool
00591   isinf(float __x)
00592   { return __builtin_isinf(__x); }
00593 
00594 #if _GLIBCXX_HAVE_OBSOLETE_ISINF \
00595   && !_GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC
00596   using ::isinf;
00597 #else
00598   constexpr bool
00599   isinf(double __x)
00600   { return __builtin_isinf(__x); }
00601 #endif
00602 
00603   constexpr bool
00604   isinf(long double __x)
00605   { return __builtin_isinf(__x); }
00606 #endif
00607 
00608 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
00609   template<typename _Tp>
00610     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00611                                               bool>::__type
00612     isinf(_Tp __x)
00613     { return false; }
00614 #endif
00615 
00616 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
00617   constexpr bool
00618   isnan(float __x)
00619   { return __builtin_isnan(__x); }
00620 
00621 #if _GLIBCXX_HAVE_OBSOLETE_ISNAN \
00622   && !_GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC
00623   using ::isnan;
00624 #else
00625   constexpr bool
00626   isnan(double __x)
00627   { return __builtin_isnan(__x); }
00628 #endif
00629 
00630   constexpr bool
00631   isnan(long double __x)
00632   { return __builtin_isnan(__x); }
00633 #endif
00634 
00635 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
00636   template<typename _Tp>
00637     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00638                                               bool>::__type
00639     isnan(_Tp __x)
00640     { return false; }
00641 #endif
00642 
00643 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
00644   constexpr bool
00645   isnormal(float __x)
00646   { return __builtin_isnormal(__x); }
00647 
00648   constexpr bool
00649   isnormal(double __x)
00650   { return __builtin_isnormal(__x); }
00651 
00652   constexpr bool
00653   isnormal(long double __x)
00654   { return __builtin_isnormal(__x); }
00655 #endif
00656 
00657 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
00658   template<typename _Tp>
00659     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00660                                               bool>::__type
00661     isnormal(_Tp __x)
00662     { return __x != 0 ? true : false; }
00663 #endif
00664 
00665 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
00666   // Note: middle-end/36757 is fixed, __builtin_signbit is type-generic.
00667   constexpr bool
00668   signbit(float __x)
00669   { return __builtin_signbit(__x); }
00670 
00671   constexpr bool
00672   signbit(double __x)
00673   { return __builtin_signbit(__x); }
00674 
00675   constexpr bool
00676   signbit(long double __x)
00677   { return __builtin_signbit(__x); }
00678 #endif
00679 
00680 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
00681   template<typename _Tp>
00682     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00683                                               bool>::__type
00684     signbit(_Tp __x)
00685     { return __x < 0 ? true : false; }
00686 #endif
00687 
00688 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
00689   constexpr bool
00690   isgreater(float __x, float __y)
00691   { return __builtin_isgreater(__x, __y); }
00692 
00693   constexpr bool
00694   isgreater(double __x, double __y)
00695   { return __builtin_isgreater(__x, __y); }
00696 
00697   constexpr bool
00698   isgreater(long double __x, long double __y)
00699   { return __builtin_isgreater(__x, __y); }
00700 #endif
00701 
00702 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
00703   template<typename _Tp, typename _Up>
00704     constexpr typename
00705     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
00706                             && __is_arithmetic<_Up>::__value), bool>::__type
00707     isgreater(_Tp __x, _Up __y)
00708     {
00709       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
00710       return __builtin_isgreater(__type(__x), __type(__y));
00711     }
00712 #endif
00713 
00714 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
00715   constexpr bool
00716   isgreaterequal(float __x, float __y)
00717   { return __builtin_isgreaterequal(__x, __y); }
00718 
00719   constexpr bool
00720   isgreaterequal(double __x, double __y)
00721   { return __builtin_isgreaterequal(__x, __y); }
00722 
00723   constexpr bool
00724   isgreaterequal(long double __x, long double __y)
00725   { return __builtin_isgreaterequal(__x, __y); }
00726 #endif
00727 
00728 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
00729   template<typename _Tp, typename _Up>
00730     constexpr typename
00731     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
00732                             && __is_arithmetic<_Up>::__value), bool>::__type
00733     isgreaterequal(_Tp __x, _Up __y)
00734     {
00735       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
00736       return __builtin_isgreaterequal(__type(__x), __type(__y));
00737     }
00738 #endif
00739 
00740 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
00741   constexpr bool
00742   isless(float __x, float __y)
00743   { return __builtin_isless(__x, __y); }
00744 
00745   constexpr bool
00746   isless(double __x, double __y)
00747   { return __builtin_isless(__x, __y); }
00748 
00749   constexpr bool
00750   isless(long double __x, long double __y)
00751   { return __builtin_isless(__x, __y); }
00752 #endif
00753 
00754 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
00755   template<typename _Tp, typename _Up>
00756     constexpr typename
00757     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
00758                             && __is_arithmetic<_Up>::__value), bool>::__type
00759     isless(_Tp __x, _Up __y)
00760     {
00761       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
00762       return __builtin_isless(__type(__x), __type(__y));
00763     }
00764 #endif
00765 
00766 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
00767   constexpr bool
00768   islessequal(float __x, float __y)
00769   { return __builtin_islessequal(__x, __y); }
00770 
00771   constexpr bool
00772   islessequal(double __x, double __y)
00773   { return __builtin_islessequal(__x, __y); }
00774 
00775   constexpr bool
00776   islessequal(long double __x, long double __y)
00777   { return __builtin_islessequal(__x, __y); }
00778 #endif
00779 
00780 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
00781   template<typename _Tp, typename _Up>
00782     constexpr typename
00783     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
00784                             && __is_arithmetic<_Up>::__value), bool>::__type
00785     islessequal(_Tp __x, _Up __y)
00786     {
00787       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
00788       return __builtin_islessequal(__type(__x), __type(__y));
00789     }
00790 #endif
00791 
00792 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
00793   constexpr bool
00794   islessgreater(float __x, float __y)
00795   { return __builtin_islessgreater(__x, __y); }
00796 
00797   constexpr bool
00798   islessgreater(double __x, double __y)
00799   { return __builtin_islessgreater(__x, __y); }
00800 
00801   constexpr bool
00802   islessgreater(long double __x, long double __y)
00803   { return __builtin_islessgreater(__x, __y); }
00804 #endif
00805 
00806 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
00807   template<typename _Tp, typename _Up>
00808     constexpr typename
00809     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
00810                             && __is_arithmetic<_Up>::__value), bool>::__type
00811     islessgreater(_Tp __x, _Up __y)
00812     {
00813       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
00814       return __builtin_islessgreater(__type(__x), __type(__y));
00815     }
00816 #endif
00817 
00818 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
00819   constexpr bool
00820   isunordered(float __x, float __y)
00821   { return __builtin_isunordered(__x, __y); }
00822 
00823   constexpr bool
00824   isunordered(double __x, double __y)
00825   { return __builtin_isunordered(__x, __y); }
00826 
00827   constexpr bool
00828   isunordered(long double __x, long double __y)
00829   { return __builtin_isunordered(__x, __y); }
00830 #endif
00831 
00832 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
00833   template<typename _Tp, typename _Up>
00834     constexpr typename
00835     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
00836                             && __is_arithmetic<_Up>::__value), bool>::__type
00837     isunordered(_Tp __x, _Up __y)
00838     {
00839       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
00840       return __builtin_isunordered(__type(__x), __type(__y));
00841     }
00842 #endif
00843 
00844 #else
00845 
00846   template<typename _Tp>
00847     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00848                                            int>::__type
00849     fpclassify(_Tp __f)
00850     {
00851       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00852       return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
00853                                   FP_SUBNORMAL, FP_ZERO, __type(__f));
00854     }
00855 
00856   template<typename _Tp>
00857     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00858                                            int>::__type
00859     isfinite(_Tp __f)
00860     {
00861       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00862       return __builtin_isfinite(__type(__f));
00863     }
00864 
00865   template<typename _Tp>
00866     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00867                                            int>::__type
00868     isinf(_Tp __f)
00869     {
00870       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00871       return __builtin_isinf(__type(__f));
00872     }
00873 
00874   template<typename _Tp>
00875     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00876                                            int>::__type
00877     isnan(_Tp __f)
00878     {
00879       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00880       return __builtin_isnan(__type(__f));
00881     }
00882 
00883   template<typename _Tp>
00884     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00885                                            int>::__type
00886     isnormal(_Tp __f)
00887     {
00888       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00889       return __builtin_isnormal(__type(__f));
00890     }
00891 
00892   template<typename _Tp>
00893     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00894                                            int>::__type
00895     signbit(_Tp __f)
00896     {
00897       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00898       return __builtin_signbit(__type(__f));
00899     }
00900 
00901   template<typename _Tp>
00902     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00903                                            int>::__type
00904     isgreater(_Tp __f1, _Tp __f2)
00905     {
00906       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00907       return __builtin_isgreater(__type(__f1), __type(__f2));
00908     }
00909 
00910   template<typename _Tp>
00911     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00912                                            int>::__type
00913     isgreaterequal(_Tp __f1, _Tp __f2)
00914     {
00915       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00916       return __builtin_isgreaterequal(__type(__f1), __type(__f2));
00917     }
00918 
00919   template<typename _Tp>
00920     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00921                                            int>::__type
00922     isless(_Tp __f1, _Tp __f2)
00923     {
00924       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00925       return __builtin_isless(__type(__f1), __type(__f2));
00926     }
00927 
00928   template<typename _Tp>
00929     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00930                                            int>::__type
00931     islessequal(_Tp __f1, _Tp __f2)
00932     {
00933       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00934       return __builtin_islessequal(__type(__f1), __type(__f2));
00935     }
00936 
00937   template<typename _Tp>
00938     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00939                                            int>::__type
00940     islessgreater(_Tp __f1, _Tp __f2)
00941     {
00942       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00943       return __builtin_islessgreater(__type(__f1), __type(__f2));
00944     }
00945 
00946   template<typename _Tp>
00947     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00948                                            int>::__type
00949     isunordered(_Tp __f1, _Tp __f2)
00950     {
00951       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00952       return __builtin_isunordered(__type(__f1), __type(__f2));
00953     }
00954 
00955 #endif
00956 
00957 _GLIBCXX_END_NAMESPACE_VERSION
00958 } // namespace
00959 
00960 #endif /* _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC */
00961 #endif
00962 
00963 #if __cplusplus >= 201103L
00964 
00965 #ifdef _GLIBCXX_USE_C99_MATH_TR1
00966 
00967 #undef acosh
00968 #undef acoshf
00969 #undef acoshl
00970 #undef asinh
00971 #undef asinhf
00972 #undef asinhl
00973 #undef atanh
00974 #undef atanhf
00975 #undef atanhl
00976 #undef cbrt
00977 #undef cbrtf
00978 #undef cbrtl
00979 #undef copysign
00980 #undef copysignf
00981 #undef copysignl
00982 #undef erf
00983 #undef erff
00984 #undef erfl
00985 #undef erfc
00986 #undef erfcf
00987 #undef erfcl
00988 #undef exp2
00989 #undef exp2f
00990 #undef exp2l
00991 #undef expm1
00992 #undef expm1f
00993 #undef expm1l
00994 #undef fdim
00995 #undef fdimf
00996 #undef fdiml
00997 #undef fma
00998 #undef fmaf
00999 #undef fmal
01000 #undef fmax
01001 #undef fmaxf
01002 #undef fmaxl
01003 #undef fmin
01004 #undef fminf
01005 #undef fminl
01006 #undef hypot
01007 #undef hypotf
01008 #undef hypotl
01009 #undef ilogb
01010 #undef ilogbf
01011 #undef ilogbl
01012 #undef lgamma
01013 #undef lgammaf
01014 #undef lgammal
01015 #ifndef _GLIBCXX_NO_C99_ROUNDING_FUNCS
01016 #undef llrint
01017 #undef llrintf
01018 #undef llrintl
01019 #undef llround
01020 #undef llroundf
01021 #undef llroundl
01022 #endif
01023 #undef log1p
01024 #undef log1pf
01025 #undef log1pl
01026 #undef log2
01027 #undef log2f
01028 #undef log2l
01029 #undef logb
01030 #undef logbf
01031 #undef logbl
01032 #undef lrint
01033 #undef lrintf
01034 #undef lrintl
01035 #undef lround
01036 #undef lroundf
01037 #undef lroundl
01038 #undef nan
01039 #undef nanf
01040 #undef nanl
01041 #undef nearbyint
01042 #undef nearbyintf
01043 #undef nearbyintl
01044 #undef nextafter
01045 #undef nextafterf
01046 #undef nextafterl
01047 #undef nexttoward
01048 #undef nexttowardf
01049 #undef nexttowardl
01050 #undef remainder
01051 #undef remainderf
01052 #undef remainderl
01053 #undef remquo
01054 #undef remquof
01055 #undef remquol
01056 #undef rint
01057 #undef rintf
01058 #undef rintl
01059 #undef round
01060 #undef roundf
01061 #undef roundl
01062 #undef scalbln
01063 #undef scalblnf
01064 #undef scalblnl
01065 #undef scalbn
01066 #undef scalbnf
01067 #undef scalbnl
01068 #undef tgamma
01069 #undef tgammaf
01070 #undef tgammal
01071 #undef trunc
01072 #undef truncf
01073 #undef truncl
01074 
01075 namespace std _GLIBCXX_VISIBILITY(default)
01076 {
01077 _GLIBCXX_BEGIN_NAMESPACE_VERSION
01078 
01079   // types
01080   using ::double_t;
01081   using ::float_t;
01082 
01083   // functions
01084   using ::acosh;
01085   using ::acoshf;
01086   using ::acoshl;
01087 
01088   using ::asinh;
01089   using ::asinhf;
01090   using ::asinhl;
01091 
01092   using ::atanh;
01093   using ::atanhf;
01094   using ::atanhl;
01095 
01096   using ::cbrt;
01097   using ::cbrtf;
01098   using ::cbrtl;
01099 
01100   using ::copysign;
01101   using ::copysignf;
01102   using ::copysignl;
01103 
01104   using ::erf;
01105   using ::erff;
01106   using ::erfl;
01107 
01108   using ::erfc;
01109   using ::erfcf;
01110   using ::erfcl;
01111 
01112   using ::exp2;
01113   using ::exp2f;
01114   using ::exp2l;
01115 
01116   using ::expm1;
01117   using ::expm1f;
01118   using ::expm1l;
01119 
01120   using ::fdim;
01121   using ::fdimf;
01122   using ::fdiml;
01123 
01124   using ::fma;
01125   using ::fmaf;
01126   using ::fmal;
01127 
01128   using ::fmax;
01129   using ::fmaxf;
01130   using ::fmaxl;
01131 
01132   using ::fmin;
01133   using ::fminf;
01134   using ::fminl;
01135 
01136   using ::hypot;
01137   using ::hypotf;
01138   using ::hypotl;
01139 
01140   using ::ilogb;
01141   using ::ilogbf;
01142   using ::ilogbl;
01143 
01144   using ::lgamma;
01145   using ::lgammaf;
01146   using ::lgammal;
01147 
01148 #ifndef _GLIBCXX_NO_C99_ROUNDING_FUNCS
01149   using ::llrint;
01150   using ::llrintf;
01151   using ::llrintl;
01152 
01153   using ::llround;
01154   using ::llroundf;
01155   using ::llroundl;
01156 #endif
01157 
01158   using ::log1p;
01159   using ::log1pf;
01160   using ::log1pl;
01161 
01162   using ::log2;
01163   using ::log2f;
01164   using ::log2l;
01165 
01166   using ::logb;
01167   using ::logbf;
01168   using ::logbl;
01169 
01170   using ::lrint;
01171   using ::lrintf;
01172   using ::lrintl;
01173 
01174   using ::lround;
01175   using ::lroundf;
01176   using ::lroundl;
01177 
01178   using ::nan;
01179   using ::nanf;
01180   using ::nanl;
01181 
01182   using ::nearbyint;
01183   using ::nearbyintf;
01184   using ::nearbyintl;
01185 
01186   using ::nextafter;
01187   using ::nextafterf;
01188   using ::nextafterl;
01189 
01190   using ::nexttoward;
01191   using ::nexttowardf;
01192   using ::nexttowardl;
01193 
01194   using ::remainder;
01195   using ::remainderf;
01196   using ::remainderl;
01197 
01198   using ::remquo;
01199   using ::remquof;
01200   using ::remquol;
01201 
01202   using ::rint;
01203   using ::rintf;
01204   using ::rintl;
01205 
01206   using ::round;
01207   using ::roundf;
01208   using ::roundl;
01209 
01210   using ::scalbln;
01211   using ::scalblnf;
01212   using ::scalblnl;
01213 
01214   using ::scalbn;
01215   using ::scalbnf;
01216   using ::scalbnl;
01217 
01218   using ::tgamma;
01219   using ::tgammaf;
01220   using ::tgammal;
01221 
01222   using ::trunc;
01223   using ::truncf;
01224   using ::truncl;
01225 
01226   /// Additional overloads.
01227 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01228   constexpr float
01229   acosh(float __x)
01230   { return __builtin_acoshf(__x); }
01231 
01232   constexpr long double
01233   acosh(long double __x)
01234   { return __builtin_acoshl(__x); }
01235 #endif
01236 
01237 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01238   template<typename _Tp>
01239     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
01240                                               double>::__type
01241     acosh(_Tp __x)
01242     { return __builtin_acosh(__x); }
01243 #endif
01244 
01245 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01246   constexpr float
01247   asinh(float __x)
01248   { return __builtin_asinhf(__x); }
01249 
01250   constexpr long double
01251   asinh(long double __x)
01252   { return __builtin_asinhl(__x); }
01253 #endif
01254 
01255 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01256   template<typename _Tp>
01257     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
01258                                               double>::__type
01259     asinh(_Tp __x)
01260     { return __builtin_asinh(__x); }
01261 #endif
01262 
01263 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01264   constexpr float
01265   atanh(float __x)
01266   { return __builtin_atanhf(__x); }
01267 
01268   constexpr long double
01269   atanh(long double __x)
01270   { return __builtin_atanhl(__x); }
01271 #endif
01272 
01273 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01274   template<typename _Tp>
01275     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
01276                                               double>::__type
01277     atanh(_Tp __x)
01278     { return __builtin_atanh(__x); }
01279 #endif
01280 
01281 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01282   constexpr float
01283   cbrt(float __x)
01284   { return __builtin_cbrtf(__x); }
01285 
01286   constexpr long double
01287   cbrt(long double __x)
01288   { return __builtin_cbrtl(__x); }
01289 #endif
01290 
01291 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01292   template<typename _Tp>
01293     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
01294                                               double>::__type
01295     cbrt(_Tp __x)
01296     { return __builtin_cbrt(__x); }
01297 #endif
01298 
01299 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01300   constexpr float
01301   copysign(float __x, float __y)
01302   { return __builtin_copysignf(__x, __y); }
01303 
01304   constexpr long double
01305   copysign(long double __x, long double __y)
01306   { return __builtin_copysignl(__x, __y); }
01307 #endif
01308 
01309 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01310   template<typename _Tp, typename _Up>
01311     constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
01312     copysign(_Tp __x, _Up __y)
01313     {
01314       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
01315       return copysign(__type(__x), __type(__y));
01316     }
01317 #endif
01318 
01319 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01320   constexpr float
01321   erf(float __x)
01322   { return __builtin_erff(__x); }
01323 
01324   constexpr long double
01325   erf(long double __x)
01326   { return __builtin_erfl(__x); }
01327 #endif
01328 
01329 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01330   template<typename _Tp>
01331     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
01332                                               double>::__type
01333     erf(_Tp __x)
01334     { return __builtin_erf(__x); }
01335 #endif
01336 
01337 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01338   constexpr float
01339   erfc(float __x)
01340   { return __builtin_erfcf(__x); }
01341 
01342   constexpr long double
01343   erfc(long double __x)
01344   { return __builtin_erfcl(__x); }
01345 #endif
01346 
01347 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01348   template<typename _Tp>
01349     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
01350                                               double>::__type
01351     erfc(_Tp __x)
01352     { return __builtin_erfc(__x); }
01353 #endif
01354 
01355 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01356   constexpr float
01357   exp2(float __x)
01358   { return __builtin_exp2f(__x); }
01359 
01360   constexpr long double
01361   exp2(long double __x)
01362   { return __builtin_exp2l(__x); }
01363 #endif
01364 
01365 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01366   template<typename _Tp>
01367     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
01368                                               double>::__type
01369     exp2(_Tp __x)
01370     { return __builtin_exp2(__x); }
01371 #endif
01372 
01373 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01374   constexpr float
01375   expm1(float __x)
01376   { return __builtin_expm1f(__x); }
01377 
01378   constexpr long double
01379   expm1(long double __x)
01380   { return __builtin_expm1l(__x); }
01381 #endif
01382 
01383 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01384   template<typename _Tp>
01385     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
01386                                               double>::__type
01387     expm1(_Tp __x)
01388     { return __builtin_expm1(__x); }
01389 #endif
01390 
01391 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01392   constexpr float
01393   fdim(float __x, float __y)
01394   { return __builtin_fdimf(__x, __y); }
01395 
01396   constexpr long double
01397   fdim(long double __x, long double __y)
01398   { return __builtin_fdiml(__x, __y); }
01399 #endif
01400 
01401 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01402   template<typename _Tp, typename _Up>
01403     constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
01404     fdim(_Tp __x, _Up __y)
01405     {
01406       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
01407       return fdim(__type(__x), __type(__y));
01408     }
01409 #endif
01410 
01411 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01412   constexpr float
01413   fma(float __x, float __y, float __z)
01414   { return __builtin_fmaf(__x, __y, __z); }
01415 
01416   constexpr long double
01417   fma(long double __x, long double __y, long double __z)
01418   { return __builtin_fmal(__x, __y, __z); }
01419 #endif
01420 
01421 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01422   template<typename _Tp, typename _Up, typename _Vp>
01423     constexpr typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type
01424     fma(_Tp __x, _Up __y, _Vp __z)
01425     {
01426       typedef typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type __type;
01427       return fma(__type(__x), __type(__y), __type(__z));
01428     }
01429 #endif
01430 
01431 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01432   constexpr float
01433   fmax(float __x, float __y)
01434   { return __builtin_fmaxf(__x, __y); }
01435 
01436   constexpr long double
01437   fmax(long double __x, long double __y)
01438   { return __builtin_fmaxl(__x, __y); }
01439 #endif
01440 
01441 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01442   template<typename _Tp, typename _Up>
01443     constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
01444     fmax(_Tp __x, _Up __y)
01445     {
01446       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
01447       return fmax(__type(__x), __type(__y));
01448     }
01449 #endif
01450 
01451 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01452   constexpr float
01453   fmin(float __x, float __y)
01454   { return __builtin_fminf(__x, __y); }
01455 
01456   constexpr long double
01457   fmin(long double __x, long double __y)
01458   { return __builtin_fminl(__x, __y); }
01459 #endif
01460 
01461 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01462   template<typename _Tp, typename _Up>
01463     constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
01464     fmin(_Tp __x, _Up __y)
01465     {
01466       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
01467       return fmin(__type(__x), __type(__y));
01468     }
01469 #endif
01470 
01471 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01472   constexpr float
01473   hypot(float __x, float __y)
01474   { return __builtin_hypotf(__x, __y); }
01475 
01476   constexpr long double
01477   hypot(long double __x, long double __y)
01478   { return __builtin_hypotl(__x, __y); }
01479 #endif
01480 
01481 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01482   template<typename _Tp, typename _Up>
01483     constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
01484     hypot(_Tp __x, _Up __y)
01485     {
01486       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
01487       return hypot(__type(__x), __type(__y));
01488     }
01489 #endif
01490 
01491 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01492   constexpr int
01493   ilogb(float __x)
01494   { return __builtin_ilogbf(__x); }
01495 
01496   constexpr int
01497   ilogb(long double __x)
01498   { return __builtin_ilogbl(__x); }
01499 #endif
01500 
01501 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01502   template<typename _Tp>
01503     constexpr
01504     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
01505                                     int>::__type
01506     ilogb(_Tp __x)
01507     { return __builtin_ilogb(__x); }
01508 #endif
01509 
01510 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01511   constexpr float
01512   lgamma(float __x)
01513   { return __builtin_lgammaf(__x); }
01514 
01515   constexpr long double
01516   lgamma(long double __x)
01517   { return __builtin_lgammal(__x); }
01518 #endif
01519 
01520 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01521   template<typename _Tp>
01522     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
01523                                               double>::__type
01524     lgamma(_Tp __x)
01525     { return __builtin_lgamma(__x); }
01526 #endif
01527 
01528 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01529   constexpr long long
01530   llrint(float __x)
01531   { return __builtin_llrintf(__x); }
01532 
01533   constexpr long long
01534   llrint(long double __x)
01535   { return __builtin_llrintl(__x); }
01536 #endif
01537 
01538 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01539   template<typename _Tp>
01540     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
01541                                               long long>::__type
01542     llrint(_Tp __x)
01543     { return __builtin_llrint(__x); }
01544 #endif
01545 
01546 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01547   constexpr long long
01548   llround(float __x)
01549   { return __builtin_llroundf(__x); }
01550 
01551   constexpr long long
01552   llround(long double __x)
01553   { return __builtin_llroundl(__x); }
01554 #endif
01555 
01556 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01557   template<typename _Tp>
01558     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
01559                                               long long>::__type
01560     llround(_Tp __x)
01561     { return __builtin_llround(__x); }
01562 #endif
01563 
01564 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01565   constexpr float
01566   log1p(float __x)
01567   { return __builtin_log1pf(__x); }
01568 
01569   constexpr long double
01570   log1p(long double __x)
01571   { return __builtin_log1pl(__x); }
01572 #endif
01573 
01574 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01575   template<typename _Tp>
01576     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
01577                                               double>::__type
01578     log1p(_Tp __x)
01579     { return __builtin_log1p(__x); }
01580 #endif
01581 
01582 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01583   // DR 568.
01584   constexpr float
01585   log2(float __x)
01586   { return __builtin_log2f(__x); }
01587 
01588   constexpr long double
01589   log2(long double __x)
01590   { return __builtin_log2l(__x); }
01591 #endif
01592 
01593 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01594   template<typename _Tp>
01595     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
01596                                               double>::__type
01597     log2(_Tp __x)
01598     { return __builtin_log2(__x); }
01599 #endif
01600 
01601 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01602   constexpr float
01603   logb(float __x)
01604   { return __builtin_logbf(__x); }
01605 
01606   constexpr long double
01607   logb(long double __x)
01608   { return __builtin_logbl(__x); }
01609 #endif
01610 
01611 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01612   template<typename _Tp>
01613     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
01614                                               double>::__type
01615     logb(_Tp __x)
01616     { return __builtin_logb(__x); }
01617 #endif
01618 
01619 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01620   constexpr long
01621   lrint(float __x)
01622   { return __builtin_lrintf(__x); }
01623 
01624   constexpr long
01625   lrint(long double __x)
01626   { return __builtin_lrintl(__x); }
01627 #endif
01628 
01629 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01630   template<typename _Tp>
01631     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
01632                                               long>::__type
01633     lrint(_Tp __x)
01634     { return __builtin_lrint(__x); }
01635 #endif
01636 
01637 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01638   constexpr long
01639   lround(float __x)
01640   { return __builtin_lroundf(__x); }
01641 
01642   constexpr long
01643   lround(long double __x)
01644   { return __builtin_lroundl(__x); }
01645 #endif
01646 
01647 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01648   template<typename _Tp>
01649     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
01650                                               long>::__type
01651     lround(_Tp __x)
01652     { return __builtin_lround(__x); }
01653 #endif
01654 
01655 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01656   constexpr float
01657   nearbyint(float __x)
01658   { return __builtin_nearbyintf(__x); }
01659 
01660   constexpr long double
01661   nearbyint(long double __x)
01662   { return __builtin_nearbyintl(__x); }
01663 #endif
01664 
01665 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01666   template<typename _Tp>
01667     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
01668                                               double>::__type
01669     nearbyint(_Tp __x)
01670     { return __builtin_nearbyint(__x); }
01671 #endif
01672 
01673 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01674   constexpr float
01675   nextafter(float __x, float __y)
01676   { return __builtin_nextafterf(__x, __y); }
01677 
01678   constexpr long double
01679   nextafter(long double __x, long double __y)
01680   { return __builtin_nextafterl(__x, __y); }
01681 #endif
01682 
01683 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01684   template<typename _Tp, typename _Up>
01685     constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
01686     nextafter(_Tp __x, _Up __y)
01687     {
01688       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
01689       return nextafter(__type(__x), __type(__y));
01690     }
01691 #endif
01692 
01693 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01694   constexpr float
01695   nexttoward(float __x, long double __y)
01696   { return __builtin_nexttowardf(__x, __y); }
01697 
01698   constexpr long double
01699   nexttoward(long double __x, long double __y)
01700   { return __builtin_nexttowardl(__x, __y); }
01701 #endif
01702 
01703 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01704   template<typename _Tp>
01705     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
01706                                               double>::__type
01707     nexttoward(_Tp __x, long double __y)
01708     { return __builtin_nexttoward(__x, __y); }
01709 #endif
01710 
01711 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01712   constexpr float
01713   remainder(float __x, float __y)
01714   { return __builtin_remainderf(__x, __y); }
01715 
01716   constexpr long double
01717   remainder(long double __x, long double __y)
01718   { return __builtin_remainderl(__x, __y); }
01719 #endif
01720 
01721 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01722   template<typename _Tp, typename _Up>
01723     constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
01724     remainder(_Tp __x, _Up __y)
01725     {
01726       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
01727       return remainder(__type(__x), __type(__y));
01728     }
01729 #endif
01730 
01731 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01732   inline float
01733   remquo(float __x, float __y, int* __pquo)
01734   { return __builtin_remquof(__x, __y, __pquo); }
01735 
01736   inline long double
01737   remquo(long double __x, long double __y, int* __pquo)
01738   { return __builtin_remquol(__x, __y, __pquo); }
01739 #endif
01740 
01741 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01742   template<typename _Tp, typename _Up>
01743     inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
01744     remquo(_Tp __x, _Up __y, int* __pquo)
01745     {
01746       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
01747       return remquo(__type(__x), __type(__y), __pquo);
01748     }
01749 #endif
01750 
01751 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01752   constexpr float
01753   rint(float __x)
01754   { return __builtin_rintf(__x); }
01755 
01756   constexpr long double
01757   rint(long double __x)
01758   { return __builtin_rintl(__x); }
01759 #endif
01760 
01761 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01762   template<typename _Tp>
01763     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
01764                                               double>::__type
01765     rint(_Tp __x)
01766     { return __builtin_rint(__x); }
01767 #endif
01768 
01769 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01770   constexpr float
01771   round(float __x)
01772   { return __builtin_roundf(__x); }
01773 
01774   constexpr long double
01775   round(long double __x)
01776   { return __builtin_roundl(__x); }
01777 #endif
01778 
01779 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01780   template<typename _Tp>
01781     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
01782                                               double>::__type
01783     round(_Tp __x)
01784     { return __builtin_round(__x); }
01785 #endif
01786 
01787 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01788   constexpr float
01789   scalbln(float __x, long __ex)
01790   { return __builtin_scalblnf(__x, __ex); }
01791 
01792   constexpr long double
01793   scalbln(long double __x, long __ex)
01794   { return __builtin_scalblnl(__x, __ex); }
01795 #endif
01796 
01797 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01798   template<typename _Tp>
01799     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
01800                                               double>::__type
01801     scalbln(_Tp __x, long __ex)
01802     { return __builtin_scalbln(__x, __ex); }
01803 #endif
01804  
01805 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01806   constexpr float
01807   scalbn(float __x, int __ex)
01808   { return __builtin_scalbnf(__x, __ex); }
01809 
01810   constexpr long double
01811   scalbn(long double __x, int __ex)
01812   { return __builtin_scalbnl(__x, __ex); }
01813 #endif
01814 
01815 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01816   template<typename _Tp>
01817     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
01818                                               double>::__type
01819     scalbn(_Tp __x, int __ex)
01820     { return __builtin_scalbn(__x, __ex); }
01821 #endif
01822 
01823 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01824   constexpr float
01825   tgamma(float __x)
01826   { return __builtin_tgammaf(__x); }
01827 
01828   constexpr long double
01829   tgamma(long double __x)
01830   { return __builtin_tgammal(__x); }
01831 #endif
01832 
01833 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01834   template<typename _Tp>
01835     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
01836                                               double>::__type
01837     tgamma(_Tp __x)
01838     { return __builtin_tgamma(__x); }
01839 #endif
01840  
01841 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
01842   constexpr float
01843   trunc(float __x)
01844   { return __builtin_truncf(__x); }
01845 
01846   constexpr long double
01847   trunc(long double __x)
01848   { return __builtin_truncl(__x); }
01849 #endif
01850 
01851 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
01852   template<typename _Tp>
01853     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
01854                                               double>::__type
01855     trunc(_Tp __x)
01856     { return __builtin_trunc(__x); }
01857 #endif
01858 
01859 _GLIBCXX_END_NAMESPACE_VERSION
01860 } // namespace
01861 
01862 #endif // _GLIBCXX_USE_C99_MATH_TR1
01863 
01864 #endif // C++11
01865 
01866 #if __cplusplus > 201402L
01867 namespace std _GLIBCXX_VISIBILITY(default)
01868 {
01869 _GLIBCXX_BEGIN_NAMESPACE_VERSION
01870 
01871   // [c.math.hypot3], three-dimensional hypotenuse
01872 #define __cpp_lib_hypot 201603
01873 
01874   template<typename _Tp>
01875     inline _Tp
01876     __hypot3(_Tp __x, _Tp __y, _Tp __z)
01877     {
01878       __x = std::abs(__x);
01879       __y = std::abs(__y);
01880       __z = std::abs(__z);
01881       if (_Tp __a = __x < __y ? __y < __z ? __z : __y : __x < __z ? __z : __x)
01882         return __a * std::sqrt((__x / __a) * (__x / __a)
01883                                + (__y / __a) * (__y / __a)
01884                                + (__z / __a) * (__z / __a));
01885       else
01886         return {};
01887     }
01888 
01889   inline float
01890   hypot(float __x, float __y, float __z)
01891   { return std::__hypot3<float>(__x, __y, __z); }
01892 
01893   inline double
01894   hypot(double __x, double __y, double __z)
01895   { return std::__hypot3<double>(__x, __y, __z); }
01896 
01897   inline long double
01898   hypot(long double __x, long double __y, long double __z)
01899   { return std::__hypot3<long double>(__x, __y, __z); }
01900 
01901   template<typename _Tp, typename _Up, typename _Vp>
01902     typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type
01903     hypot(_Tp __x, _Up __y, _Vp __z)
01904     {
01905       using __type = typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type;
01906       return std::__hypot3<__type>(__x, __y, __z);
01907     }
01908 _GLIBCXX_END_NAMESPACE_VERSION
01909 } // namespace
01910 #endif // C++17
01911 
01912 
01913 #if _GLIBCXX_USE_STD_SPEC_FUNCS
01914 #  include <bits/specfun.h>
01915 #endif
01916 
01917 } // extern "C++"
01918 
01919 #endif