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