1 // -*- C++ -*- C forwarding header. 2 3 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 4 // 2006, 2007, 2008, 2009, 2010, 2011 5 // Free Software Foundation, Inc. 6 // 7 // This file is part of the GNU ISO C++ Library. This library is free 8 // software; you can redistribute it and/or modify it under the 9 // terms of the GNU General Public License as published by the 10 // Free Software Foundation; either version 3, or (at your option) 11 // any later version. 12 13 // This library is distributed in the hope that it will be useful, 14 // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 // GNU General Public License for more details. 17 18 // Under Section 7 of GPL version 3, you are granted additional 19 // permissions described in the GCC Runtime Library Exception, version 20 // 3.1, as published by the Free Software Foundation. 21 22 // You should have received a copy of the GNU General Public License and 23 // a copy of the GCC Runtime Library Exception along with this program; 24 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 25 // <http://www.gnu.org/licenses/>. 26 27 /** @file include/cmath 28 * This is a Standard C++ Library file. You should @c \#include this file 29 * in your programs, rather than any of the @a *.h implementation files. 30 * 31 * This is the C++ version of the Standard C Library header @c math.h, 32 * and its contents are (mostly) the same as that header, but are all 33 * contained in the namespace @c std (except for names which are defined 34 * as macros in C). 35 */ 36 37 // 38 // ISO C++ 14882: 26.5 C library 39 // 40 41 #pragma GCC system_header 42 43 #include <bits/c++config.h> 44 #include <bits/cpp_type_traits.h> 45 #include <ext/type_traits.h> 46 #include <math.h> 47 48 #ifndef _GLIBCXX_CMATH 49 #define _GLIBCXX_CMATH 1 50 51 // Get rid of those macros defined in <math.h> in lieu of real functions. 52 #undef abs 53 #undef div 54 #undef acos 55 #undef asin 56 #undef atan 57 #undef atan2 58 #undef ceil 59 #undef cos 60 #undef cosh 61 #undef exp 62 #undef fabs 63 #undef floor 64 #undef fmod 65 #undef frexp 66 #undef ldexp 67 #undef log 68 #undef log10 69 #undef modf 70 #undef pow 71 #undef sin 72 #undef sinh 73 #undef sqrt 74 #undef tan 75 #undef tanh 76 77 namespace std _GLIBCXX_VISIBILITY(default) 78 { 79 _GLIBCXX_BEGIN_NAMESPACE_VERSION 80 81 #if !defined(__CORRECT_ISO_CPP_MATH_H_PROTO1) \ 82 && !defined(__CORRECT_ISO_CPP_MATH_H_PROTO2) 83 inline _GLIBCXX_CONSTEXPR double 84 abs(double __x) 85 { return __builtin_fabs(__x); } 86 #endif 87 88 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1 89 inline _GLIBCXX_CONSTEXPR float 90 abs(float __x) 91 { return __builtin_fabsf(__x); } 92 93 inline _GLIBCXX_CONSTEXPR long double 94 abs(long double __x) 95 { return __builtin_fabsl(__x); } 96 #endif 97 98 template<typename _Tp> 99 inline _GLIBCXX_CONSTEXPR 100 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 101 double>::__type 102 abs(_Tp __x) 103 { return __builtin_fabs(__x); } 104 105 using ::acos; 106 107 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1 108 inline _GLIBCXX_CONSTEXPR float 109 acos(float __x) 110 { return __builtin_acosf(__x); } 111 112 inline _GLIBCXX_CONSTEXPR long double 113 acos(long double __x) 114 { return __builtin_acosl(__x); } 115 #endif 116 117 template<typename _Tp> 118 inline _GLIBCXX_CONSTEXPR 119 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 120 double>::__type 121 acos(_Tp __x) 122 { return __builtin_acos(__x); } 123 124 using ::asin; 125 126 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1 127 inline _GLIBCXX_CONSTEXPR float 128 asin(float __x) 129 { return __builtin_asinf(__x); } 130 131 inline _GLIBCXX_CONSTEXPR long double 132 asin(long double __x) 133 { return __builtin_asinl(__x); } 134 #endif 135 136 template<typename _Tp> 137 inline _GLIBCXX_CONSTEXPR 138 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 139 double>::__type 140 asin(_Tp __x) 141 { return __builtin_asin(__x); } 142 143 using ::atan; 144 145 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1 146 inline _GLIBCXX_CONSTEXPR float 147 atan(float __x) 148 { return __builtin_atanf(__x); } 149 150 inline _GLIBCXX_CONSTEXPR long double 151 atan(long double __x) 152 { return __builtin_atanl(__x); } 153 #endif 154 155 template<typename _Tp> 156 inline _GLIBCXX_CONSTEXPR 157 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 158 double>::__type 159 atan(_Tp __x) 160 { return __builtin_atan(__x); } 161 162 using ::atan2; 163 164 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1 165 inline _GLIBCXX_CONSTEXPR float 166 atan2(float __y, float __x) 167 { return __builtin_atan2f(__y, __x); } 168 169 inline _GLIBCXX_CONSTEXPR long double 170 atan2(long double __y, long double __x) 171 { return __builtin_atan2l(__y, __x); } 172 #endif 173 174 template<typename _Tp, typename _Up> 175 inline _GLIBCXX_CONSTEXPR 176 typename __gnu_cxx::__promote_2<_Tp, _Up>::__type 177 atan2(_Tp __y, _Up __x) 178 { 179 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 180 return atan2(__type(__y), __type(__x)); 181 } 182 183 using ::ceil; 184 185 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1 186 inline _GLIBCXX_CONSTEXPR float 187 ceil(float __x) 188 { return __builtin_ceilf(__x); } 189 190 inline _GLIBCXX_CONSTEXPR long double 191 ceil(long double __x) 192 { return __builtin_ceill(__x); } 193 #endif 194 195 template<typename _Tp> 196 inline _GLIBCXX_CONSTEXPR 197 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 198 double>::__type 199 ceil(_Tp __x) 200 { return __builtin_ceil(__x); } 201 202 using ::cos; 203 204 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1 205 inline _GLIBCXX_CONSTEXPR float 206 cos(float __x) 207 { return __builtin_cosf(__x); } 208 209 inline _GLIBCXX_CONSTEXPR long double 210 cos(long double __x) 211 { return __builtin_cosl(__x); } 212 #endif 213 214 template<typename _Tp> 215 inline _GLIBCXX_CONSTEXPR 216 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 217 double>::__type 218 cos(_Tp __x) 219 { return __builtin_cos(__x); } 220 221 using ::cosh; 222 223 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1 224 inline _GLIBCXX_CONSTEXPR float 225 cosh(float __x) 226 { return __builtin_coshf(__x); } 227 228 inline _GLIBCXX_CONSTEXPR long double 229 cosh(long double __x) 230 { return __builtin_coshl(__x); } 231 #endif 232 233 template<typename _Tp> 234 inline _GLIBCXX_CONSTEXPR 235 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 236 double>::__type 237 cosh(_Tp __x) 238 { return __builtin_cosh(__x); } 239 240 using ::exp; 241 242 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1 243 inline _GLIBCXX_CONSTEXPR float 244 exp(float __x) 245 { return __builtin_expf(__x); } 246 247 inline _GLIBCXX_CONSTEXPR long double 248 exp(long double __x) 249 { return __builtin_expl(__x); } 250 #endif 251 252 template<typename _Tp> 253 inline _GLIBCXX_CONSTEXPR 254 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 255 double>::__type 256 exp(_Tp __x) 257 { return __builtin_exp(__x); } 258 259 using ::fabs; 260 261 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1 262 inline _GLIBCXX_CONSTEXPR float 263 fabs(float __x) 264 { return __builtin_fabsf(__x); } 265 266 inline _GLIBCXX_CONSTEXPR long double 267 fabs(long double __x) 268 { return __builtin_fabsl(__x); } 269 #endif 270 271 template<typename _Tp> 272 inline _GLIBCXX_CONSTEXPR 273 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 274 double>::__type 275 fabs(_Tp __x) 276 { return __builtin_fabs(__x); } 277 278 using ::floor; 279 280 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1 281 inline _GLIBCXX_CONSTEXPR float 282 floor(float __x) 283 { return __builtin_floorf(__x); } 284 285 inline _GLIBCXX_CONSTEXPR long double 286 floor(long double __x) 287 { return __builtin_floorl(__x); } 288 #endif 289 290 template<typename _Tp> 291 inline _GLIBCXX_CONSTEXPR 292 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 293 double>::__type 294 floor(_Tp __x) 295 { return __builtin_floor(__x); } 296 297 using ::fmod; 298 299 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1 300 inline _GLIBCXX_CONSTEXPR float 301 fmod(float __x, float __y) 302 { return __builtin_fmodf(__x, __y); } 303 304 inline _GLIBCXX_CONSTEXPR long double 305 fmod(long double __x, long double __y) 306 { return __builtin_fmodl(__x, __y); } 307 #endif 308 309 template<typename _Tp, typename _Up> 310 inline _GLIBCXX_CONSTEXPR 311 typename __gnu_cxx::__promote_2<_Tp, _Up>::__type 312 fmod(_Tp __x, _Up __y) 313 { 314 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 315 return fmod(__type(__x), __type(__y)); 316 } 317 318 using ::frexp; 319 320 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1 321 inline float 322 frexp(float __x, int* __exp) 323 { return __builtin_frexpf(__x, __exp); } 324 325 inline long double 326 frexp(long double __x, int* __exp) 327 { return __builtin_frexpl(__x, __exp); } 328 #endif 329 330 template<typename _Tp> 331 inline _GLIBCXX_CONSTEXPR 332 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 333 double>::__type 334 frexp(_Tp __x, int* __exp) 335 { return __builtin_frexp(__x, __exp); } 336 337 using ::ldexp; 338 339 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1 340 inline _GLIBCXX_CONSTEXPR float 341 ldexp(float __x, int __exp) 342 { return __builtin_ldexpf(__x, __exp); } 343 344 inline _GLIBCXX_CONSTEXPR long double 345 ldexp(long double __x, int __exp) 346 { return __builtin_ldexpl(__x, __exp); } 347 #endif 348 349 template<typename _Tp> 350 inline _GLIBCXX_CONSTEXPR 351 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 352 double>::__type 353 ldexp(_Tp __x, int __exp) 354 { return __builtin_ldexp(__x, __exp); } 355 356 using ::log; 357 358 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1 359 inline _GLIBCXX_CONSTEXPR float 360 log(float __x) 361 { return __builtin_logf(__x); } 362 363 inline _GLIBCXX_CONSTEXPR long double 364 log(long double __x) 365 { return __builtin_logl(__x); } 366 #endif 367 368 template<typename _Tp> 369 inline _GLIBCXX_CONSTEXPR 370 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 371 double>::__type 372 log(_Tp __x) 373 { return __builtin_log(__x); } 374 375 using ::log10; 376 377 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1 378 inline _GLIBCXX_CONSTEXPR float 379 log10(float __x) 380 { return __builtin_log10f(__x); } 381 382 inline _GLIBCXX_CONSTEXPR long double 383 log10(long double __x) 384 { return __builtin_log10l(__x); } 385 #endif 386 387 template<typename _Tp> 388 inline _GLIBCXX_CONSTEXPR 389 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 390 double>::__type 391 log10(_Tp __x) 392 { return __builtin_log10(__x); } 393 394 using ::modf; 395 396 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1 397 inline float 398 modf(float __x, float* __iptr) 399 { return __builtin_modff(__x, __iptr); } 400 401 inline long double 402 modf(long double __x, long double* __iptr) 403 { return __builtin_modfl(__x, __iptr); } 404 #endif 405 406 using ::pow; 407 408 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1 409 inline _GLIBCXX_CONSTEXPR float 410 pow(float __x, float __y) 411 { return __builtin_powf(__x, __y); } 412 413 inline _GLIBCXX_CONSTEXPR long double 414 pow(long double __x, long double __y) 415 { return __builtin_powl(__x, __y); } 416 417 #ifndef __GXX_EXPERIMENTAL_CXX0X__ 418 // _GLIBCXX_RESOLVE_LIB_DEFECTS 419 // DR 550. What should the return type of pow(float,int) be? 420 inline double 421 pow(double __x, int __i) 422 { return __builtin_powi(__x, __i); } 423 424 inline float 425 pow(float __x, int __n) 426 { return __builtin_powif(__x, __n); } 427 428 inline long double 429 pow(long double __x, int __n) 430 { return __builtin_powil(__x, __n); } 431 #endif 432 #endif 433 434 template<typename _Tp, typename _Up> 435 inline _GLIBCXX_CONSTEXPR 436 typename __gnu_cxx::__promote_2<_Tp, _Up>::__type 437 pow(_Tp __x, _Up __y) 438 { 439 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 440 return pow(__type(__x), __type(__y)); 441 } 442 443 using ::sin; 444 445 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1 446 inline _GLIBCXX_CONSTEXPR float 447 sin(float __x) 448 { return __builtin_sinf(__x); } 449 450 inline _GLIBCXX_CONSTEXPR long double 451 sin(long double __x) 452 { return __builtin_sinl(__x); } 453 #endif 454 455 template<typename _Tp> 456 inline _GLIBCXX_CONSTEXPR 457 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 458 double>::__type 459 sin(_Tp __x) 460 { return __builtin_sin(__x); } 461 462 using ::sinh; 463 464 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1 465 inline _GLIBCXX_CONSTEXPR float 466 sinh(float __x) 467 { return __builtin_sinhf(__x); } 468 469 inline _GLIBCXX_CONSTEXPR long double 470 sinh(long double __x) 471 { return __builtin_sinhl(__x); } 472 #endif 473 474 template<typename _Tp> 475 inline _GLIBCXX_CONSTEXPR 476 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 477 double>::__type 478 sinh(_Tp __x) 479 { return __builtin_sinh(__x); } 480 481 using ::sqrt; 482 483 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1 484 inline _GLIBCXX_CONSTEXPR float 485 sqrt(float __x) 486 { return __builtin_sqrtf(__x); } 487 488 inline _GLIBCXX_CONSTEXPR long double 489 sqrt(long double __x) 490 { return __builtin_sqrtl(__x); } 491 #endif 492 493 template<typename _Tp> 494 inline _GLIBCXX_CONSTEXPR 495 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 496 double>::__type 497 sqrt(_Tp __x) 498 { return __builtin_sqrt(__x); } 499 500 using ::tan; 501 502 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1 503 inline _GLIBCXX_CONSTEXPR float 504 tan(float __x) 505 { return __builtin_tanf(__x); } 506 507 inline _GLIBCXX_CONSTEXPR long double 508 tan(long double __x) 509 { return __builtin_tanl(__x); } 510 #endif 511 512 template<typename _Tp> 513 inline _GLIBCXX_CONSTEXPR 514 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 515 double>::__type 516 tan(_Tp __x) 517 { return __builtin_tan(__x); } 518 519 using ::tanh; 520 521 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1 522 inline _GLIBCXX_CONSTEXPR float 523 tanh(float __x) 524 { return __builtin_tanhf(__x); } 525 526 inline _GLIBCXX_CONSTEXPR long double 527 tanh(long double __x) 528 { return __builtin_tanhl(__x); } 529 #endif 530 531 template<typename _Tp> 532 inline _GLIBCXX_CONSTEXPR 533 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 534 double>::__type 535 tanh(_Tp __x) 536 { return __builtin_tanh(__x); } 537 538 _GLIBCXX_END_NAMESPACE_VERSION 539 } // namespace 540 541 #if _GLIBCXX_USE_C99_MATH 542 #if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC 543 544 // These are possible macros imported from C99-land. 545 #undef fpclassify 546 #undef isfinite 547 #undef isinf 548 #undef isnan 549 #undef isnormal 550 #undef signbit 551 #undef isgreater 552 #undef isgreaterequal 553 #undef isless 554 #undef islessequal 555 #undef islessgreater 556 #undef isunordered 557 558 namespace std _GLIBCXX_VISIBILITY(default) 559 { 560 _GLIBCXX_BEGIN_NAMESPACE_VERSION 561 562 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 563 constexpr int 564 fpclassify(float __x) 565 { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, 566 FP_SUBNORMAL, FP_ZERO, __x); } 567 568 constexpr int 569 fpclassify(double __x) 570 { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, 571 FP_SUBNORMAL, FP_ZERO, __x); } 572 573 constexpr int 574 fpclassify(long double __x) 575 { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, 576 FP_SUBNORMAL, FP_ZERO, __x); } 577 578 template<typename _Tp> 579 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 580 int>::__type 581 fpclassify(_Tp __x) 582 { return __x != 0 ? FP_NORMAL : FP_ZERO; } 583 584 constexpr bool 585 isfinite(float __x) 586 { return __builtin_isfinite(__x); } 587 588 constexpr bool 589 isfinite(double __x) 590 { return __builtin_isfinite(__x); } 591 592 constexpr bool 593 isfinite(long double __x) 594 { return __builtin_isfinite(__x); } 595 596 template<typename _Tp> 597 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 598 bool>::__type 599 isfinite(_Tp __x) 600 { return true; } 601 602 constexpr bool 603 isinf(float __x) 604 { return __builtin_isinf(__x); } 605 606 constexpr bool 607 isinf(double __x) 608 { return __builtin_isinf(__x); } 609 610 constexpr bool 611 isinf(long double __x) 612 { return __builtin_isinf(__x); } 613 614 template<typename _Tp> 615 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 616 bool>::__type 617 isinf(_Tp __x) 618 { return false; } 619 620 constexpr bool 621 isnan(float __x) 622 { return __builtin_isnan(__x); } 623 624 constexpr bool 625 isnan(double __x) 626 { return __builtin_isnan(__x); } 627 628 constexpr bool 629 isnan(long double __x) 630 { return __builtin_isnan(__x); } 631 632 template<typename _Tp> 633 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 634 bool>::__type 635 isnan(_Tp __x) 636 { return false; } 637 638 constexpr bool 639 isnormal(float __x) 640 { return __builtin_isnormal(__x); } 641 642 constexpr bool 643 isnormal(double __x) 644 { return __builtin_isnormal(__x); } 645 646 constexpr bool 647 isnormal(long double __x) 648 { return __builtin_isnormal(__x); } 649 650 template<typename _Tp> 651 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 652 bool>::__type 653 isnormal(_Tp __x) 654 { return __x != 0 ? true : false; } 655 656 constexpr bool 657 signbit(float __x) 658 { return __builtin_signbit(__x); } 659 660 constexpr bool 661 signbit(double __x) 662 { return __builtin_signbit(__x); } 663 664 constexpr bool 665 signbit(long double __x) 666 { return __builtin_signbit(__x); } 667 668 template<typename _Tp> 669 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 670 bool>::__type 671 signbit(_Tp __x) 672 { return __x < 0 ? true : false; } 673 674 constexpr bool 675 isgreater(float __x, float __y) 676 { return __builtin_isgreater(__x, __y); } 677 678 constexpr bool 679 isgreater(double __x, double __y) 680 { return __builtin_isgreater(__x, __y); } 681 682 constexpr bool 683 isgreater(long double __x, long double __y) 684 { return __builtin_isgreater(__x, __y); } 685 686 template<typename _Tp, typename _Up> 687 constexpr typename 688 __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value 689 && __is_arithmetic<_Up>::__value), bool>::__type 690 isgreater(_Tp __x, _Up __y) 691 { 692 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 693 return __builtin_isgreater(__type(__x), __type(__y)); 694 } 695 696 constexpr bool 697 isgreaterequal(float __x, float __y) 698 { return __builtin_isgreaterequal(__x, __y); } 699 700 constexpr bool 701 isgreaterequal(double __x, double __y) 702 { return __builtin_isgreaterequal(__x, __y); } 703 704 constexpr bool 705 isgreaterequal(long double __x, long double __y) 706 { return __builtin_isgreaterequal(__x, __y); } 707 708 template<typename _Tp, typename _Up> 709 constexpr typename 710 __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value 711 && __is_arithmetic<_Up>::__value), bool>::__type 712 isgreaterequal(_Tp __x, _Up __y) 713 { 714 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 715 return __builtin_isgreaterequal(__type(__x), __type(__y)); 716 } 717 718 constexpr bool 719 isless(float __x, float __y) 720 { return __builtin_isless(__x, __y); } 721 722 constexpr bool 723 isless(double __x, double __y) 724 { return __builtin_isless(__x, __y); } 725 726 constexpr bool 727 isless(long double __x, long double __y) 728 { return __builtin_isless(__x, __y); } 729 730 template<typename _Tp, typename _Up> 731 constexpr typename 732 __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value 733 && __is_arithmetic<_Up>::__value), bool>::__type 734 isless(_Tp __x, _Up __y) 735 { 736 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 737 return __builtin_isless(__type(__x), __type(__y)); 738 } 739 740 constexpr bool 741 islessequal(float __x, float __y) 742 { return __builtin_islessequal(__x, __y); } 743 744 constexpr bool 745 islessequal(double __x, double __y) 746 { return __builtin_islessequal(__x, __y); } 747 748 constexpr bool 749 islessequal(long double __x, long double __y) 750 { return __builtin_islessequal(__x, __y); } 751 752 template<typename _Tp, typename _Up> 753 constexpr typename 754 __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value 755 && __is_arithmetic<_Up>::__value), bool>::__type 756 islessequal(_Tp __x, _Up __y) 757 { 758 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 759 return __builtin_islessequal(__type(__x), __type(__y)); 760 } 761 762 constexpr bool 763 islessgreater(float __x, float __y) 764 { return __builtin_islessgreater(__x, __y); } 765 766 constexpr bool 767 islessgreater(double __x, double __y) 768 { return __builtin_islessgreater(__x, __y); } 769 770 constexpr bool 771 islessgreater(long double __x, long double __y) 772 { return __builtin_islessgreater(__x, __y); } 773 774 template<typename _Tp, typename _Up> 775 constexpr typename 776 __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value 777 && __is_arithmetic<_Up>::__value), bool>::__type 778 islessgreater(_Tp __x, _Up __y) 779 { 780 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 781 return __builtin_islessgreater(__type(__x), __type(__y)); 782 } 783 784 constexpr bool 785 isunordered(float __x, float __y) 786 { return __builtin_isunordered(__x, __y); } 787 788 constexpr bool 789 isunordered(double __x, double __y) 790 { return __builtin_isunordered(__x, __y); } 791 792 constexpr bool 793 isunordered(long double __x, long double __y) 794 { return __builtin_isunordered(__x, __y); } 795 796 template<typename _Tp, typename _Up> 797 constexpr typename 798 __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value 799 && __is_arithmetic<_Up>::__value), bool>::__type 800 isunordered(_Tp __x, _Up __y) 801 { 802 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 803 return __builtin_isunordered(__type(__x), __type(__y)); 804 } 805 806 #else 807 808 template<typename _Tp> 809 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 810 int>::__type 811 fpclassify(_Tp __f) 812 { 813 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 814 return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, 815 FP_SUBNORMAL, FP_ZERO, __type(__f)); 816 } 817 818 template<typename _Tp> 819 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 820 int>::__type 821 isfinite(_Tp __f) 822 { 823 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 824 return __builtin_isfinite(__type(__f)); 825 } 826 827 template<typename _Tp> 828 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 829 int>::__type 830 isinf(_Tp __f) 831 { 832 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 833 return __builtin_isinf(__type(__f)); 834 } 835 836 template<typename _Tp> 837 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 838 int>::__type 839 isnan(_Tp __f) 840 { 841 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 842 return __builtin_isnan(__type(__f)); 843 } 844 845 template<typename _Tp> 846 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 847 int>::__type 848 isnormal(_Tp __f) 849 { 850 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 851 return __builtin_isnormal(__type(__f)); 852 } 853 854 template<typename _Tp> 855 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 856 int>::__type 857 signbit(_Tp __f) 858 { 859 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 860 return __builtin_signbit(__type(__f)); 861 } 862 863 template<typename _Tp> 864 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 865 int>::__type 866 isgreater(_Tp __f1, _Tp __f2) 867 { 868 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 869 return __builtin_isgreater(__type(__f1), __type(__f2)); 870 } 871 872 template<typename _Tp> 873 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 874 int>::__type 875 isgreaterequal(_Tp __f1, _Tp __f2) 876 { 877 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 878 return __builtin_isgreaterequal(__type(__f1), __type(__f2)); 879 } 880 881 template<typename _Tp> 882 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 883 int>::__type 884 isless(_Tp __f1, _Tp __f2) 885 { 886 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 887 return __builtin_isless(__type(__f1), __type(__f2)); 888 } 889 890 template<typename _Tp> 891 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 892 int>::__type 893 islessequal(_Tp __f1, _Tp __f2) 894 { 895 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 896 return __builtin_islessequal(__type(__f1), __type(__f2)); 897 } 898 899 template<typename _Tp> 900 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 901 int>::__type 902 islessgreater(_Tp __f1, _Tp __f2) 903 { 904 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 905 return __builtin_islessgreater(__type(__f1), __type(__f2)); 906 } 907 908 template<typename _Tp> 909 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 910 int>::__type 911 isunordered(_Tp __f1, _Tp __f2) 912 { 913 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 914 return __builtin_isunordered(__type(__f1), __type(__f2)); 915 } 916 917 #endif 918 919 _GLIBCXX_END_NAMESPACE_VERSION 920 } // namespace 921 922 #endif /* _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC */ 923 #endif 924 925 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 926 927 #ifdef _GLIBCXX_USE_C99_MATH_TR1 928 929 #undef acosh 930 #undef acoshf 931 #undef acoshl 932 #undef asinh 933 #undef asinhf 934 #undef asinhl 935 #undef atanh 936 #undef atanhf 937 #undef atanhl 938 #undef cbrt 939 #undef cbrtf 940 #undef cbrtl 941 #undef copysign 942 #undef copysignf 943 #undef copysignl 944 #undef erf 945 #undef erff 946 #undef erfl 947 #undef erfc 948 #undef erfcf 949 #undef erfcl 950 #undef exp2 951 #undef exp2f 952 #undef exp2l 953 #undef expm1 954 #undef expm1f 955 #undef expm1l 956 #undef fdim 957 #undef fdimf 958 #undef fdiml 959 #undef fma 960 #undef fmaf 961 #undef fmal 962 #undef fmax 963 #undef fmaxf 964 #undef fmaxl 965 #undef fmin 966 #undef fminf 967 #undef fminl 968 #undef hypot 969 #undef hypotf 970 #undef hypotl 971 #undef ilogb 972 #undef ilogbf 973 #undef ilogbl 974 #undef lgamma 975 #undef lgammaf 976 #undef lgammal 977 #undef llrint 978 #undef llrintf 979 #undef llrintl 980 #undef llround 981 #undef llroundf 982 #undef llroundl 983 #undef log1p 984 #undef log1pf 985 #undef log1pl 986 #undef log2 987 #undef log2f 988 #undef log2l 989 #undef logb 990 #undef logbf 991 #undef logbl 992 #undef lrint 993 #undef lrintf 994 #undef lrintl 995 #undef lround 996 #undef lroundf 997 #undef lroundl 998 #undef nan 999 #undef nanf 1000 #undef nanl 1001 #undef nearbyint 1002 #undef nearbyintf 1003 #undef nearbyintl 1004 #undef nextafter 1005 #undef nextafterf 1006 #undef nextafterl 1007 #undef nexttoward 1008 #undef nexttowardf 1009 #undef nexttowardl 1010 #undef remainder 1011 #undef remainderf 1012 #undef remainderl 1013 #undef remquo 1014 #undef remquof 1015 #undef remquol 1016 #undef rint 1017 #undef rintf 1018 #undef rintl 1019 #undef round 1020 #undef roundf 1021 #undef roundl 1022 #undef scalbln 1023 #undef scalblnf 1024 #undef scalblnl 1025 #undef scalbn 1026 #undef scalbnf 1027 #undef scalbnl 1028 #undef tgamma 1029 #undef tgammaf 1030 #undef tgammal 1031 #undef trunc 1032 #undef truncf 1033 #undef truncl 1034 1035 namespace std _GLIBCXX_VISIBILITY(default) 1036 { 1037 _GLIBCXX_BEGIN_NAMESPACE_VERSION 1038 1039 // types 1040 using ::double_t; 1041 using ::float_t; 1042 1043 // functions 1044 using ::acosh; 1045 using ::acoshf; 1046 using ::acoshl; 1047 1048 using ::asinh; 1049 using ::asinhf; 1050 using ::asinhl; 1051 1052 using ::atanh; 1053 using ::atanhf; 1054 using ::atanhl; 1055 1056 using ::cbrt; 1057 using ::cbrtf; 1058 using ::cbrtl; 1059 1060 using ::copysign; 1061 using ::copysignf; 1062 using ::copysignl; 1063 1064 using ::erf; 1065 using ::erff; 1066 using ::erfl; 1067 1068 using ::erfc; 1069 using ::erfcf; 1070 using ::erfcl; 1071 1072 using ::exp2; 1073 using ::exp2f; 1074 using ::exp2l; 1075 1076 using ::expm1; 1077 using ::expm1f; 1078 using ::expm1l; 1079 1080 using ::fdim; 1081 using ::fdimf; 1082 using ::fdiml; 1083 1084 using ::fma; 1085 using ::fmaf; 1086 using ::fmal; 1087 1088 using ::fmax; 1089 using ::fmaxf; 1090 using ::fmaxl; 1091 1092 using ::fmin; 1093 using ::fminf; 1094 using ::fminl; 1095 1096 using ::hypot; 1097 using ::hypotf; 1098 using ::hypotl; 1099 1100 using ::ilogb; 1101 using ::ilogbf; 1102 using ::ilogbl; 1103 1104 using ::lgamma; 1105 using ::lgammaf; 1106 using ::lgammal; 1107 1108 using ::llrint; 1109 using ::llrintf; 1110 using ::llrintl; 1111 1112 using ::llround; 1113 using ::llroundf; 1114 using ::llroundl; 1115 1116 using ::log1p; 1117 using ::log1pf; 1118 using ::log1pl; 1119 1120 using ::log2; 1121 using ::log2f; 1122 using ::log2l; 1123 1124 using ::logb; 1125 using ::logbf; 1126 using ::logbl; 1127 1128 using ::lrint; 1129 using ::lrintf; 1130 using ::lrintl; 1131 1132 using ::lround; 1133 using ::lroundf; 1134 using ::lroundl; 1135 1136 using ::nan; 1137 using ::nanf; 1138 using ::nanl; 1139 1140 using ::nearbyint; 1141 using ::nearbyintf; 1142 using ::nearbyintl; 1143 1144 using ::nextafter; 1145 using ::nextafterf; 1146 using ::nextafterl; 1147 1148 using ::nexttoward; 1149 using ::nexttowardf; 1150 using ::nexttowardl; 1151 1152 using ::remainder; 1153 using ::remainderf; 1154 using ::remainderl; 1155 1156 using ::remquo; 1157 using ::remquof; 1158 using ::remquol; 1159 1160 using ::rint; 1161 using ::rintf; 1162 using ::rintl; 1163 1164 using ::round; 1165 using ::roundf; 1166 using ::roundl; 1167 1168 using ::scalbln; 1169 using ::scalblnf; 1170 using ::scalblnl; 1171 1172 using ::scalbn; 1173 using ::scalbnf; 1174 using ::scalbnl; 1175 1176 using ::tgamma; 1177 using ::tgammaf; 1178 using ::tgammal; 1179 1180 using ::trunc; 1181 using ::truncf; 1182 using ::truncl; 1183 1184 /// Additional overloads. 1185 constexpr float 1186 acosh(float __x) 1187 { return __builtin_acoshf(__x); } 1188 1189 constexpr long double 1190 acosh(long double __x) 1191 { return __builtin_acoshl(__x); } 1192 1193 template<typename _Tp> 1194 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 1195 double>::__type 1196 acosh(_Tp __x) 1197 { return __builtin_acosh(__x); } 1198 1199 constexpr float 1200 asinh(float __x) 1201 { return __builtin_asinhf(__x); } 1202 1203 constexpr long double 1204 asinh(long double __x) 1205 { return __builtin_asinhl(__x); } 1206 1207 template<typename _Tp> 1208 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 1209 double>::__type 1210 asinh(_Tp __x) 1211 { return __builtin_asinh(__x); } 1212 1213 constexpr float 1214 atanh(float __x) 1215 { return __builtin_atanhf(__x); } 1216 1217 constexpr long double 1218 atanh(long double __x) 1219 { return __builtin_atanhl(__x); } 1220 1221 template<typename _Tp> 1222 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 1223 double>::__type 1224 atanh(_Tp __x) 1225 { return __builtin_atanh(__x); } 1226 1227 constexpr float 1228 cbrt(float __x) 1229 { return __builtin_cbrtf(__x); } 1230 1231 constexpr long double 1232 cbrt(long double __x) 1233 { return __builtin_cbrtl(__x); } 1234 1235 template<typename _Tp> 1236 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 1237 double>::__type 1238 cbrt(_Tp __x) 1239 { return __builtin_cbrt(__x); } 1240 1241 constexpr float 1242 copysign(float __x, float __y) 1243 { return __builtin_copysignf(__x, __y); } 1244 1245 constexpr long double 1246 copysign(long double __x, long double __y) 1247 { return __builtin_copysignl(__x, __y); } 1248 1249 template<typename _Tp, typename _Up> 1250 constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type 1251 copysign(_Tp __x, _Up __y) 1252 { 1253 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 1254 return copysign(__type(__x), __type(__y)); 1255 } 1256 1257 constexpr float 1258 erf(float __x) 1259 { return __builtin_erff(__x); } 1260 1261 constexpr long double 1262 erf(long double __x) 1263 { return __builtin_erfl(__x); } 1264 1265 template<typename _Tp> 1266 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 1267 double>::__type 1268 erf(_Tp __x) 1269 { return __builtin_erf(__x); } 1270 1271 constexpr float 1272 erfc(float __x) 1273 { return __builtin_erfcf(__x); } 1274 1275 constexpr long double 1276 erfc(long double __x) 1277 { return __builtin_erfcl(__x); } 1278 1279 template<typename _Tp> 1280 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 1281 double>::__type 1282 erfc(_Tp __x) 1283 { return __builtin_erfc(__x); } 1284 1285 constexpr float 1286 exp2(float __x) 1287 { return __builtin_exp2f(__x); } 1288 1289 constexpr long double 1290 exp2(long double __x) 1291 { return __builtin_exp2l(__x); } 1292 1293 template<typename _Tp> 1294 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 1295 double>::__type 1296 exp2(_Tp __x) 1297 { return __builtin_exp2(__x); } 1298 1299 constexpr float 1300 expm1(float __x) 1301 { return __builtin_expm1f(__x); } 1302 1303 constexpr long double 1304 expm1(long double __x) 1305 { return __builtin_expm1l(__x); } 1306 1307 template<typename _Tp> 1308 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 1309 double>::__type 1310 expm1(_Tp __x) 1311 { return __builtin_expm1(__x); } 1312 1313 constexpr float 1314 fdim(float __x, float __y) 1315 { return __builtin_fdimf(__x, __y); } 1316 1317 constexpr long double 1318 fdim(long double __x, long double __y) 1319 { return __builtin_fdiml(__x, __y); } 1320 1321 template<typename _Tp, typename _Up> 1322 constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type 1323 fdim(_Tp __x, _Up __y) 1324 { 1325 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 1326 return fdim(__type(__x), __type(__y)); 1327 } 1328 1329 constexpr float 1330 fma(float __x, float __y, float __z) 1331 { return __builtin_fmaf(__x, __y, __z); } 1332 1333 constexpr long double 1334 fma(long double __x, long double __y, long double __z) 1335 { return __builtin_fmal(__x, __y, __z); } 1336 1337 template<typename _Tp, typename _Up, typename _Vp> 1338 constexpr typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type 1339 fma(_Tp __x, _Up __y, _Vp __z) 1340 { 1341 typedef typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type __type; 1342 return fma(__type(__x), __type(__y), __type(__z)); 1343 } 1344 1345 constexpr float 1346 fmax(float __x, float __y) 1347 { return __builtin_fmaxf(__x, __y); } 1348 1349 constexpr long double 1350 fmax(long double __x, long double __y) 1351 { return __builtin_fmaxl(__x, __y); } 1352 1353 template<typename _Tp, typename _Up> 1354 constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type 1355 fmax(_Tp __x, _Up __y) 1356 { 1357 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 1358 return fmax(__type(__x), __type(__y)); 1359 } 1360 1361 constexpr float 1362 fmin(float __x, float __y) 1363 { return __builtin_fminf(__x, __y); } 1364 1365 constexpr long double 1366 fmin(long double __x, long double __y) 1367 { return __builtin_fminl(__x, __y); } 1368 1369 template<typename _Tp, typename _Up> 1370 constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type 1371 fmin(_Tp __x, _Up __y) 1372 { 1373 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 1374 return fmin(__type(__x), __type(__y)); 1375 } 1376 1377 constexpr float 1378 hypot(float __x, float __y) 1379 { return __builtin_hypotf(__x, __y); } 1380 1381 constexpr long double 1382 hypot(long double __x, long double __y) 1383 { return __builtin_hypotl(__x, __y); } 1384 1385 template<typename _Tp, typename _Up> 1386 constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type 1387 hypot(_Tp __x, _Up __y) 1388 { 1389 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 1390 return hypot(__type(__x), __type(__y)); 1391 } 1392 1393 constexpr int 1394 ilogb(float __x) 1395 { return __builtin_ilogbf(__x); } 1396 1397 constexpr int 1398 ilogb(long double __x) 1399 { return __builtin_ilogbl(__x); } 1400 1401 template<typename _Tp> 1402 constexpr 1403 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 1404 int>::__type 1405 ilogb(_Tp __x) 1406 { return __builtin_ilogb(__x); } 1407 1408 constexpr float 1409 lgamma(float __x) 1410 { return __builtin_lgammaf(__x); } 1411 1412 constexpr long double 1413 lgamma(long double __x) 1414 { return __builtin_lgammal(__x); } 1415 1416 template<typename _Tp> 1417 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 1418 double>::__type 1419 lgamma(_Tp __x) 1420 { return __builtin_lgamma(__x); } 1421 1422 constexpr long long 1423 llrint(float __x) 1424 { return __builtin_llrintf(__x); } 1425 1426 constexpr long long 1427 llrint(long double __x) 1428 { return __builtin_llrintl(__x); } 1429 1430 template<typename _Tp> 1431 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 1432 long long>::__type 1433 llrint(_Tp __x) 1434 { return __builtin_llrint(__x); } 1435 1436 constexpr long long 1437 llround(float __x) 1438 { return __builtin_llroundf(__x); } 1439 1440 constexpr long long 1441 llround(long double __x) 1442 { return __builtin_llroundl(__x); } 1443 1444 template<typename _Tp> 1445 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 1446 long long>::__type 1447 llround(_Tp __x) 1448 { return __builtin_llround(__x); } 1449 1450 constexpr float 1451 log1p(float __x) 1452 { return __builtin_log1pf(__x); } 1453 1454 constexpr long double 1455 log1p(long double __x) 1456 { return __builtin_log1pl(__x); } 1457 1458 template<typename _Tp> 1459 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 1460 double>::__type 1461 log1p(_Tp __x) 1462 { return __builtin_log1p(__x); } 1463 1464 // DR 568. 1465 constexpr float 1466 log2(float __x) 1467 { return __builtin_log2f(__x); } 1468 1469 constexpr long double 1470 log2(long double __x) 1471 { return __builtin_log2l(__x); } 1472 1473 template<typename _Tp> 1474 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 1475 double>::__type 1476 log2(_Tp __x) 1477 { return __builtin_log2(__x); } 1478 1479 constexpr float 1480 logb(float __x) 1481 { return __builtin_logbf(__x); } 1482 1483 constexpr long double 1484 logb(long double __x) 1485 { return __builtin_logbl(__x); } 1486 1487 template<typename _Tp> 1488 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 1489 double>::__type 1490 logb(_Tp __x) 1491 { return __builtin_logb(__x); } 1492 1493 constexpr long 1494 lrint(float __x) 1495 { return __builtin_lrintf(__x); } 1496 1497 constexpr long 1498 lrint(long double __x) 1499 { return __builtin_lrintl(__x); } 1500 1501 template<typename _Tp> 1502 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 1503 long>::__type 1504 lrint(_Tp __x) 1505 { return __builtin_lrint(__x); } 1506 1507 constexpr long 1508 lround(float __x) 1509 { return __builtin_lroundf(__x); } 1510 1511 constexpr long 1512 lround(long double __x) 1513 { return __builtin_lroundl(__x); } 1514 1515 template<typename _Tp> 1516 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 1517 long>::__type 1518 lround(_Tp __x) 1519 { return __builtin_lround(__x); } 1520 1521 constexpr float 1522 nearbyint(float __x) 1523 { return __builtin_nearbyintf(__x); } 1524 1525 constexpr long double 1526 nearbyint(long double __x) 1527 { return __builtin_nearbyintl(__x); } 1528 1529 template<typename _Tp> 1530 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 1531 double>::__type 1532 nearbyint(_Tp __x) 1533 { return __builtin_nearbyint(__x); } 1534 1535 constexpr float 1536 nextafter(float __x, float __y) 1537 { return __builtin_nextafterf(__x, __y); } 1538 1539 constexpr long double 1540 nextafter(long double __x, long double __y) 1541 { return __builtin_nextafterl(__x, __y); } 1542 1543 template<typename _Tp, typename _Up> 1544 constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type 1545 nextafter(_Tp __x, _Up __y) 1546 { 1547 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 1548 return nextafter(__type(__x), __type(__y)); 1549 } 1550 1551 constexpr float 1552 nexttoward(float __x, long double __y) 1553 { return __builtin_nexttowardf(__x, __y); } 1554 1555 constexpr long double 1556 nexttoward(long double __x, long double __y) 1557 { return __builtin_nexttowardl(__x, __y); } 1558 1559 template<typename _Tp> 1560 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 1561 double>::__type 1562 nexttoward(_Tp __x, long double __y) 1563 { return __builtin_nexttoward(__x, __y); } 1564 1565 constexpr float 1566 remainder(float __x, float __y) 1567 { return __builtin_remainderf(__x, __y); } 1568 1569 constexpr long double 1570 remainder(long double __x, long double __y) 1571 { return __builtin_remainderl(__x, __y); } 1572 1573 template<typename _Tp, typename _Up> 1574 constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type 1575 remainder(_Tp __x, _Up __y) 1576 { 1577 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 1578 return remainder(__type(__x), __type(__y)); 1579 } 1580 1581 inline float 1582 remquo(float __x, float __y, int* __pquo) 1583 { return __builtin_remquof(__x, __y, __pquo); } 1584 1585 inline long double 1586 remquo(long double __x, long double __y, int* __pquo) 1587 { return __builtin_remquol(__x, __y, __pquo); } 1588 1589 template<typename _Tp, typename _Up> 1590 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type 1591 remquo(_Tp __x, _Up __y, int* __pquo) 1592 { 1593 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 1594 return remquo(__type(__x), __type(__y), __pquo); 1595 } 1596 1597 constexpr float 1598 rint(float __x) 1599 { return __builtin_rintf(__x); } 1600 1601 constexpr long double 1602 rint(long double __x) 1603 { return __builtin_rintl(__x); } 1604 1605 template<typename _Tp> 1606 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 1607 double>::__type 1608 rint(_Tp __x) 1609 { return __builtin_rint(__x); } 1610 1611 constexpr float 1612 round(float __x) 1613 { return __builtin_roundf(__x); } 1614 1615 constexpr long double 1616 round(long double __x) 1617 { return __builtin_roundl(__x); } 1618 1619 template<typename _Tp> 1620 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 1621 double>::__type 1622 round(_Tp __x) 1623 { return __builtin_round(__x); } 1624 1625 constexpr float 1626 scalbln(float __x, long __ex) 1627 { return __builtin_scalblnf(__x, __ex); } 1628 1629 constexpr long double 1630 scalbln(long double __x, long __ex) 1631 { return __builtin_scalblnl(__x, __ex); } 1632 1633 template<typename _Tp> 1634 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 1635 double>::__type 1636 scalbln(_Tp __x, long __ex) 1637 { return __builtin_scalbln(__x, __ex); } 1638 1639 constexpr float 1640 scalbn(float __x, int __ex) 1641 { return __builtin_scalbnf(__x, __ex); } 1642 1643 constexpr long double 1644 scalbn(long double __x, int __ex) 1645 { return __builtin_scalbnl(__x, __ex); } 1646 1647 template<typename _Tp> 1648 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 1649 double>::__type 1650 scalbn(_Tp __x, int __ex) 1651 { return __builtin_scalbn(__x, __ex); } 1652 1653 constexpr float 1654 tgamma(float __x) 1655 { return __builtin_tgammaf(__x); } 1656 1657 constexpr long double 1658 tgamma(long double __x) 1659 { return __builtin_tgammal(__x); } 1660 1661 template<typename _Tp> 1662 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 1663 double>::__type 1664 tgamma(_Tp __x) 1665 { return __builtin_tgamma(__x); } 1666 1667 constexpr float 1668 trunc(float __x) 1669 { return __builtin_truncf(__x); } 1670 1671 constexpr long double 1672 trunc(long double __x) 1673 { return __builtin_truncl(__x); } 1674 1675 template<typename _Tp> 1676 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 1677 double>::__type 1678 trunc(_Tp __x) 1679 { return __builtin_trunc(__x); } 1680 1681 _GLIBCXX_END_NAMESPACE_VERSION 1682 } // namespace 1683 1684 #endif // _GLIBCXX_USE_C99_MATH_TR1 1685 1686 #endif // __GXX_EXPERIMENTAL_CXX0X__ 1687 1688 #endif 1689