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