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