1 // TR1 cmath -*- C++ -*-
3 // Copyright (C) 2006-2015 Free Software Foundation, Inc.
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)
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.
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.
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/>.
26 * This is a TR1 C++ Library header.
29 #ifndef _GLIBCXX_TR1_CMATH
30 #define _GLIBCXX_TR1_CMATH 1
32 #pragma GCC system_header
36 #ifdef _GLIBCXX_USE_C99_MATH_TR1
146 namespace std _GLIBCXX_VISIBILITY(default)
150 _GLIBCXX_BEGIN_NAMESPACE_VERSION
152 #if _GLIBCXX_USE_C99_MATH_TR1
301 #if _GLIBCXX_USE_C99_MATH
302 #if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
304 /// Function template definitions [8.16.3].
305 template<typename _Tp>
306 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
310 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
311 return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
312 FP_SUBNORMAL, FP_ZERO, __type(__f));
315 template<typename _Tp>
316 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
320 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
321 return __builtin_isfinite(__type(__f));
324 template<typename _Tp>
325 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
329 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
330 return __builtin_isinf(__type(__f));
333 template<typename _Tp>
334 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
338 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
339 return __builtin_isnan(__type(__f));
342 template<typename _Tp>
343 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
347 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
348 return __builtin_isnormal(__type(__f));
351 template<typename _Tp>
352 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
356 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
357 return __builtin_signbit(__type(__f));
360 template<typename _Tp>
361 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
363 isgreater(_Tp __f1, _Tp __f2)
365 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
366 return __builtin_isgreater(__type(__f1), __type(__f2));
369 template<typename _Tp>
370 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
372 isgreaterequal(_Tp __f1, _Tp __f2)
374 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
375 return __builtin_isgreaterequal(__type(__f1), __type(__f2));
378 template<typename _Tp>
379 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
381 isless(_Tp __f1, _Tp __f2)
383 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
384 return __builtin_isless(__type(__f1), __type(__f2));
387 template<typename _Tp>
388 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
390 islessequal(_Tp __f1, _Tp __f2)
392 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
393 return __builtin_islessequal(__type(__f1), __type(__f2));
396 template<typename _Tp>
397 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
399 islessgreater(_Tp __f1, _Tp __f2)
401 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
402 return __builtin_islessgreater(__type(__f1), __type(__f2));
405 template<typename _Tp>
406 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
408 isunordered(_Tp __f1, _Tp __f2)
410 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
411 return __builtin_isunordered(__type(__f1), __type(__f2));
417 #if _GLIBCXX_USE_C99_MATH_TR1
419 /// Additional overloads [8.16.4].
422 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
425 { return __builtin_acoshf(__x); }
428 acosh(long double __x)
429 { return __builtin_acoshl(__x); }
432 template<typename _Tp>
433 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
436 { return __builtin_acosh(__x); }
440 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
443 { return __builtin_asinhf(__x); }
446 asinh(long double __x)
447 { return __builtin_asinhl(__x); }
450 template<typename _Tp>
451 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
454 { return __builtin_asinh(__x); }
459 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
462 { return __builtin_atanhf(__x); }
465 atanh(long double __x)
466 { return __builtin_atanhl(__x); }
469 template<typename _Tp>
470 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
473 { return __builtin_atanh(__x); }
475 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
478 { return __builtin_cbrtf(__x); }
481 cbrt(long double __x)
482 { return __builtin_cbrtl(__x); }
485 template<typename _Tp>
486 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
489 { return __builtin_cbrt(__x); }
493 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
495 copysign(float __x, float __y)
496 { return __builtin_copysignf(__x, __y); }
499 copysign(long double __x, long double __y)
500 { return __builtin_copysignl(__x, __y); }
503 template<typename _Tp, typename _Up>
504 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
505 copysign(_Tp __x, _Up __y)
507 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
508 return copysign(__type(__x), __type(__y));
514 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
517 { return __builtin_erff(__x); }
521 { return __builtin_erfl(__x); }
524 template<typename _Tp>
525 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
528 { return __builtin_erf(__x); }
530 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
533 { return __builtin_erfcf(__x); }
536 erfc(long double __x)
537 { return __builtin_erfcl(__x); }
540 template<typename _Tp>
541 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
544 { return __builtin_erfc(__x); }
548 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
551 { return __builtin_exp2f(__x); }
554 exp2(long double __x)
555 { return __builtin_exp2l(__x); }
558 template<typename _Tp>
559 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
562 { return __builtin_exp2(__x); }
564 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
567 { return __builtin_expm1f(__x); }
570 expm1(long double __x)
571 { return __builtin_expm1l(__x); }
574 template<typename _Tp>
575 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
578 { return __builtin_expm1(__x); }
580 // Note: we deal with fabs in a special way, because an using std::fabs
581 // would bring in also the overloads for complex types, which in C++0x
582 // mode have a different return type.
583 // With __CORRECT_ISO_CPP_MATH_H_PROTO, math.h imports std::fabs in the
584 // global namespace after the declarations of the float / double / long
585 // double overloads but before the std::complex overloads.
588 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
589 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
592 { return __builtin_fabsf(__x); }
595 fabs(long double __x)
596 { return __builtin_fabsl(__x); }
599 template<typename _Tp>
600 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
603 { return __builtin_fabs(__x); }
606 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
608 fdim(float __x, float __y)
609 { return __builtin_fdimf(__x, __y); }
612 fdim(long double __x, long double __y)
613 { return __builtin_fdiml(__x, __y); }
616 template<typename _Tp, typename _Up>
617 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
618 fdim(_Tp __x, _Up __y)
620 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
621 return fdim(__type(__x), __type(__y));
626 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
628 fma(float __x, float __y, float __z)
629 { return __builtin_fmaf(__x, __y, __z); }
632 fma(long double __x, long double __y, long double __z)
633 { return __builtin_fmal(__x, __y, __z); }
636 template<typename _Tp, typename _Up, typename _Vp>
637 inline typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type
638 fma(_Tp __x, _Up __y, _Vp __z)
640 typedef typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type __type;
641 return fma(__type(__x), __type(__y), __type(__z));
644 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
646 fmax(float __x, float __y)
647 { return __builtin_fmaxf(__x, __y); }
650 fmax(long double __x, long double __y)
651 { return __builtin_fmaxl(__x, __y); }
654 template<typename _Tp, typename _Up>
655 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
656 fmax(_Tp __x, _Up __y)
658 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
659 return fmax(__type(__x), __type(__y));
662 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
664 fmin(float __x, float __y)
665 { return __builtin_fminf(__x, __y); }
668 fmin(long double __x, long double __y)
669 { return __builtin_fminl(__x, __y); }
672 template<typename _Tp, typename _Up>
673 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
674 fmin(_Tp __x, _Up __y)
676 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
677 return fmin(__type(__x), __type(__y));
683 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
685 hypot(float __x, float __y)
686 { return __builtin_hypotf(__x, __y); }
689 hypot(long double __x, long double __y)
690 { return __builtin_hypotl(__x, __y); }
693 template<typename _Tp, typename _Up>
694 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
695 hypot(_Tp __y, _Up __x)
697 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
698 return hypot(__type(__y), __type(__x));
701 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
704 { return __builtin_ilogbf(__x); }
707 ilogb(long double __x)
708 { return __builtin_ilogbl(__x); }
711 template<typename _Tp>
712 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
715 { return __builtin_ilogb(__x); }
719 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
722 { return __builtin_lgammaf(__x); }
725 lgamma(long double __x)
726 { return __builtin_lgammal(__x); }
729 template<typename _Tp>
730 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
733 { return __builtin_lgamma(__x); }
735 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
738 { return __builtin_llrintf(__x); }
741 llrint(long double __x)
742 { return __builtin_llrintl(__x); }
745 template<typename _Tp>
746 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
749 { return __builtin_llrint(__x); }
751 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
754 { return __builtin_llroundf(__x); }
757 llround(long double __x)
758 { return __builtin_llroundl(__x); }
761 template<typename _Tp>
762 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
765 { return __builtin_llround(__x); }
770 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
773 { return __builtin_log1pf(__x); }
776 log1p(long double __x)
777 { return __builtin_log1pl(__x); }
780 template<typename _Tp>
781 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
784 { return __builtin_log1p(__x); }
787 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
790 { return __builtin_log2f(__x); }
793 log2(long double __x)
794 { return __builtin_log2l(__x); }
797 template<typename _Tp>
798 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
801 { return __builtin_log2(__x); }
803 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
806 { return __builtin_logbf(__x); }
809 logb(long double __x)
810 { return __builtin_logbl(__x); }
813 template<typename _Tp>
814 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
818 return __builtin_logb(__x);
821 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
824 { return __builtin_lrintf(__x); }
827 lrint(long double __x)
828 { return __builtin_lrintl(__x); }
831 template<typename _Tp>
832 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
835 { return __builtin_lrint(__x); }
837 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
840 { return __builtin_lroundf(__x); }
843 lround(long double __x)
844 { return __builtin_lroundl(__x); }
847 template<typename _Tp>
848 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
851 { return __builtin_lround(__x); }
853 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
856 { return __builtin_nearbyintf(__x); }
859 nearbyint(long double __x)
860 { return __builtin_nearbyintl(__x); }
863 template<typename _Tp>
864 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
867 { return __builtin_nearbyint(__x); }
869 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
871 nextafter(float __x, float __y)
872 { return __builtin_nextafterf(__x, __y); }
875 nextafter(long double __x, long double __y)
876 { return __builtin_nextafterl(__x, __y); }
879 template<typename _Tp, typename _Up>
880 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
881 nextafter(_Tp __x, _Up __y)
883 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
884 return nextafter(__type(__x), __type(__y));
887 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
889 nexttoward(float __x, long double __y)
890 { return __builtin_nexttowardf(__x, __y); }
893 nexttoward(long double __x, long double __y)
894 { return __builtin_nexttowardl(__x, __y); }
897 template<typename _Tp>
898 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
900 nexttoward(_Tp __x, long double __y)
901 { return __builtin_nexttoward(__x, __y); }
903 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
905 remainder(float __x, float __y)
906 { return __builtin_remainderf(__x, __y); }
909 remainder(long double __x, long double __y)
910 { return __builtin_remainderl(__x, __y); }
913 template<typename _Tp, typename _Up>
914 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
915 remainder(_Tp __x, _Up __y)
917 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
918 return remainder(__type(__x), __type(__y));
921 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
923 remquo(float __x, float __y, int* __pquo)
924 { return __builtin_remquof(__x, __y, __pquo); }
927 remquo(long double __x, long double __y, int* __pquo)
928 { return __builtin_remquol(__x, __y, __pquo); }
931 template<typename _Tp, typename _Up>
932 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
933 remquo(_Tp __x, _Up __y, int* __pquo)
935 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
936 return remquo(__type(__x), __type(__y), __pquo);
939 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
942 { return __builtin_rintf(__x); }
945 rint(long double __x)
946 { return __builtin_rintl(__x); }
949 template<typename _Tp>
950 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
953 { return __builtin_rint(__x); }
955 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
958 { return __builtin_roundf(__x); }
961 round(long double __x)
962 { return __builtin_roundl(__x); }
965 template<typename _Tp>
966 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
969 { return __builtin_round(__x); }
971 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
973 scalbln(float __x, long __ex)
974 { return __builtin_scalblnf(__x, __ex); }
977 scalbln(long double __x, long __ex)
978 { return __builtin_scalblnl(__x, __ex); }
981 template<typename _Tp>
982 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
984 scalbln(_Tp __x, long __ex)
985 { return __builtin_scalbln(__x, __ex); }
987 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
989 scalbn(float __x, int __ex)
990 { return __builtin_scalbnf(__x, __ex); }
993 scalbn(long double __x, int __ex)
994 { return __builtin_scalbnl(__x, __ex); }
997 template<typename _Tp>
998 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1000 scalbn(_Tp __x, int __ex)
1001 { return __builtin_scalbn(__x, __ex); }
1009 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1012 { return __builtin_tgammaf(__x); }
1015 tgamma(long double __x)
1016 { return __builtin_tgammal(__x); }
1019 template<typename _Tp>
1020 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1023 { return __builtin_tgamma(__x); }
1025 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1028 { return __builtin_truncf(__x); }
1031 trunc(long double __x)
1032 { return __builtin_truncl(__x); }
1035 template<typename _Tp>
1036 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1039 { return __builtin_trunc(__x); }
1042 _GLIBCXX_END_NAMESPACE_VERSION
1046 namespace std _GLIBCXX_VISIBILITY(default)
1050 _GLIBCXX_BEGIN_NAMESPACE_VERSION
1052 // DR 550. What should the return type of pow(float,int) be?
1053 // NB: C++0x and TR1 != C++03.
1055 // The std::tr1::pow(double, double) overload cannot be provided
1056 // here, because it would clash with ::pow(double,double) declared
1057 // in <math.h>, if <tr1/math.h> is included at the same time (raised
1058 // by the fix of PR c++/54537). It is not possible either to use the
1059 // using-declaration 'using ::pow;' here, because if the user code
1060 // has a 'using std::pow;', it would bring the pow(*,int) averloads
1061 // in the tr1 namespace, which is undesirable. Consequently, the
1062 // solution is to forward std::tr1::pow(double,double) to
1063 // std::pow(double,double) via the templatized version below. See
1064 // the discussion about this issue here:
1065 // http://gcc.gnu.org/ml/gcc-patches/2012-09/msg01278.html
1067 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1069 pow(float __x, float __y)
1070 { return std::pow(__x, __y); }
1073 pow(long double __x, long double __y)
1074 { return std::pow(__x, __y); }
1077 template<typename _Tp, typename _Up>
1078 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1079 pow(_Tp __x, _Up __y)
1081 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1082 return std::pow(__type(__x), __type(__y));
1085 _GLIBCXX_END_NAMESPACE_VERSION
1089 #include <bits/stl_algobase.h>
1091 #include <tr1/type_traits>
1093 #include <tr1/gamma.tcc>
1094 #include <tr1/bessel_function.tcc>
1095 #include <tr1/beta_function.tcc>
1096 #include <tr1/ell_integral.tcc>
1097 #include <tr1/exp_integral.tcc>
1098 #include <tr1/hypergeometric.tcc>
1099 #include <tr1/legendre_function.tcc>
1100 #include <tr1/modified_bessel_func.tcc>
1101 #include <tr1/poly_hermite.tcc>
1102 #include <tr1/poly_laguerre.tcc>
1103 #include <tr1/riemann_zeta.tcc>
1105 namespace std _GLIBCXX_VISIBILITY(default)
1109 _GLIBCXX_BEGIN_NAMESPACE_VERSION
1112 * @defgroup tr1_math_spec_func Mathematical Special Functions
1115 * A collection of advanced mathematical special functions.
1120 assoc_laguerref(unsigned int __n, unsigned int __m, float __x)
1121 { return __detail::__assoc_laguerre<float>(__n, __m, __x); }
1124 assoc_laguerrel(unsigned int __n, unsigned int __m, long double __x)
1126 return __detail::__assoc_laguerre<long double>(__n, __m, __x);
1129 /// 5.2.1.1 Associated Laguerre polynomials.
1130 template<typename _Tp>
1131 inline typename __gnu_cxx::__promote<_Tp>::__type
1132 assoc_laguerre(unsigned int __n, unsigned int __m, _Tp __x)
1134 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1135 return __detail::__assoc_laguerre<__type>(__n, __m, __x);
1139 assoc_legendref(unsigned int __l, unsigned int __m, float __x)
1140 { return __detail::__assoc_legendre_p<float>(__l, __m, __x); }
1143 assoc_legendrel(unsigned int __l, unsigned int __m, long double __x)
1144 { return __detail::__assoc_legendre_p<long double>(__l, __m, __x); }
1146 /// 5.2.1.2 Associated Legendre functions.
1147 template<typename _Tp>
1148 inline typename __gnu_cxx::__promote<_Tp>::__type
1149 assoc_legendre(unsigned int __l, unsigned int __m, _Tp __x)
1151 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1152 return __detail::__assoc_legendre_p<__type>(__l, __m, __x);
1156 betaf(float __x, float __y)
1157 { return __detail::__beta<float>(__x, __y); }
1160 betal(long double __x, long double __y)
1161 { return __detail::__beta<long double>(__x, __y); }
1163 /// 5.2.1.3 Beta functions.
1164 template<typename _Tpx, typename _Tpy>
1165 inline typename __gnu_cxx::__promote_2<_Tpx, _Tpy>::__type
1166 beta(_Tpx __x, _Tpy __y)
1168 typedef typename __gnu_cxx::__promote_2<_Tpx, _Tpy>::__type __type;
1169 return __detail::__beta<__type>(__x, __y);
1173 comp_ellint_1f(float __k)
1174 { return __detail::__comp_ellint_1<float>(__k); }
1177 comp_ellint_1l(long double __k)
1178 { return __detail::__comp_ellint_1<long double>(__k); }
1180 /// 5.2.1.4 Complete elliptic integrals of the first kind.
1181 template<typename _Tp>
1182 inline typename __gnu_cxx::__promote<_Tp>::__type
1183 comp_ellint_1(_Tp __k)
1185 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1186 return __detail::__comp_ellint_1<__type>(__k);
1190 comp_ellint_2f(float __k)
1191 { return __detail::__comp_ellint_2<float>(__k); }
1194 comp_ellint_2l(long double __k)
1195 { return __detail::__comp_ellint_2<long double>(__k); }
1197 /// 5.2.1.5 Complete elliptic integrals of the second kind.
1198 template<typename _Tp>
1199 inline typename __gnu_cxx::__promote<_Tp>::__type
1200 comp_ellint_2(_Tp __k)
1202 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1203 return __detail::__comp_ellint_2<__type>(__k);
1207 comp_ellint_3f(float __k, float __nu)
1208 { return __detail::__comp_ellint_3<float>(__k, __nu); }
1211 comp_ellint_3l(long double __k, long double __nu)
1212 { return __detail::__comp_ellint_3<long double>(__k, __nu); }
1214 /// 5.2.1.6 Complete elliptic integrals of the third kind.
1215 template<typename _Tp, typename _Tpn>
1216 inline typename __gnu_cxx::__promote_2<_Tp, _Tpn>::__type
1217 comp_ellint_3(_Tp __k, _Tpn __nu)
1219 typedef typename __gnu_cxx::__promote_2<_Tp, _Tpn>::__type __type;
1220 return __detail::__comp_ellint_3<__type>(__k, __nu);
1224 conf_hypergf(float __a, float __c, float __x)
1225 { return __detail::__conf_hyperg<float>(__a, __c, __x); }
1228 conf_hypergl(long double __a, long double __c, long double __x)
1229 { return __detail::__conf_hyperg<long double>(__a, __c, __x); }
1231 /// 5.2.1.7 Confluent hypergeometric functions.
1232 template<typename _Tpa, typename _Tpc, typename _Tp>
1233 inline typename __gnu_cxx::__promote_3<_Tpa, _Tpc, _Tp>::__type
1234 conf_hyperg(_Tpa __a, _Tpc __c, _Tp __x)
1236 typedef typename __gnu_cxx::__promote_3<_Tpa, _Tpc, _Tp>::__type __type;
1237 return __detail::__conf_hyperg<__type>(__a, __c, __x);
1241 cyl_bessel_if(float __nu, float __x)
1242 { return __detail::__cyl_bessel_i<float>(__nu, __x); }
1245 cyl_bessel_il(long double __nu, long double __x)
1246 { return __detail::__cyl_bessel_i<long double>(__nu, __x); }
1248 /// 5.2.1.8 Regular modified cylindrical Bessel functions.
1249 template<typename _Tpnu, typename _Tp>
1250 inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type
1251 cyl_bessel_i(_Tpnu __nu, _Tp __x)
1253 typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type;
1254 return __detail::__cyl_bessel_i<__type>(__nu, __x);
1258 cyl_bessel_jf(float __nu, float __x)
1259 { return __detail::__cyl_bessel_j<float>(__nu, __x); }
1262 cyl_bessel_jl(long double __nu, long double __x)
1263 { return __detail::__cyl_bessel_j<long double>(__nu, __x); }
1265 /// 5.2.1.9 Cylindrical Bessel functions (of the first kind).
1266 template<typename _Tpnu, typename _Tp>
1267 inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type
1268 cyl_bessel_j(_Tpnu __nu, _Tp __x)
1270 typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type;
1271 return __detail::__cyl_bessel_j<__type>(__nu, __x);
1275 cyl_bessel_kf(float __nu, float __x)
1276 { return __detail::__cyl_bessel_k<float>(__nu, __x); }
1279 cyl_bessel_kl(long double __nu, long double __x)
1280 { return __detail::__cyl_bessel_k<long double>(__nu, __x); }
1282 /// 5.2.1.10 Irregular modified cylindrical Bessel functions.
1283 template<typename _Tpnu, typename _Tp>
1284 inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type
1285 cyl_bessel_k(_Tpnu __nu, _Tp __x)
1287 typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type;
1288 return __detail::__cyl_bessel_k<__type>(__nu, __x);
1292 cyl_neumannf(float __nu, float __x)
1293 { return __detail::__cyl_neumann_n<float>(__nu, __x); }
1296 cyl_neumannl(long double __nu, long double __x)
1297 { return __detail::__cyl_neumann_n<long double>(__nu, __x); }
1299 /// 5.2.1.11 Cylindrical Neumann functions.
1300 template<typename _Tpnu, typename _Tp>
1301 inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type
1302 cyl_neumann(_Tpnu __nu, _Tp __x)
1304 typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type;
1305 return __detail::__cyl_neumann_n<__type>(__nu, __x);
1309 ellint_1f(float __k, float __phi)
1310 { return __detail::__ellint_1<float>(__k, __phi); }
1313 ellint_1l(long double __k, long double __phi)
1314 { return __detail::__ellint_1<long double>(__k, __phi); }
1316 /// 5.2.1.12 Incomplete elliptic integrals of the first kind.
1317 template<typename _Tp, typename _Tpp>
1318 inline typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type
1319 ellint_1(_Tp __k, _Tpp __phi)
1321 typedef typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type __type;
1322 return __detail::__ellint_1<__type>(__k, __phi);
1326 ellint_2f(float __k, float __phi)
1327 { return __detail::__ellint_2<float>(__k, __phi); }
1330 ellint_2l(long double __k, long double __phi)
1331 { return __detail::__ellint_2<long double>(__k, __phi); }
1333 /// 5.2.1.13 Incomplete elliptic integrals of the second kind.
1334 template<typename _Tp, typename _Tpp>
1335 inline typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type
1336 ellint_2(_Tp __k, _Tpp __phi)
1338 typedef typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type __type;
1339 return __detail::__ellint_2<__type>(__k, __phi);
1343 ellint_3f(float __k, float __nu, float __phi)
1344 { return __detail::__ellint_3<float>(__k, __nu, __phi); }
1347 ellint_3l(long double __k, long double __nu, long double __phi)
1348 { return __detail::__ellint_3<long double>(__k, __nu, __phi); }
1350 /// 5.2.1.14 Incomplete elliptic integrals of the third kind.
1351 template<typename _Tp, typename _Tpn, typename _Tpp>
1352 inline typename __gnu_cxx::__promote_3<_Tp, _Tpn, _Tpp>::__type
1353 ellint_3(_Tp __k, _Tpn __nu, _Tpp __phi)
1355 typedef typename __gnu_cxx::__promote_3<_Tp, _Tpn, _Tpp>::__type __type;
1356 return __detail::__ellint_3<__type>(__k, __nu, __phi);
1361 { return __detail::__expint<float>(__x); }
1364 expintl(long double __x)
1365 { return __detail::__expint<long double>(__x); }
1367 /// 5.2.1.15 Exponential integrals.
1368 template<typename _Tp>
1369 inline typename __gnu_cxx::__promote<_Tp>::__type
1372 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1373 return __detail::__expint<__type>(__x);
1377 hermitef(unsigned int __n, float __x)
1378 { return __detail::__poly_hermite<float>(__n, __x); }
1381 hermitel(unsigned int __n, long double __x)
1382 { return __detail::__poly_hermite<long double>(__n, __x); }
1384 /// 5.2.1.16 Hermite polynomials.
1385 template<typename _Tp>
1386 inline typename __gnu_cxx::__promote<_Tp>::__type
1387 hermite(unsigned int __n, _Tp __x)
1389 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1390 return __detail::__poly_hermite<__type>(__n, __x);
1394 hypergf(float __a, float __b, float __c, float __x)
1395 { return __detail::__hyperg<float>(__a, __b, __c, __x); }
1398 hypergl(long double __a, long double __b, long double __c, long double __x)
1399 { return __detail::__hyperg<long double>(__a, __b, __c, __x); }
1401 /// 5.2.1.17 Hypergeometric functions.
1402 template<typename _Tpa, typename _Tpb, typename _Tpc, typename _Tp>
1403 inline typename __gnu_cxx::__promote_4<_Tpa, _Tpb, _Tpc, _Tp>::__type
1404 hyperg(_Tpa __a, _Tpb __b, _Tpc __c, _Tp __x)
1406 typedef typename __gnu_cxx::__promote_4<_Tpa, _Tpb, _Tpc, _Tp>::__type __type;
1407 return __detail::__hyperg<__type>(__a, __b, __c, __x);
1411 laguerref(unsigned int __n, float __x)
1412 { return __detail::__laguerre<float>(__n, __x); }
1415 laguerrel(unsigned int __n, long double __x)
1416 { return __detail::__laguerre<long double>(__n, __x); }
1418 /// 5.2.1.18 Laguerre polynomials.
1419 template<typename _Tp>
1420 inline typename __gnu_cxx::__promote<_Tp>::__type
1421 laguerre(unsigned int __n, _Tp __x)
1423 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1424 return __detail::__laguerre<__type>(__n, __x);
1428 legendref(unsigned int __n, float __x)
1429 { return __detail::__poly_legendre_p<float>(__n, __x); }
1432 legendrel(unsigned int __n, long double __x)
1433 { return __detail::__poly_legendre_p<long double>(__n, __x); }
1435 /// 5.2.1.19 Legendre polynomials.
1436 template<typename _Tp>
1437 inline typename __gnu_cxx::__promote<_Tp>::__type
1438 legendre(unsigned int __n, _Tp __x)
1440 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1441 return __detail::__poly_legendre_p<__type>(__n, __x);
1445 riemann_zetaf(float __x)
1446 { return __detail::__riemann_zeta<float>(__x); }
1449 riemann_zetal(long double __x)
1450 { return __detail::__riemann_zeta<long double>(__x); }
1452 /// 5.2.1.20 Riemann zeta function.
1453 template<typename _Tp>
1454 inline typename __gnu_cxx::__promote<_Tp>::__type
1455 riemann_zeta(_Tp __x)
1457 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1458 return __detail::__riemann_zeta<__type>(__x);
1462 sph_besself(unsigned int __n, float __x)
1463 { return __detail::__sph_bessel<float>(__n, __x); }
1466 sph_bessell(unsigned int __n, long double __x)
1467 { return __detail::__sph_bessel<long double>(__n, __x); }
1469 /// 5.2.1.21 Spherical Bessel functions.
1470 template<typename _Tp>
1471 inline typename __gnu_cxx::__promote<_Tp>::__type
1472 sph_bessel(unsigned int __n, _Tp __x)
1474 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1475 return __detail::__sph_bessel<__type>(__n, __x);
1479 sph_legendref(unsigned int __l, unsigned int __m, float __theta)
1480 { return __detail::__sph_legendre<float>(__l, __m, __theta); }
1483 sph_legendrel(unsigned int __l, unsigned int __m, long double __theta)
1484 { return __detail::__sph_legendre<long double>(__l, __m, __theta); }
1486 /// 5.2.1.22 Spherical associated Legendre functions.
1487 template<typename _Tp>
1488 inline typename __gnu_cxx::__promote<_Tp>::__type
1489 sph_legendre(unsigned int __l, unsigned int __m, _Tp __theta)
1491 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1492 return __detail::__sph_legendre<__type>(__l, __m, __theta);
1496 sph_neumannf(unsigned int __n, float __x)
1497 { return __detail::__sph_neumann<float>(__n, __x); }
1500 sph_neumannl(unsigned int __n, long double __x)
1501 { return __detail::__sph_neumann<long double>(__n, __x); }
1503 /// 5.2.1.23 Spherical Neumann functions.
1504 template<typename _Tp>
1505 inline typename __gnu_cxx::__promote<_Tp>::__type
1506 sph_neumann(unsigned int __n, _Tp __x)
1508 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1509 return __detail::__sph_neumann<__type>(__n, __x);
1512 /* @} */ // tr1_math_spec_func
1513 _GLIBCXX_END_NAMESPACE_VERSION
1517 #endif // _GLIBCXX_TR1_CMATH