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