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