|
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_FP 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 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 00579 template<typename _Tp> 00580 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00581 int>::__type 00582 fpclassify(_Tp __x) 00583 { return __x != 0 ? FP_NORMAL : FP_ZERO; } 00584 #endif 00585 00586 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 00587 constexpr bool 00588 isfinite(float __x) 00589 { return __builtin_isfinite(__x); } 00590 00591 constexpr bool 00592 isfinite(double __x) 00593 { return __builtin_isfinite(__x); } 00594 00595 constexpr bool 00596 isfinite(long double __x) 00597 { return __builtin_isfinite(__x); } 00598 #endif 00599 00600 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 00601 template<typename _Tp> 00602 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00603 bool>::__type 00604 isfinite(_Tp __x) 00605 { return true; } 00606 #endif 00607 00608 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 00609 constexpr bool 00610 isinf(float __x) 00611 { return __builtin_isinf(__x); } 00612 00613 constexpr bool 00614 isinf(double __x) 00615 { return __builtin_isinf(__x); } 00616 00617 constexpr bool 00618 isinf(long double __x) 00619 { return __builtin_isinf(__x); } 00620 #endif 00621 00622 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 00623 template<typename _Tp> 00624 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00625 bool>::__type 00626 isinf(_Tp __x) 00627 { return false; } 00628 #endif 00629 00630 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 00631 constexpr bool 00632 isnan(float __x) 00633 { return __builtin_isnan(__x); } 00634 00635 constexpr bool 00636 isnan(double __x) 00637 { return __builtin_isnan(__x); } 00638 00639 constexpr bool 00640 isnan(long double __x) 00641 { return __builtin_isnan(__x); } 00642 #endif 00643 00644 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 00645 template<typename _Tp> 00646 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00647 bool>::__type 00648 isnan(_Tp __x) 00649 { return false; } 00650 #endif 00651 00652 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 00653 constexpr bool 00654 isnormal(float __x) 00655 { return __builtin_isnormal(__x); } 00656 00657 constexpr bool 00658 isnormal(double __x) 00659 { return __builtin_isnormal(__x); } 00660 00661 constexpr bool 00662 isnormal(long double __x) 00663 { return __builtin_isnormal(__x); } 00664 #endif 00665 00666 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 00667 template<typename _Tp> 00668 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00669 bool>::__type 00670 isnormal(_Tp __x) 00671 { return __x != 0 ? true : false; } 00672 #endif 00673 00674 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 00675 // The front-end doesn't provide a type generic builtin (libstdc++/58625). 00676 constexpr bool 00677 signbit(float __x) 00678 { return __builtin_signbitf(__x); } 00679 00680 constexpr bool 00681 signbit(double __x) 00682 { return __builtin_signbit(__x); } 00683 00684 constexpr bool 00685 signbit(long double __x) 00686 { return __builtin_signbitl(__x); } 00687 #endif 00688 00689 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 00690 template<typename _Tp> 00691 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00692 bool>::__type 00693 signbit(_Tp __x) 00694 { return __x < 0 ? true : false; } 00695 #endif 00696 00697 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 00698 constexpr bool 00699 isgreater(float __x, float __y) 00700 { return __builtin_isgreater(__x, __y); } 00701 00702 constexpr bool 00703 isgreater(double __x, double __y) 00704 { return __builtin_isgreater(__x, __y); } 00705 00706 constexpr bool 00707 isgreater(long double __x, long double __y) 00708 { return __builtin_isgreater(__x, __y); } 00709 #endif 00710 00711 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 00712 template<typename _Tp, typename _Up> 00713 constexpr typename 00714 __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value 00715 && __is_arithmetic<_Up>::__value), bool>::__type 00716 isgreater(_Tp __x, _Up __y) 00717 { 00718 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 00719 return __builtin_isgreater(__type(__x), __type(__y)); 00720 } 00721 #endif 00722 00723 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 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 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 00738 template<typename _Tp, typename _Up> 00739 constexpr typename 00740 __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value 00741 && __is_arithmetic<_Up>::__value), bool>::__type 00742 isgreaterequal(_Tp __x, _Up __y) 00743 { 00744 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 00745 return __builtin_isgreaterequal(__type(__x), __type(__y)); 00746 } 00747 #endif 00748 00749 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 00750 constexpr bool 00751 isless(float __x, float __y) 00752 { return __builtin_isless(__x, __y); } 00753 00754 constexpr bool 00755 isless(double __x, double __y) 00756 { return __builtin_isless(__x, __y); } 00757 00758 constexpr bool 00759 isless(long double __x, long double __y) 00760 { return __builtin_isless(__x, __y); } 00761 #endif 00762 00763 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 00764 template<typename _Tp, typename _Up> 00765 constexpr typename 00766 __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value 00767 && __is_arithmetic<_Up>::__value), bool>::__type 00768 isless(_Tp __x, _Up __y) 00769 { 00770 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 00771 return __builtin_isless(__type(__x), __type(__y)); 00772 } 00773 #endif 00774 00775 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 00776 constexpr bool 00777 islessequal(float __x, float __y) 00778 { return __builtin_islessequal(__x, __y); } 00779 00780 constexpr bool 00781 islessequal(double __x, double __y) 00782 { return __builtin_islessequal(__x, __y); } 00783 00784 constexpr bool 00785 islessequal(long double __x, long double __y) 00786 { return __builtin_islessequal(__x, __y); } 00787 #endif 00788 00789 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 00790 template<typename _Tp, typename _Up> 00791 constexpr typename 00792 __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value 00793 && __is_arithmetic<_Up>::__value), bool>::__type 00794 islessequal(_Tp __x, _Up __y) 00795 { 00796 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 00797 return __builtin_islessequal(__type(__x), __type(__y)); 00798 } 00799 #endif 00800 00801 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 00802 constexpr bool 00803 islessgreater(float __x, float __y) 00804 { return __builtin_islessgreater(__x, __y); } 00805 00806 constexpr bool 00807 islessgreater(double __x, double __y) 00808 { return __builtin_islessgreater(__x, __y); } 00809 00810 constexpr bool 00811 islessgreater(long double __x, long double __y) 00812 { return __builtin_islessgreater(__x, __y); } 00813 #endif 00814 00815 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 00816 template<typename _Tp, typename _Up> 00817 constexpr typename 00818 __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value 00819 && __is_arithmetic<_Up>::__value), bool>::__type 00820 islessgreater(_Tp __x, _Up __y) 00821 { 00822 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 00823 return __builtin_islessgreater(__type(__x), __type(__y)); 00824 } 00825 #endif 00826 00827 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 00828 constexpr bool 00829 isunordered(float __x, float __y) 00830 { return __builtin_isunordered(__x, __y); } 00831 00832 constexpr bool 00833 isunordered(double __x, double __y) 00834 { return __builtin_isunordered(__x, __y); } 00835 00836 constexpr bool 00837 isunordered(long double __x, long double __y) 00838 { return __builtin_isunordered(__x, __y); } 00839 #endif 00840 00841 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 00842 template<typename _Tp, typename _Up> 00843 constexpr typename 00844 __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value 00845 && __is_arithmetic<_Up>::__value), bool>::__type 00846 isunordered(_Tp __x, _Up __y) 00847 { 00848 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 00849 return __builtin_isunordered(__type(__x), __type(__y)); 00850 } 00851 #endif 00852 00853 #else 00854 00855 template<typename _Tp> 00856 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 00857 int>::__type 00858 fpclassify(_Tp __f) 00859 { 00860 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 00861 return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, 00862 FP_SUBNORMAL, FP_ZERO, __type(__f)); 00863 } 00864 00865 template<typename _Tp> 00866 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 00867 int>::__type 00868 isfinite(_Tp __f) 00869 { 00870 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 00871 return __builtin_isfinite(__type(__f)); 00872 } 00873 00874 template<typename _Tp> 00875 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 00876 int>::__type 00877 isinf(_Tp __f) 00878 { 00879 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 00880 return __builtin_isinf(__type(__f)); 00881 } 00882 00883 template<typename _Tp> 00884 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 00885 int>::__type 00886 isnan(_Tp __f) 00887 { 00888 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 00889 return __builtin_isnan(__type(__f)); 00890 } 00891 00892 template<typename _Tp> 00893 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 00894 int>::__type 00895 isnormal(_Tp __f) 00896 { 00897 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 00898 return __builtin_isnormal(__type(__f)); 00899 } 00900 00901 template<typename _Tp> 00902 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 00903 int>::__type 00904 signbit(_Tp __f) 00905 { 00906 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 00907 return sizeof(__type) == sizeof(float) 00908 ? __builtin_signbitf(__type(__f)) 00909 : sizeof(__type) == sizeof(double) 00910 ? __builtin_signbit(__type(__f)) 00911 : __builtin_signbitl(__type(__f)); 00912 } 00913 00914 template<typename _Tp> 00915 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 00916 int>::__type 00917 isgreater(_Tp __f1, _Tp __f2) 00918 { 00919 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 00920 return __builtin_isgreater(__type(__f1), __type(__f2)); 00921 } 00922 00923 template<typename _Tp> 00924 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 00925 int>::__type 00926 isgreaterequal(_Tp __f1, _Tp __f2) 00927 { 00928 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 00929 return __builtin_isgreaterequal(__type(__f1), __type(__f2)); 00930 } 00931 00932 template<typename _Tp> 00933 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 00934 int>::__type 00935 isless(_Tp __f1, _Tp __f2) 00936 { 00937 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 00938 return __builtin_isless(__type(__f1), __type(__f2)); 00939 } 00940 00941 template<typename _Tp> 00942 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 00943 int>::__type 00944 islessequal(_Tp __f1, _Tp __f2) 00945 { 00946 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 00947 return __builtin_islessequal(__type(__f1), __type(__f2)); 00948 } 00949 00950 template<typename _Tp> 00951 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 00952 int>::__type 00953 islessgreater(_Tp __f1, _Tp __f2) 00954 { 00955 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 00956 return __builtin_islessgreater(__type(__f1), __type(__f2)); 00957 } 00958 00959 template<typename _Tp> 00960 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 00961 int>::__type 00962 isunordered(_Tp __f1, _Tp __f2) 00963 { 00964 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 00965 return __builtin_isunordered(__type(__f1), __type(__f2)); 00966 } 00967 00968 #endif 00969 00970 _GLIBCXX_END_NAMESPACE_VERSION 00971 } // namespace 00972 00973 #endif /* _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC */ 00974 #endif 00975 00976 #if __cplusplus >= 201103L 00977 00978 #ifdef _GLIBCXX_USE_C99_MATH_TR1 00979 00980 #undef acosh 00981 #undef acoshf 00982 #undef acoshl 00983 #undef asinh 00984 #undef asinhf 00985 #undef asinhl 00986 #undef atanh 00987 #undef atanhf 00988 #undef atanhl 00989 #undef cbrt 00990 #undef cbrtf 00991 #undef cbrtl 00992 #undef copysign 00993 #undef copysignf 00994 #undef copysignl 00995 #undef erf 00996 #undef erff 00997 #undef erfl 00998 #undef erfc 00999 #undef erfcf 01000 #undef erfcl 01001 #undef exp2 01002 #undef exp2f 01003 #undef exp2l 01004 #undef expm1 01005 #undef expm1f 01006 #undef expm1l 01007 #undef fdim 01008 #undef fdimf 01009 #undef fdiml 01010 #undef fma 01011 #undef fmaf 01012 #undef fmal 01013 #undef fmax 01014 #undef fmaxf 01015 #undef fmaxl 01016 #undef fmin 01017 #undef fminf 01018 #undef fminl 01019 #undef hypot 01020 #undef hypotf 01021 #undef hypotl 01022 #undef ilogb 01023 #undef ilogbf 01024 #undef ilogbl 01025 #undef lgamma 01026 #undef lgammaf 01027 #undef lgammal 01028 #undef llrint 01029 #undef llrintf 01030 #undef llrintl 01031 #undef llround 01032 #undef llroundf 01033 #undef llroundl 01034 #undef log1p 01035 #undef log1pf 01036 #undef log1pl 01037 #undef log2 01038 #undef log2f 01039 #undef log2l 01040 #undef logb 01041 #undef logbf 01042 #undef logbl 01043 #undef lrint 01044 #undef lrintf 01045 #undef lrintl 01046 #undef lround 01047 #undef lroundf 01048 #undef lroundl 01049 #undef nan 01050 #undef nanf 01051 #undef nanl 01052 #undef nearbyint 01053 #undef nearbyintf 01054 #undef nearbyintl 01055 #undef nextafter 01056 #undef nextafterf 01057 #undef nextafterl 01058 #undef nexttoward 01059 #undef nexttowardf 01060 #undef nexttowardl 01061 #undef remainder 01062 #undef remainderf 01063 #undef remainderl 01064 #undef remquo 01065 #undef remquof 01066 #undef remquol 01067 #undef rint 01068 #undef rintf 01069 #undef rintl 01070 #undef round 01071 #undef roundf 01072 #undef roundl 01073 #undef scalbln 01074 #undef scalblnf 01075 #undef scalblnl 01076 #undef scalbn 01077 #undef scalbnf 01078 #undef scalbnl 01079 #undef tgamma 01080 #undef tgammaf 01081 #undef tgammal 01082 #undef trunc 01083 #undef truncf 01084 #undef truncl 01085 01086 namespace std _GLIBCXX_VISIBILITY(default) 01087 { 01088 _GLIBCXX_BEGIN_NAMESPACE_VERSION 01089 01090 // types 01091 using ::double_t; 01092 using ::float_t; 01093 01094 // functions 01095 using ::acosh; 01096 using ::acoshf; 01097 using ::acoshl; 01098 01099 using ::asinh; 01100 using ::asinhf; 01101 using ::asinhl; 01102 01103 using ::atanh; 01104 using ::atanhf; 01105 using ::atanhl; 01106 01107 using ::cbrt; 01108 using ::cbrtf; 01109 using ::cbrtl; 01110 01111 using ::copysign; 01112 using ::copysignf; 01113 using ::copysignl; 01114 01115 using ::erf; 01116 using ::erff; 01117 using ::erfl; 01118 01119 using ::erfc; 01120 using ::erfcf; 01121 using ::erfcl; 01122 01123 using ::exp2; 01124 using ::exp2f; 01125 using ::exp2l; 01126 01127 using ::expm1; 01128 using ::expm1f; 01129 using ::expm1l; 01130 01131 using ::fdim; 01132 using ::fdimf; 01133 using ::fdiml; 01134 01135 using ::fma; 01136 using ::fmaf; 01137 using ::fmal; 01138 01139 using ::fmax; 01140 using ::fmaxf; 01141 using ::fmaxl; 01142 01143 using ::fmin; 01144 using ::fminf; 01145 using ::fminl; 01146 01147 using ::hypot; 01148 using ::hypotf; 01149 using ::hypotl; 01150 01151 using ::ilogb; 01152 using ::ilogbf; 01153 using ::ilogbl; 01154 01155 using ::lgamma; 01156 using ::lgammaf; 01157 using ::lgammal; 01158 01159 using ::llrint; 01160 using ::llrintf; 01161 using ::llrintl; 01162 01163 using ::llround; 01164 using ::llroundf; 01165 using ::llroundl; 01166 01167 using ::log1p; 01168 using ::log1pf; 01169 using ::log1pl; 01170 01171 using ::log2; 01172 using ::log2f; 01173 using ::log2l; 01174 01175 using ::logb; 01176 using ::logbf; 01177 using ::logbl; 01178 01179 using ::lrint; 01180 using ::lrintf; 01181 using ::lrintl; 01182 01183 using ::lround; 01184 using ::lroundf; 01185 using ::lroundl; 01186 01187 using ::nan; 01188 using ::nanf; 01189 using ::nanl; 01190 01191 using ::nearbyint; 01192 using ::nearbyintf; 01193 using ::nearbyintl; 01194 01195 using ::nextafter; 01196 using ::nextafterf; 01197 using ::nextafterl; 01198 01199 using ::nexttoward; 01200 using ::nexttowardf; 01201 using ::nexttowardl; 01202 01203 using ::remainder; 01204 using ::remainderf; 01205 using ::remainderl; 01206 01207 using ::remquo; 01208 using ::remquof; 01209 using ::remquol; 01210 01211 using ::rint; 01212 using ::rintf; 01213 using ::rintl; 01214 01215 using ::round; 01216 using ::roundf; 01217 using ::roundl; 01218 01219 using ::scalbln; 01220 using ::scalblnf; 01221 using ::scalblnl; 01222 01223 using ::scalbn; 01224 using ::scalbnf; 01225 using ::scalbnl; 01226 01227 using ::tgamma; 01228 using ::tgammaf; 01229 using ::tgammal; 01230 01231 using ::trunc; 01232 using ::truncf; 01233 using ::truncl; 01234 01235 /// Additional overloads. 01236 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01237 constexpr float 01238 acosh(float __x) 01239 { return __builtin_acoshf(__x); } 01240 01241 constexpr long double 01242 acosh(long double __x) 01243 { return __builtin_acoshl(__x); } 01244 #endif 01245 01246 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01247 template<typename _Tp> 01248 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 01249 double>::__type 01250 acosh(_Tp __x) 01251 { return __builtin_acosh(__x); } 01252 #endif 01253 01254 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01255 constexpr float 01256 asinh(float __x) 01257 { return __builtin_asinhf(__x); } 01258 01259 constexpr long double 01260 asinh(long double __x) 01261 { return __builtin_asinhl(__x); } 01262 #endif 01263 01264 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01265 template<typename _Tp> 01266 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 01267 double>::__type 01268 asinh(_Tp __x) 01269 { return __builtin_asinh(__x); } 01270 #endif 01271 01272 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01273 constexpr float 01274 atanh(float __x) 01275 { return __builtin_atanhf(__x); } 01276 01277 constexpr long double 01278 atanh(long double __x) 01279 { return __builtin_atanhl(__x); } 01280 #endif 01281 01282 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01283 template<typename _Tp> 01284 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 01285 double>::__type 01286 atanh(_Tp __x) 01287 { return __builtin_atanh(__x); } 01288 #endif 01289 01290 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01291 constexpr float 01292 cbrt(float __x) 01293 { return __builtin_cbrtf(__x); } 01294 01295 constexpr long double 01296 cbrt(long double __x) 01297 { return __builtin_cbrtl(__x); } 01298 #endif 01299 01300 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01301 template<typename _Tp> 01302 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 01303 double>::__type 01304 cbrt(_Tp __x) 01305 { return __builtin_cbrt(__x); } 01306 #endif 01307 01308 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01309 constexpr float 01310 copysign(float __x, float __y) 01311 { return __builtin_copysignf(__x, __y); } 01312 01313 constexpr long double 01314 copysign(long double __x, long double __y) 01315 { return __builtin_copysignl(__x, __y); } 01316 #endif 01317 01318 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01319 template<typename _Tp, typename _Up> 01320 constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type 01321 copysign(_Tp __x, _Up __y) 01322 { 01323 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 01324 return copysign(__type(__x), __type(__y)); 01325 } 01326 #endif 01327 01328 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01329 constexpr float 01330 erf(float __x) 01331 { return __builtin_erff(__x); } 01332 01333 constexpr long double 01334 erf(long double __x) 01335 { return __builtin_erfl(__x); } 01336 #endif 01337 01338 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01339 template<typename _Tp> 01340 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 01341 double>::__type 01342 erf(_Tp __x) 01343 { return __builtin_erf(__x); } 01344 #endif 01345 01346 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01347 constexpr float 01348 erfc(float __x) 01349 { return __builtin_erfcf(__x); } 01350 01351 constexpr long double 01352 erfc(long double __x) 01353 { return __builtin_erfcl(__x); } 01354 #endif 01355 01356 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01357 template<typename _Tp> 01358 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 01359 double>::__type 01360 erfc(_Tp __x) 01361 { return __builtin_erfc(__x); } 01362 #endif 01363 01364 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01365 constexpr float 01366 exp2(float __x) 01367 { return __builtin_exp2f(__x); } 01368 01369 constexpr long double 01370 exp2(long double __x) 01371 { return __builtin_exp2l(__x); } 01372 #endif 01373 01374 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01375 template<typename _Tp> 01376 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 01377 double>::__type 01378 exp2(_Tp __x) 01379 { return __builtin_exp2(__x); } 01380 #endif 01381 01382 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01383 constexpr float 01384 expm1(float __x) 01385 { return __builtin_expm1f(__x); } 01386 01387 constexpr long double 01388 expm1(long double __x) 01389 { return __builtin_expm1l(__x); } 01390 #endif 01391 01392 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01393 template<typename _Tp> 01394 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 01395 double>::__type 01396 expm1(_Tp __x) 01397 { return __builtin_expm1(__x); } 01398 #endif 01399 01400 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01401 constexpr float 01402 fdim(float __x, float __y) 01403 { return __builtin_fdimf(__x, __y); } 01404 01405 constexpr long double 01406 fdim(long double __x, long double __y) 01407 { return __builtin_fdiml(__x, __y); } 01408 #endif 01409 01410 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01411 template<typename _Tp, typename _Up> 01412 constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type 01413 fdim(_Tp __x, _Up __y) 01414 { 01415 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 01416 return fdim(__type(__x), __type(__y)); 01417 } 01418 #endif 01419 01420 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01421 constexpr float 01422 fma(float __x, float __y, float __z) 01423 { return __builtin_fmaf(__x, __y, __z); } 01424 01425 constexpr long double 01426 fma(long double __x, long double __y, long double __z) 01427 { return __builtin_fmal(__x, __y, __z); } 01428 #endif 01429 01430 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01431 template<typename _Tp, typename _Up, typename _Vp> 01432 constexpr typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type 01433 fma(_Tp __x, _Up __y, _Vp __z) 01434 { 01435 typedef typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type __type; 01436 return fma(__type(__x), __type(__y), __type(__z)); 01437 } 01438 #endif 01439 01440 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01441 constexpr float 01442 fmax(float __x, float __y) 01443 { return __builtin_fmaxf(__x, __y); } 01444 01445 constexpr long double 01446 fmax(long double __x, long double __y) 01447 { return __builtin_fmaxl(__x, __y); } 01448 #endif 01449 01450 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01451 template<typename _Tp, typename _Up> 01452 constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type 01453 fmax(_Tp __x, _Up __y) 01454 { 01455 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 01456 return fmax(__type(__x), __type(__y)); 01457 } 01458 #endif 01459 01460 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01461 constexpr float 01462 fmin(float __x, float __y) 01463 { return __builtin_fminf(__x, __y); } 01464 01465 constexpr long double 01466 fmin(long double __x, long double __y) 01467 { return __builtin_fminl(__x, __y); } 01468 #endif 01469 01470 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01471 template<typename _Tp, typename _Up> 01472 constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type 01473 fmin(_Tp __x, _Up __y) 01474 { 01475 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 01476 return fmin(__type(__x), __type(__y)); 01477 } 01478 #endif 01479 01480 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01481 constexpr float 01482 hypot(float __x, float __y) 01483 { return __builtin_hypotf(__x, __y); } 01484 01485 constexpr long double 01486 hypot(long double __x, long double __y) 01487 { return __builtin_hypotl(__x, __y); } 01488 #endif 01489 01490 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01491 template<typename _Tp, typename _Up> 01492 constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type 01493 hypot(_Tp __x, _Up __y) 01494 { 01495 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 01496 return hypot(__type(__x), __type(__y)); 01497 } 01498 #endif 01499 01500 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01501 constexpr int 01502 ilogb(float __x) 01503 { return __builtin_ilogbf(__x); } 01504 01505 constexpr int 01506 ilogb(long double __x) 01507 { return __builtin_ilogbl(__x); } 01508 #endif 01509 01510 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01511 template<typename _Tp> 01512 constexpr 01513 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 01514 int>::__type 01515 ilogb(_Tp __x) 01516 { return __builtin_ilogb(__x); } 01517 #endif 01518 01519 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01520 constexpr float 01521 lgamma(float __x) 01522 { return __builtin_lgammaf(__x); } 01523 01524 constexpr long double 01525 lgamma(long double __x) 01526 { return __builtin_lgammal(__x); } 01527 #endif 01528 01529 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01530 template<typename _Tp> 01531 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 01532 double>::__type 01533 lgamma(_Tp __x) 01534 { return __builtin_lgamma(__x); } 01535 #endif 01536 01537 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01538 constexpr long long 01539 llrint(float __x) 01540 { return __builtin_llrintf(__x); } 01541 01542 constexpr long long 01543 llrint(long double __x) 01544 { return __builtin_llrintl(__x); } 01545 #endif 01546 01547 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01548 template<typename _Tp> 01549 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 01550 long long>::__type 01551 llrint(_Tp __x) 01552 { return __builtin_llrint(__x); } 01553 #endif 01554 01555 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01556 constexpr long long 01557 llround(float __x) 01558 { return __builtin_llroundf(__x); } 01559 01560 constexpr long long 01561 llround(long double __x) 01562 { return __builtin_llroundl(__x); } 01563 #endif 01564 01565 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01566 template<typename _Tp> 01567 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 01568 long long>::__type 01569 llround(_Tp __x) 01570 { return __builtin_llround(__x); } 01571 #endif 01572 01573 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01574 constexpr float 01575 log1p(float __x) 01576 { return __builtin_log1pf(__x); } 01577 01578 constexpr long double 01579 log1p(long double __x) 01580 { return __builtin_log1pl(__x); } 01581 #endif 01582 01583 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01584 template<typename _Tp> 01585 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 01586 double>::__type 01587 log1p(_Tp __x) 01588 { return __builtin_log1p(__x); } 01589 #endif 01590 01591 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01592 // DR 568. 01593 constexpr float 01594 log2(float __x) 01595 { return __builtin_log2f(__x); } 01596 01597 constexpr long double 01598 log2(long double __x) 01599 { return __builtin_log2l(__x); } 01600 #endif 01601 01602 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01603 template<typename _Tp> 01604 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 01605 double>::__type 01606 log2(_Tp __x) 01607 { return __builtin_log2(__x); } 01608 #endif 01609 01610 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01611 constexpr float 01612 logb(float __x) 01613 { return __builtin_logbf(__x); } 01614 01615 constexpr long double 01616 logb(long double __x) 01617 { return __builtin_logbl(__x); } 01618 #endif 01619 01620 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01621 template<typename _Tp> 01622 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 01623 double>::__type 01624 logb(_Tp __x) 01625 { return __builtin_logb(__x); } 01626 #endif 01627 01628 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01629 constexpr long 01630 lrint(float __x) 01631 { return __builtin_lrintf(__x); } 01632 01633 constexpr long 01634 lrint(long double __x) 01635 { return __builtin_lrintl(__x); } 01636 #endif 01637 01638 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01639 template<typename _Tp> 01640 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 01641 long>::__type 01642 lrint(_Tp __x) 01643 { return __builtin_lrint(__x); } 01644 #endif 01645 01646 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01647 constexpr long 01648 lround(float __x) 01649 { return __builtin_lroundf(__x); } 01650 01651 constexpr long 01652 lround(long double __x) 01653 { return __builtin_lroundl(__x); } 01654 #endif 01655 01656 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01657 template<typename _Tp> 01658 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 01659 long>::__type 01660 lround(_Tp __x) 01661 { return __builtin_lround(__x); } 01662 #endif 01663 01664 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01665 constexpr float 01666 nearbyint(float __x) 01667 { return __builtin_nearbyintf(__x); } 01668 01669 constexpr long double 01670 nearbyint(long double __x) 01671 { return __builtin_nearbyintl(__x); } 01672 #endif 01673 01674 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01675 template<typename _Tp> 01676 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 01677 double>::__type 01678 nearbyint(_Tp __x) 01679 { return __builtin_nearbyint(__x); } 01680 #endif 01681 01682 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01683 constexpr float 01684 nextafter(float __x, float __y) 01685 { return __builtin_nextafterf(__x, __y); } 01686 01687 constexpr long double 01688 nextafter(long double __x, long double __y) 01689 { return __builtin_nextafterl(__x, __y); } 01690 #endif 01691 01692 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01693 template<typename _Tp, typename _Up> 01694 constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type 01695 nextafter(_Tp __x, _Up __y) 01696 { 01697 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 01698 return nextafter(__type(__x), __type(__y)); 01699 } 01700 #endif 01701 01702 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01703 constexpr float 01704 nexttoward(float __x, long double __y) 01705 { return __builtin_nexttowardf(__x, __y); } 01706 01707 constexpr long double 01708 nexttoward(long double __x, long double __y) 01709 { return __builtin_nexttowardl(__x, __y); } 01710 #endif 01711 01712 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01713 template<typename _Tp> 01714 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 01715 double>::__type 01716 nexttoward(_Tp __x, long double __y) 01717 { return __builtin_nexttoward(__x, __y); } 01718 #endif 01719 01720 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01721 constexpr float 01722 remainder(float __x, float __y) 01723 { return __builtin_remainderf(__x, __y); } 01724 01725 constexpr long double 01726 remainder(long double __x, long double __y) 01727 { return __builtin_remainderl(__x, __y); } 01728 #endif 01729 01730 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01731 template<typename _Tp, typename _Up> 01732 constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type 01733 remainder(_Tp __x, _Up __y) 01734 { 01735 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 01736 return remainder(__type(__x), __type(__y)); 01737 } 01738 #endif 01739 01740 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01741 inline float 01742 remquo(float __x, float __y, int* __pquo) 01743 { return __builtin_remquof(__x, __y, __pquo); } 01744 01745 inline long double 01746 remquo(long double __x, long double __y, int* __pquo) 01747 { return __builtin_remquol(__x, __y, __pquo); } 01748 #endif 01749 01750 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01751 template<typename _Tp, typename _Up> 01752 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type 01753 remquo(_Tp __x, _Up __y, int* __pquo) 01754 { 01755 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 01756 return remquo(__type(__x), __type(__y), __pquo); 01757 } 01758 #endif 01759 01760 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01761 constexpr float 01762 rint(float __x) 01763 { return __builtin_rintf(__x); } 01764 01765 constexpr long double 01766 rint(long double __x) 01767 { return __builtin_rintl(__x); } 01768 #endif 01769 01770 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01771 template<typename _Tp> 01772 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 01773 double>::__type 01774 rint(_Tp __x) 01775 { return __builtin_rint(__x); } 01776 #endif 01777 01778 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01779 constexpr float 01780 round(float __x) 01781 { return __builtin_roundf(__x); } 01782 01783 constexpr long double 01784 round(long double __x) 01785 { return __builtin_roundl(__x); } 01786 #endif 01787 01788 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01789 template<typename _Tp> 01790 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 01791 double>::__type 01792 round(_Tp __x) 01793 { return __builtin_round(__x); } 01794 #endif 01795 01796 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01797 constexpr float 01798 scalbln(float __x, long __ex) 01799 { return __builtin_scalblnf(__x, __ex); } 01800 01801 constexpr long double 01802 scalbln(long double __x, long __ex) 01803 { return __builtin_scalblnl(__x, __ex); } 01804 #endif 01805 01806 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01807 template<typename _Tp> 01808 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 01809 double>::__type 01810 scalbln(_Tp __x, long __ex) 01811 { return __builtin_scalbln(__x, __ex); } 01812 #endif 01813 01814 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01815 constexpr float 01816 scalbn(float __x, int __ex) 01817 { return __builtin_scalbnf(__x, __ex); } 01818 01819 constexpr long double 01820 scalbn(long double __x, int __ex) 01821 { return __builtin_scalbnl(__x, __ex); } 01822 #endif 01823 01824 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01825 template<typename _Tp> 01826 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 01827 double>::__type 01828 scalbn(_Tp __x, int __ex) 01829 { return __builtin_scalbn(__x, __ex); } 01830 #endif 01831 01832 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01833 constexpr float 01834 tgamma(float __x) 01835 { return __builtin_tgammaf(__x); } 01836 01837 constexpr long double 01838 tgamma(long double __x) 01839 { return __builtin_tgammal(__x); } 01840 #endif 01841 01842 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01843 template<typename _Tp> 01844 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 01845 double>::__type 01846 tgamma(_Tp __x) 01847 { return __builtin_tgamma(__x); } 01848 #endif 01849 01850 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01851 constexpr float 01852 trunc(float __x) 01853 { return __builtin_truncf(__x); } 01854 01855 constexpr long double 01856 trunc(long double __x) 01857 { return __builtin_truncl(__x); } 01858 #endif 01859 01860 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT 01861 template<typename _Tp> 01862 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 01863 double>::__type 01864 trunc(_Tp __x) 01865 { return __builtin_trunc(__x); } 01866 #endif 01867 01868 _GLIBCXX_END_NAMESPACE_VERSION 01869 } // namespace 01870 01871 #endif // _GLIBCXX_USE_C99_MATH_TR1 01872 01873 #endif // C++11 01874 01875 #endif