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