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