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