xref: /dflybsd-src/contrib/gcc-8.0/libstdc++-v3/include/tr1/cmath (revision 95059079af47f9a66a175f374f2da1a5020e3255)
138fd1498Szrj// TR1 cmath -*- C++ -*-
238fd1498Szrj
338fd1498Szrj// Copyright (C) 2006-2018 Free Software Foundation, Inc.
438fd1498Szrj//
538fd1498Szrj// This file is part of the GNU ISO C++ Library.  This library is free
638fd1498Szrj// software; you can redistribute it and/or modify it under the
738fd1498Szrj// terms of the GNU General Public License as published by the
838fd1498Szrj// Free Software Foundation; either version 3, or (at your option)
938fd1498Szrj// any later version.
1038fd1498Szrj
1138fd1498Szrj// This library is distributed in the hope that it will be useful,
1238fd1498Szrj// but WITHOUT ANY WARRANTY; without even the implied warranty of
1338fd1498Szrj// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1438fd1498Szrj// GNU General Public License for more details.
1538fd1498Szrj
1638fd1498Szrj// Under Section 7 of GPL version 3, you are granted additional
1738fd1498Szrj// permissions described in the GCC Runtime Library Exception, version
1838fd1498Szrj// 3.1, as published by the Free Software Foundation.
1938fd1498Szrj
2038fd1498Szrj// You should have received a copy of the GNU General Public License and
2138fd1498Szrj// a copy of the GCC Runtime Library Exception along with this program;
2238fd1498Szrj// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
2338fd1498Szrj// <http://www.gnu.org/licenses/>.
2438fd1498Szrj
2538fd1498Szrj/** @file tr1/cmath
2638fd1498Szrj *  This is a TR1 C++ Library header.
2738fd1498Szrj */
2838fd1498Szrj
2938fd1498Szrj#ifndef _GLIBCXX_TR1_CMATH
3038fd1498Szrj#define _GLIBCXX_TR1_CMATH 1
3138fd1498Szrj
3238fd1498Szrj#pragma GCC system_header
3338fd1498Szrj
3438fd1498Szrj#include <cmath>
3538fd1498Szrj
3638fd1498Szrj#ifdef _GLIBCXX_USE_C99_MATH_TR1
3738fd1498Szrj
3838fd1498Szrj#undef acosh
3938fd1498Szrj#undef acoshf
4038fd1498Szrj#undef acoshl
4138fd1498Szrj#undef asinh
4238fd1498Szrj#undef asinhf
4338fd1498Szrj#undef asinhl
4438fd1498Szrj#undef atanh
4538fd1498Szrj#undef atanhf
4638fd1498Szrj#undef atanhl
4738fd1498Szrj#undef cbrt
4838fd1498Szrj#undef cbrtf
4938fd1498Szrj#undef cbrtl
5038fd1498Szrj#undef copysign
5138fd1498Szrj#undef copysignf
5238fd1498Szrj#undef copysignl
5338fd1498Szrj#undef erf
5438fd1498Szrj#undef erff
5538fd1498Szrj#undef erfl
5638fd1498Szrj#undef erfc
5738fd1498Szrj#undef erfcf
5838fd1498Szrj#undef erfcl
5938fd1498Szrj#undef exp2
6038fd1498Szrj#undef exp2f
6138fd1498Szrj#undef exp2l
6238fd1498Szrj#undef expm1
6338fd1498Szrj#undef expm1f
6438fd1498Szrj#undef expm1l
6538fd1498Szrj#undef fdim
6638fd1498Szrj#undef fdimf
6738fd1498Szrj#undef fdiml
6838fd1498Szrj#undef fma
6938fd1498Szrj#undef fmaf
7038fd1498Szrj#undef fmal
7138fd1498Szrj#undef fmax
7238fd1498Szrj#undef fmaxf
7338fd1498Szrj#undef fmaxl
7438fd1498Szrj#undef fmin
7538fd1498Szrj#undef fminf
7638fd1498Szrj#undef fminl
7738fd1498Szrj#undef hypot
7838fd1498Szrj#undef hypotf
7938fd1498Szrj#undef hypotl
8038fd1498Szrj#undef ilogb
8138fd1498Szrj#undef ilogbf
8238fd1498Szrj#undef ilogbl
8338fd1498Szrj#undef lgamma
8438fd1498Szrj#undef lgammaf
8538fd1498Szrj#undef lgammal
8638fd1498Szrj#undef llrint
8738fd1498Szrj#undef llrintf
8838fd1498Szrj#undef llrintl
8938fd1498Szrj#undef llround
9038fd1498Szrj#undef llroundf
9138fd1498Szrj#undef llroundl
9238fd1498Szrj#undef log1p
9338fd1498Szrj#undef log1pf
9438fd1498Szrj#undef log1pl
9538fd1498Szrj#undef log2
9638fd1498Szrj#undef log2f
9738fd1498Szrj#undef log2l
9838fd1498Szrj#undef logb
9938fd1498Szrj#undef logbf
10038fd1498Szrj#undef logbl
10138fd1498Szrj#undef lrint
10238fd1498Szrj#undef lrintf
10338fd1498Szrj#undef lrintl
10438fd1498Szrj#undef lround
10538fd1498Szrj#undef lroundf
10638fd1498Szrj#undef lroundl
10738fd1498Szrj#undef nan
10838fd1498Szrj#undef nanf
10938fd1498Szrj#undef nanl
11038fd1498Szrj#undef nearbyint
11138fd1498Szrj#undef nearbyintf
11238fd1498Szrj#undef nearbyintl
11338fd1498Szrj#undef nextafter
11438fd1498Szrj#undef nextafterf
11538fd1498Szrj#undef nextafterl
11638fd1498Szrj#undef nexttoward
11738fd1498Szrj#undef nexttowardf
11838fd1498Szrj#undef nexttowardl
11938fd1498Szrj#undef remainder
12038fd1498Szrj#undef remainderf
12138fd1498Szrj#undef remainderl
12238fd1498Szrj#undef remquo
12338fd1498Szrj#undef remquof
12438fd1498Szrj#undef remquol
12538fd1498Szrj#undef rint
12638fd1498Szrj#undef rintf
12738fd1498Szrj#undef rintl
12838fd1498Szrj#undef round
12938fd1498Szrj#undef roundf
13038fd1498Szrj#undef roundl
13138fd1498Szrj#undef scalbln
13238fd1498Szrj#undef scalblnf
13338fd1498Szrj#undef scalblnl
13438fd1498Szrj#undef scalbn
13538fd1498Szrj#undef scalbnf
13638fd1498Szrj#undef scalbnl
13738fd1498Szrj#undef tgamma
13838fd1498Szrj#undef tgammaf
13938fd1498Szrj#undef tgammal
14038fd1498Szrj#undef trunc
14138fd1498Szrj#undef truncf
14238fd1498Szrj#undef truncl
14338fd1498Szrj
14438fd1498Szrj#endif
14538fd1498Szrj
14638fd1498Szrjnamespace std _GLIBCXX_VISIBILITY(default)
14738fd1498Szrj{
14838fd1498Szrj_GLIBCXX_BEGIN_NAMESPACE_VERSION
14938fd1498Szrj
15038fd1498Szrjnamespace tr1
15138fd1498Szrj{
15238fd1498Szrj#if _GLIBCXX_USE_C99_MATH_TR1
15338fd1498Szrj
15438fd1498Szrj  // Using declarations to bring names from libc's <math.h> into std::tr1.
15538fd1498Szrj
15638fd1498Szrj  // types
15738fd1498Szrj  using ::double_t;
15838fd1498Szrj  using ::float_t;
15938fd1498Szrj
16038fd1498Szrj  // functions
16138fd1498Szrj  using ::acosh;
16238fd1498Szrj  using ::acoshf;
16338fd1498Szrj  using ::acoshl;
16438fd1498Szrj
16538fd1498Szrj  using ::asinh;
16638fd1498Szrj  using ::asinhf;
16738fd1498Szrj  using ::asinhl;
16838fd1498Szrj
16938fd1498Szrj  using ::atanh;
17038fd1498Szrj  using ::atanhf;
17138fd1498Szrj  using ::atanhl;
17238fd1498Szrj
17338fd1498Szrj  using ::cbrt;
17438fd1498Szrj  using ::cbrtf;
17538fd1498Szrj  using ::cbrtl;
17638fd1498Szrj
17738fd1498Szrj  using ::copysign;
17838fd1498Szrj  using ::copysignf;
17938fd1498Szrj  using ::copysignl;
18038fd1498Szrj
18138fd1498Szrj  using ::erf;
18238fd1498Szrj  using ::erff;
18338fd1498Szrj  using ::erfl;
18438fd1498Szrj
18538fd1498Szrj  using ::erfc;
18638fd1498Szrj  using ::erfcf;
18738fd1498Szrj  using ::erfcl;
18838fd1498Szrj
18938fd1498Szrj  using ::exp2;
19038fd1498Szrj  using ::exp2f;
19138fd1498Szrj  using ::exp2l;
19238fd1498Szrj
19338fd1498Szrj  using ::expm1;
19438fd1498Szrj  using ::expm1f;
19538fd1498Szrj  using ::expm1l;
19638fd1498Szrj
19738fd1498Szrj  using ::fdim;
19838fd1498Szrj  using ::fdimf;
19938fd1498Szrj  using ::fdiml;
20038fd1498Szrj
20138fd1498Szrj  using ::fma;
20238fd1498Szrj  using ::fmaf;
20338fd1498Szrj  using ::fmal;
20438fd1498Szrj
20538fd1498Szrj  using ::fmax;
20638fd1498Szrj  using ::fmaxf;
20738fd1498Szrj  using ::fmaxl;
20838fd1498Szrj
20938fd1498Szrj  using ::fmin;
21038fd1498Szrj  using ::fminf;
21138fd1498Szrj  using ::fminl;
21238fd1498Szrj
21338fd1498Szrj  using ::hypot;
21438fd1498Szrj  using ::hypotf;
21538fd1498Szrj  using ::hypotl;
21638fd1498Szrj
21738fd1498Szrj  using ::ilogb;
21838fd1498Szrj  using ::ilogbf;
21938fd1498Szrj  using ::ilogbl;
22038fd1498Szrj
22138fd1498Szrj  using ::lgamma;
22238fd1498Szrj  using ::lgammaf;
22338fd1498Szrj  using ::lgammal;
22438fd1498Szrj
22538fd1498Szrj  using ::llrint;
22638fd1498Szrj  using ::llrintf;
22738fd1498Szrj  using ::llrintl;
22838fd1498Szrj
22938fd1498Szrj  using ::llround;
23038fd1498Szrj  using ::llroundf;
23138fd1498Szrj  using ::llroundl;
23238fd1498Szrj
23338fd1498Szrj  using ::log1p;
23438fd1498Szrj  using ::log1pf;
23538fd1498Szrj  using ::log1pl;
23638fd1498Szrj
23738fd1498Szrj  using ::log2;
23838fd1498Szrj  using ::log2f;
23938fd1498Szrj  using ::log2l;
24038fd1498Szrj
24138fd1498Szrj  using ::logb;
24238fd1498Szrj  using ::logbf;
24338fd1498Szrj  using ::logbl;
24438fd1498Szrj
24538fd1498Szrj  using ::lrint;
24638fd1498Szrj  using ::lrintf;
24738fd1498Szrj  using ::lrintl;
24838fd1498Szrj
24938fd1498Szrj  using ::lround;
25038fd1498Szrj  using ::lroundf;
25138fd1498Szrj  using ::lroundl;
25238fd1498Szrj
25338fd1498Szrj  using ::nan;
25438fd1498Szrj  using ::nanf;
25538fd1498Szrj  using ::nanl;
25638fd1498Szrj
25738fd1498Szrj  using ::nearbyint;
25838fd1498Szrj  using ::nearbyintf;
25938fd1498Szrj  using ::nearbyintl;
26038fd1498Szrj
26138fd1498Szrj  using ::nextafter;
26238fd1498Szrj  using ::nextafterf;
26338fd1498Szrj  using ::nextafterl;
26438fd1498Szrj
26538fd1498Szrj  using ::nexttoward;
26638fd1498Szrj  using ::nexttowardf;
26738fd1498Szrj  using ::nexttowardl;
26838fd1498Szrj
26938fd1498Szrj  using ::remainder;
27038fd1498Szrj  using ::remainderf;
27138fd1498Szrj  using ::remainderl;
27238fd1498Szrj
27338fd1498Szrj  using ::remquo;
27438fd1498Szrj  using ::remquof;
27538fd1498Szrj  using ::remquol;
27638fd1498Szrj
27738fd1498Szrj  using ::rint;
27838fd1498Szrj  using ::rintf;
27938fd1498Szrj  using ::rintl;
28038fd1498Szrj
28138fd1498Szrj  using ::round;
28238fd1498Szrj  using ::roundf;
28338fd1498Szrj  using ::roundl;
28438fd1498Szrj
28538fd1498Szrj  using ::scalbln;
28638fd1498Szrj  using ::scalblnf;
28738fd1498Szrj  using ::scalblnl;
28838fd1498Szrj
28938fd1498Szrj  using ::scalbn;
29038fd1498Szrj  using ::scalbnf;
29138fd1498Szrj  using ::scalbnl;
29238fd1498Szrj
29338fd1498Szrj  using ::tgamma;
29438fd1498Szrj  using ::tgammaf;
29538fd1498Szrj  using ::tgammal;
29638fd1498Szrj
29738fd1498Szrj  using ::trunc;
29838fd1498Szrj  using ::truncf;
29938fd1498Szrj  using ::truncl;
30038fd1498Szrj
30138fd1498Szrj#endif
30238fd1498Szrj
30338fd1498Szrj#if _GLIBCXX_USE_C99_MATH
30438fd1498Szrj#if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
30538fd1498Szrj
30638fd1498Szrj  /// Function template definitions [8.16.3].
30738fd1498Szrj  template<typename _Tp>
30838fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
30938fd1498Szrj					   int>::__type
31038fd1498Szrj    fpclassify(_Tp __f)
31138fd1498Szrj    {
31238fd1498Szrj      typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
31338fd1498Szrj      return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
31438fd1498Szrj				  FP_SUBNORMAL, FP_ZERO, __type(__f));
31538fd1498Szrj    }
31638fd1498Szrj
31738fd1498Szrj  template<typename _Tp>
31838fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
31938fd1498Szrj					   int>::__type
32038fd1498Szrj    isfinite(_Tp __f)
32138fd1498Szrj    {
32238fd1498Szrj      typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
32338fd1498Szrj      return __builtin_isfinite(__type(__f));
32438fd1498Szrj    }
32538fd1498Szrj
32638fd1498Szrj  template<typename _Tp>
32738fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
32838fd1498Szrj					   int>::__type
32938fd1498Szrj    isinf(_Tp __f)
33038fd1498Szrj    {
33138fd1498Szrj      typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
33238fd1498Szrj      return __builtin_isinf(__type(__f));
33338fd1498Szrj    }
33438fd1498Szrj
33538fd1498Szrj  template<typename _Tp>
33638fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
33738fd1498Szrj					   int>::__type
33838fd1498Szrj    isnan(_Tp __f)
33938fd1498Szrj    {
34038fd1498Szrj      typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
34138fd1498Szrj      return __builtin_isnan(__type(__f));
34238fd1498Szrj    }
34338fd1498Szrj
34438fd1498Szrj  template<typename _Tp>
34538fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
34638fd1498Szrj					   int>::__type
34738fd1498Szrj    isnormal(_Tp __f)
34838fd1498Szrj    {
34938fd1498Szrj      typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
35038fd1498Szrj      return __builtin_isnormal(__type(__f));
35138fd1498Szrj    }
35238fd1498Szrj
35338fd1498Szrj  template<typename _Tp>
35438fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
35538fd1498Szrj					   int>::__type
35638fd1498Szrj    signbit(_Tp __f)
35738fd1498Szrj    {
35838fd1498Szrj      typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
35938fd1498Szrj      return __builtin_signbit(__type(__f));
36038fd1498Szrj    }
36138fd1498Szrj
36238fd1498Szrj  template<typename _Tp>
36338fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
36438fd1498Szrj					   int>::__type
36538fd1498Szrj    isgreater(_Tp __f1, _Tp __f2)
36638fd1498Szrj    {
36738fd1498Szrj      typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
36838fd1498Szrj      return __builtin_isgreater(__type(__f1), __type(__f2));
36938fd1498Szrj    }
37038fd1498Szrj
37138fd1498Szrj  template<typename _Tp>
37238fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
37338fd1498Szrj					   int>::__type
37438fd1498Szrj    isgreaterequal(_Tp __f1, _Tp __f2)
37538fd1498Szrj    {
37638fd1498Szrj      typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
37738fd1498Szrj      return __builtin_isgreaterequal(__type(__f1), __type(__f2));
37838fd1498Szrj    }
37938fd1498Szrj
38038fd1498Szrj  template<typename _Tp>
38138fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
38238fd1498Szrj					   int>::__type
38338fd1498Szrj    isless(_Tp __f1, _Tp __f2)
38438fd1498Szrj    {
38538fd1498Szrj      typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
38638fd1498Szrj      return __builtin_isless(__type(__f1), __type(__f2));
38738fd1498Szrj    }
38838fd1498Szrj
38938fd1498Szrj  template<typename _Tp>
39038fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
39138fd1498Szrj					   int>::__type
39238fd1498Szrj    islessequal(_Tp __f1, _Tp __f2)
39338fd1498Szrj    {
39438fd1498Szrj      typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
39538fd1498Szrj      return __builtin_islessequal(__type(__f1), __type(__f2));
39638fd1498Szrj    }
39738fd1498Szrj
39838fd1498Szrj  template<typename _Tp>
39938fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
40038fd1498Szrj					   int>::__type
40138fd1498Szrj    islessgreater(_Tp __f1, _Tp __f2)
40238fd1498Szrj    {
40338fd1498Szrj      typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
40438fd1498Szrj      return __builtin_islessgreater(__type(__f1), __type(__f2));
40538fd1498Szrj    }
40638fd1498Szrj
40738fd1498Szrj  template<typename _Tp>
40838fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
40938fd1498Szrj					   int>::__type
41038fd1498Szrj    isunordered(_Tp __f1, _Tp __f2)
41138fd1498Szrj    {
41238fd1498Szrj      typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
41338fd1498Szrj      return __builtin_isunordered(__type(__f1), __type(__f2));
41438fd1498Szrj    }
41538fd1498Szrj
41638fd1498Szrj#endif
41738fd1498Szrj#endif
41838fd1498Szrj
41938fd1498Szrj#if _GLIBCXX_USE_C99_MATH_TR1
42038fd1498Szrj
42138fd1498Szrj  /** Additional overloads [8.16.4].
42238fd1498Szrj   *  @{
42338fd1498Szrj   */
42438fd1498Szrj
42538fd1498Szrj  // For functions defined in C++03 the additional overloads are already
42638fd1498Szrj  // declared in <cmath> so we can just re-declare them in std::tr1.
42738fd1498Szrj
42838fd1498Szrj  using std::acos;
42938fd1498Szrj  using std::asin;
43038fd1498Szrj  using std::atan;
43138fd1498Szrj  using std::atan2;
43238fd1498Szrj  using std::ceil;
43338fd1498Szrj  using std::cos;
43438fd1498Szrj  using std::cosh;
43538fd1498Szrj  using std::exp;
43638fd1498Szrj  using std::floor;
43738fd1498Szrj  using std::fmod;
43838fd1498Szrj  using std::frexp;
43938fd1498Szrj  using std::ldexp;
44038fd1498Szrj  using std::log;
44138fd1498Szrj  using std::log10;
44238fd1498Szrj  using std::sin;
44338fd1498Szrj  using std::sinh;
44438fd1498Szrj  using std::sqrt;
44538fd1498Szrj  using std::tan;
44638fd1498Szrj  using std::tanh;
44738fd1498Szrj
44838fd1498Szrj#if __cplusplus >= 201103L
44938fd1498Szrj
45038fd1498Szrj  // Since C++11, <cmath> defines additional overloads for these functions
45138fd1498Szrj  // in namespace std.
45238fd1498Szrj
45338fd1498Szrj  using std::acosh;
45438fd1498Szrj  using std::asinh;
45538fd1498Szrj  using std::atanh;
45638fd1498Szrj  using std::cbrt;
45738fd1498Szrj  using std::copysign;
45838fd1498Szrj  using std::erf;
45938fd1498Szrj  using std::erfc;
46038fd1498Szrj  using std::exp2;
46138fd1498Szrj  using std::expm1;
46238fd1498Szrj  using std::fdim;
46338fd1498Szrj  using std::fma;
46438fd1498Szrj  using std::fmax;
46538fd1498Szrj  using std::fmin;
46638fd1498Szrj  using std::hypot;
46738fd1498Szrj  using std::ilogb;
46838fd1498Szrj  using std::lgamma;
46938fd1498Szrj  using std::llrint;
47038fd1498Szrj  using std::llround;
47138fd1498Szrj  using std::log1p;
47238fd1498Szrj  using std::log2;
47338fd1498Szrj  using std::logb;
47438fd1498Szrj  using std::lrint;
47538fd1498Szrj  using std::lround;
47638fd1498Szrj  using std::nan;
47738fd1498Szrj  using std::nearbyint;
47838fd1498Szrj  using std::nextafter;
47938fd1498Szrj  using std::nexttoward;
48038fd1498Szrj  using std::remainder;
48138fd1498Szrj  using std::remquo;
48238fd1498Szrj  using std::rint;
48338fd1498Szrj  using std::round;
48438fd1498Szrj  using std::scalbln;
48538fd1498Szrj  using std::scalbn;
48638fd1498Szrj  using std::tgamma;
48738fd1498Szrj  using std::trunc;
48838fd1498Szrj
48938fd1498Szrj#else // __cplusplus < 201103L
49038fd1498Szrj
49138fd1498Szrj  // In C++03 we need to provide the additional overloads.
49238fd1498Szrj
49338fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
49438fd1498Szrj  inline float
49538fd1498Szrj  acosh(float __x)
49638fd1498Szrj  { return __builtin_acoshf(__x); }
49738fd1498Szrj
49838fd1498Szrj  inline long double
49938fd1498Szrj  acosh(long double __x)
50038fd1498Szrj  { return __builtin_acoshl(__x); }
50138fd1498Szrj#endif
50238fd1498Szrj
50338fd1498Szrj  template<typename _Tp>
50438fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
50538fd1498Szrj					   double>::__type
50638fd1498Szrj    acosh(_Tp __x)
50738fd1498Szrj    { return __builtin_acosh(__x); }
50838fd1498Szrj
50938fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
51038fd1498Szrj  inline float
51138fd1498Szrj  asinh(float __x)
51238fd1498Szrj  { return __builtin_asinhf(__x); }
51338fd1498Szrj
51438fd1498Szrj  inline long double
51538fd1498Szrj  asinh(long double __x)
51638fd1498Szrj  { return __builtin_asinhl(__x); }
51738fd1498Szrj#endif
51838fd1498Szrj
51938fd1498Szrj  template<typename _Tp>
52038fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
52138fd1498Szrj					   double>::__type
52238fd1498Szrj    asinh(_Tp __x)
52338fd1498Szrj    { return __builtin_asinh(__x); }
52438fd1498Szrj
52538fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
52638fd1498Szrj  inline float
52738fd1498Szrj  atanh(float __x)
52838fd1498Szrj  { return __builtin_atanhf(__x); }
52938fd1498Szrj
53038fd1498Szrj  inline long double
53138fd1498Szrj  atanh(long double __x)
53238fd1498Szrj  { return __builtin_atanhl(__x); }
53338fd1498Szrj#endif
53438fd1498Szrj
53538fd1498Szrj  template<typename _Tp>
53638fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
53738fd1498Szrj					   double>::__type
53838fd1498Szrj    atanh(_Tp __x)
53938fd1498Szrj    { return __builtin_atanh(__x); }
54038fd1498Szrj
54138fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
54238fd1498Szrj  inline float
54338fd1498Szrj  cbrt(float __x)
54438fd1498Szrj  { return __builtin_cbrtf(__x); }
54538fd1498Szrj
54638fd1498Szrj  inline long double
54738fd1498Szrj  cbrt(long double __x)
54838fd1498Szrj  { return __builtin_cbrtl(__x); }
54938fd1498Szrj#endif
55038fd1498Szrj
55138fd1498Szrj  template<typename _Tp>
55238fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
55338fd1498Szrj					   double>::__type
55438fd1498Szrj    cbrt(_Tp __x)
55538fd1498Szrj    { return __builtin_cbrt(__x); }
55638fd1498Szrj
55738fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
55838fd1498Szrj  inline float
55938fd1498Szrj  copysign(float __x, float __y)
56038fd1498Szrj  { return __builtin_copysignf(__x, __y); }
56138fd1498Szrj
56238fd1498Szrj  inline long double
56338fd1498Szrj  copysign(long double __x, long double __y)
56438fd1498Szrj  { return __builtin_copysignl(__x, __y); }
56538fd1498Szrj#endif
56638fd1498Szrj
56738fd1498Szrj  template<typename _Tp, typename _Up>
56838fd1498Szrj    inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
56938fd1498Szrj    copysign(_Tp __x, _Up __y)
57038fd1498Szrj    {
57138fd1498Szrj      typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
57238fd1498Szrj      return copysign(__type(__x), __type(__y));
57338fd1498Szrj    }
57438fd1498Szrj
57538fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
57638fd1498Szrj  inline float
57738fd1498Szrj  erf(float __x)
57838fd1498Szrj  { return __builtin_erff(__x); }
57938fd1498Szrj
58038fd1498Szrj  inline long double
58138fd1498Szrj  erf(long double __x)
58238fd1498Szrj  { return __builtin_erfl(__x); }
58338fd1498Szrj#endif
58438fd1498Szrj
58538fd1498Szrj  template<typename _Tp>
58638fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
58738fd1498Szrj					   double>::__type
58838fd1498Szrj    erf(_Tp __x)
58938fd1498Szrj    { return __builtin_erf(__x); }
59038fd1498Szrj
59138fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
59238fd1498Szrj  inline float
59338fd1498Szrj  erfc(float __x)
59438fd1498Szrj  { return __builtin_erfcf(__x); }
59538fd1498Szrj
59638fd1498Szrj  inline long double
59738fd1498Szrj  erfc(long double __x)
59838fd1498Szrj  { return __builtin_erfcl(__x); }
59938fd1498Szrj#endif
60038fd1498Szrj
60138fd1498Szrj  template<typename _Tp>
60238fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
60338fd1498Szrj					   double>::__type
60438fd1498Szrj    erfc(_Tp __x)
60538fd1498Szrj    { return __builtin_erfc(__x); }
60638fd1498Szrj
60738fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
60838fd1498Szrj  inline float
60938fd1498Szrj  exp2(float __x)
61038fd1498Szrj  { return __builtin_exp2f(__x); }
61138fd1498Szrj
61238fd1498Szrj  inline long double
61338fd1498Szrj  exp2(long double __x)
61438fd1498Szrj  { return __builtin_exp2l(__x); }
61538fd1498Szrj#endif
61638fd1498Szrj
61738fd1498Szrj  template<typename _Tp>
61838fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
61938fd1498Szrj					   double>::__type
62038fd1498Szrj    exp2(_Tp __x)
62138fd1498Szrj    { return __builtin_exp2(__x); }
62238fd1498Szrj
62338fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
62438fd1498Szrj  inline float
62538fd1498Szrj  expm1(float __x)
62638fd1498Szrj  { return __builtin_expm1f(__x); }
62738fd1498Szrj
62838fd1498Szrj  inline long double
62938fd1498Szrj  expm1(long double __x)
63038fd1498Szrj  { return __builtin_expm1l(__x); }
63138fd1498Szrj#endif
63238fd1498Szrj
63338fd1498Szrj  template<typename _Tp>
63438fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
63538fd1498Szrj					   double>::__type
63638fd1498Szrj    expm1(_Tp __x)
63738fd1498Szrj    { return __builtin_expm1(__x); }
63838fd1498Szrj
63938fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
64038fd1498Szrj  inline float
64138fd1498Szrj  fdim(float __x, float __y)
64238fd1498Szrj  { return __builtin_fdimf(__x, __y); }
64338fd1498Szrj
64438fd1498Szrj  inline long double
64538fd1498Szrj  fdim(long double __x, long double __y)
64638fd1498Szrj  { return __builtin_fdiml(__x, __y); }
64738fd1498Szrj#endif
64838fd1498Szrj
64938fd1498Szrj  template<typename _Tp, typename _Up>
65038fd1498Szrj    inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
65138fd1498Szrj    fdim(_Tp __x, _Up __y)
65238fd1498Szrj    {
65338fd1498Szrj      typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
65438fd1498Szrj      return fdim(__type(__x), __type(__y));
65538fd1498Szrj    }
65638fd1498Szrj
65738fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
65838fd1498Szrj  inline float
65938fd1498Szrj  fma(float __x, float __y, float __z)
66038fd1498Szrj  { return __builtin_fmaf(__x, __y, __z); }
66138fd1498Szrj
66238fd1498Szrj  inline long double
66338fd1498Szrj  fma(long double __x, long double __y, long double __z)
66438fd1498Szrj  { return __builtin_fmal(__x, __y, __z); }
66538fd1498Szrj#endif
66638fd1498Szrj
66738fd1498Szrj  template<typename _Tp, typename _Up, typename _Vp>
66838fd1498Szrj    inline typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type
66938fd1498Szrj    fma(_Tp __x, _Up __y, _Vp __z)
67038fd1498Szrj    {
67138fd1498Szrj      typedef typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type __type;
67238fd1498Szrj      return fma(__type(__x), __type(__y), __type(__z));
67338fd1498Szrj    }
67438fd1498Szrj
67538fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
67638fd1498Szrj  inline float
67738fd1498Szrj  fmax(float __x, float __y)
67838fd1498Szrj  { return __builtin_fmaxf(__x, __y); }
67938fd1498Szrj
68038fd1498Szrj  inline long double
68138fd1498Szrj  fmax(long double __x, long double __y)
68238fd1498Szrj  { return __builtin_fmaxl(__x, __y); }
68338fd1498Szrj#endif
68438fd1498Szrj
68538fd1498Szrj  template<typename _Tp, typename _Up>
68638fd1498Szrj    inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
68738fd1498Szrj    fmax(_Tp __x, _Up __y)
68838fd1498Szrj    {
68938fd1498Szrj      typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
69038fd1498Szrj      return fmax(__type(__x), __type(__y));
69138fd1498Szrj    }
69238fd1498Szrj
69338fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
69438fd1498Szrj  inline float
69538fd1498Szrj  fmin(float __x, float __y)
69638fd1498Szrj  { return __builtin_fminf(__x, __y); }
69738fd1498Szrj
69838fd1498Szrj  inline long double
69938fd1498Szrj  fmin(long double __x, long double __y)
70038fd1498Szrj  { return __builtin_fminl(__x, __y); }
70138fd1498Szrj#endif
70238fd1498Szrj
70338fd1498Szrj  template<typename _Tp, typename _Up>
70438fd1498Szrj    inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
70538fd1498Szrj    fmin(_Tp __x, _Up __y)
70638fd1498Szrj    {
70738fd1498Szrj      typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
70838fd1498Szrj      return fmin(__type(__x), __type(__y));
70938fd1498Szrj    }
71038fd1498Szrj
71138fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
71238fd1498Szrj  inline float
71338fd1498Szrj  hypot(float __x, float __y)
71438fd1498Szrj  { return __builtin_hypotf(__x, __y); }
71538fd1498Szrj
71638fd1498Szrj  inline long double
71738fd1498Szrj  hypot(long double __x, long double __y)
71838fd1498Szrj  { return __builtin_hypotl(__x, __y); }
71938fd1498Szrj#endif
72038fd1498Szrj
72138fd1498Szrj  template<typename _Tp, typename _Up>
72238fd1498Szrj    inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
72338fd1498Szrj    hypot(_Tp __y, _Up __x)
72438fd1498Szrj    {
72538fd1498Szrj      typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
72638fd1498Szrj      return hypot(__type(__y), __type(__x));
72738fd1498Szrj    }
72838fd1498Szrj
72938fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
73038fd1498Szrj  inline int
73138fd1498Szrj  ilogb(float __x)
73238fd1498Szrj  { return __builtin_ilogbf(__x); }
73338fd1498Szrj
73438fd1498Szrj  inline int
73538fd1498Szrj  ilogb(long double __x)
73638fd1498Szrj  { return __builtin_ilogbl(__x); }
73738fd1498Szrj#endif
73838fd1498Szrj
73938fd1498Szrj  template<typename _Tp>
74038fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
74138fd1498Szrj					   int>::__type
74238fd1498Szrj    ilogb(_Tp __x)
74338fd1498Szrj    { return __builtin_ilogb(__x); }
74438fd1498Szrj
74538fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
74638fd1498Szrj  inline float
74738fd1498Szrj  lgamma(float __x)
74838fd1498Szrj  { return __builtin_lgammaf(__x); }
74938fd1498Szrj
75038fd1498Szrj  inline long double
75138fd1498Szrj  lgamma(long double __x)
75238fd1498Szrj  { return __builtin_lgammal(__x); }
75338fd1498Szrj#endif
75438fd1498Szrj
75538fd1498Szrj  template<typename _Tp>
75638fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
75738fd1498Szrj					   double>::__type
75838fd1498Szrj    lgamma(_Tp __x)
75938fd1498Szrj    { return __builtin_lgamma(__x); }
76038fd1498Szrj
76138fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
76238fd1498Szrj  inline long long
76338fd1498Szrj  llrint(float __x)
76438fd1498Szrj  { return __builtin_llrintf(__x); }
76538fd1498Szrj
76638fd1498Szrj  inline long long
76738fd1498Szrj  llrint(long double __x)
76838fd1498Szrj  { return __builtin_llrintl(__x); }
76938fd1498Szrj#endif
77038fd1498Szrj
77138fd1498Szrj  template<typename _Tp>
77238fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
77338fd1498Szrj					   long long>::__type
77438fd1498Szrj    llrint(_Tp __x)
77538fd1498Szrj    { return __builtin_llrint(__x); }
77638fd1498Szrj
77738fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
77838fd1498Szrj  inline long long
77938fd1498Szrj  llround(float __x)
78038fd1498Szrj  { return __builtin_llroundf(__x); }
78138fd1498Szrj
78238fd1498Szrj  inline long long
78338fd1498Szrj  llround(long double __x)
78438fd1498Szrj  { return __builtin_llroundl(__x); }
78538fd1498Szrj#endif
78638fd1498Szrj
78738fd1498Szrj  template<typename _Tp>
78838fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
78938fd1498Szrj					   long long>::__type
79038fd1498Szrj    llround(_Tp __x)
79138fd1498Szrj    { return __builtin_llround(__x); }
79238fd1498Szrj
79338fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
79438fd1498Szrj  inline float
79538fd1498Szrj  log1p(float __x)
79638fd1498Szrj  { return __builtin_log1pf(__x); }
79738fd1498Szrj
79838fd1498Szrj  inline long double
79938fd1498Szrj  log1p(long double __x)
80038fd1498Szrj  { return __builtin_log1pl(__x); }
80138fd1498Szrj#endif
80238fd1498Szrj
80338fd1498Szrj  template<typename _Tp>
80438fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
80538fd1498Szrj					   double>::__type
80638fd1498Szrj    log1p(_Tp __x)
80738fd1498Szrj    { return __builtin_log1p(__x); }
80838fd1498Szrj
80938fd1498Szrj  // DR 568.
81038fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
81138fd1498Szrj  inline float
81238fd1498Szrj  log2(float __x)
81338fd1498Szrj  { return __builtin_log2f(__x); }
81438fd1498Szrj
81538fd1498Szrj  inline long double
81638fd1498Szrj  log2(long double __x)
81738fd1498Szrj  { return __builtin_log2l(__x); }
81838fd1498Szrj#endif
81938fd1498Szrj
82038fd1498Szrj  template<typename _Tp>
82138fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
82238fd1498Szrj					   double>::__type
82338fd1498Szrj    log2(_Tp __x)
82438fd1498Szrj    { return __builtin_log2(__x); }
82538fd1498Szrj
82638fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
82738fd1498Szrj  inline float
82838fd1498Szrj  logb(float __x)
82938fd1498Szrj  { return __builtin_logbf(__x); }
83038fd1498Szrj
83138fd1498Szrj  inline long double
83238fd1498Szrj  logb(long double __x)
83338fd1498Szrj  { return __builtin_logbl(__x); }
83438fd1498Szrj#endif
83538fd1498Szrj
83638fd1498Szrj  template<typename _Tp>
83738fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
83838fd1498Szrj					   double>::__type
83938fd1498Szrj    logb(_Tp __x)
84038fd1498Szrj    {
84138fd1498Szrj      return __builtin_logb(__x);
84238fd1498Szrj    }
84338fd1498Szrj
84438fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
84538fd1498Szrj  inline long
84638fd1498Szrj  lrint(float __x)
84738fd1498Szrj  { return __builtin_lrintf(__x); }
84838fd1498Szrj
84938fd1498Szrj  inline long
85038fd1498Szrj  lrint(long double __x)
85138fd1498Szrj  { return __builtin_lrintl(__x); }
85238fd1498Szrj#endif
85338fd1498Szrj
85438fd1498Szrj  template<typename _Tp>
85538fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
85638fd1498Szrj					   long>::__type
85738fd1498Szrj    lrint(_Tp __x)
85838fd1498Szrj    { return __builtin_lrint(__x); }
85938fd1498Szrj
86038fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
86138fd1498Szrj  inline long
86238fd1498Szrj  lround(float __x)
86338fd1498Szrj  { return __builtin_lroundf(__x); }
86438fd1498Szrj
86538fd1498Szrj  inline long
86638fd1498Szrj  lround(long double __x)
86738fd1498Szrj  { return __builtin_lroundl(__x); }
86838fd1498Szrj#endif
86938fd1498Szrj
87038fd1498Szrj  template<typename _Tp>
87138fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
87238fd1498Szrj					   long>::__type
87338fd1498Szrj    lround(_Tp __x)
87438fd1498Szrj    { return __builtin_lround(__x); }
87538fd1498Szrj
87638fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
87738fd1498Szrj  inline float
87838fd1498Szrj  nearbyint(float __x)
87938fd1498Szrj  { return __builtin_nearbyintf(__x); }
88038fd1498Szrj
88138fd1498Szrj  inline long double
88238fd1498Szrj  nearbyint(long double __x)
88338fd1498Szrj  { return __builtin_nearbyintl(__x); }
88438fd1498Szrj#endif
88538fd1498Szrj
88638fd1498Szrj  template<typename _Tp>
88738fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
88838fd1498Szrj					   double>::__type
88938fd1498Szrj    nearbyint(_Tp __x)
89038fd1498Szrj    { return __builtin_nearbyint(__x); }
89138fd1498Szrj
89238fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
89338fd1498Szrj  inline float
89438fd1498Szrj  nextafter(float __x, float __y)
89538fd1498Szrj  { return __builtin_nextafterf(__x, __y); }
89638fd1498Szrj
89738fd1498Szrj  inline long double
89838fd1498Szrj  nextafter(long double __x, long double __y)
89938fd1498Szrj  { return __builtin_nextafterl(__x, __y); }
90038fd1498Szrj#endif
90138fd1498Szrj
90238fd1498Szrj  template<typename _Tp, typename _Up>
90338fd1498Szrj    inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
90438fd1498Szrj    nextafter(_Tp __x, _Up __y)
90538fd1498Szrj    {
90638fd1498Szrj      typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
90738fd1498Szrj      return nextafter(__type(__x), __type(__y));
90838fd1498Szrj    }
90938fd1498Szrj
91038fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
91138fd1498Szrj  inline float
91238fd1498Szrj  nexttoward(float __x, long double __y)
91338fd1498Szrj  { return __builtin_nexttowardf(__x, __y); }
91438fd1498Szrj
91538fd1498Szrj  inline long double
91638fd1498Szrj  nexttoward(long double __x, long double __y)
91738fd1498Szrj  { return __builtin_nexttowardl(__x, __y); }
91838fd1498Szrj#endif
91938fd1498Szrj
92038fd1498Szrj  template<typename _Tp>
92138fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
92238fd1498Szrj					   double>::__type
92338fd1498Szrj    nexttoward(_Tp __x, long double __y)
92438fd1498Szrj    { return __builtin_nexttoward(__x, __y); }
92538fd1498Szrj
92638fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
92738fd1498Szrj  inline float
92838fd1498Szrj  remainder(float __x, float __y)
92938fd1498Szrj  { return __builtin_remainderf(__x, __y); }
93038fd1498Szrj
93138fd1498Szrj  inline long double
93238fd1498Szrj  remainder(long double __x, long double __y)
93338fd1498Szrj  { return __builtin_remainderl(__x, __y); }
93438fd1498Szrj#endif
93538fd1498Szrj
93638fd1498Szrj  template<typename _Tp, typename _Up>
93738fd1498Szrj    inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
93838fd1498Szrj    remainder(_Tp __x, _Up __y)
93938fd1498Szrj    {
94038fd1498Szrj      typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
94138fd1498Szrj      return remainder(__type(__x), __type(__y));
94238fd1498Szrj    }
94338fd1498Szrj
94438fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
94538fd1498Szrj  inline float
94638fd1498Szrj  remquo(float __x, float __y, int* __pquo)
94738fd1498Szrj  { return __builtin_remquof(__x, __y, __pquo); }
94838fd1498Szrj
94938fd1498Szrj  inline long double
95038fd1498Szrj  remquo(long double __x, long double __y, int* __pquo)
95138fd1498Szrj  { return __builtin_remquol(__x, __y, __pquo); }
95238fd1498Szrj#endif
95338fd1498Szrj
95438fd1498Szrj  template<typename _Tp, typename _Up>
95538fd1498Szrj    inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
95638fd1498Szrj    remquo(_Tp __x, _Up __y, int* __pquo)
95738fd1498Szrj    {
95838fd1498Szrj      typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
95938fd1498Szrj      return remquo(__type(__x), __type(__y), __pquo);
96038fd1498Szrj    }
96138fd1498Szrj
96238fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
96338fd1498Szrj  inline float
96438fd1498Szrj  rint(float __x)
96538fd1498Szrj  { return __builtin_rintf(__x); }
96638fd1498Szrj
96738fd1498Szrj  inline long double
96838fd1498Szrj  rint(long double __x)
96938fd1498Szrj  { return __builtin_rintl(__x); }
97038fd1498Szrj#endif
97138fd1498Szrj
97238fd1498Szrj  template<typename _Tp>
97338fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
97438fd1498Szrj					   double>::__type
97538fd1498Szrj    rint(_Tp __x)
97638fd1498Szrj    { return __builtin_rint(__x); }
97738fd1498Szrj
97838fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
97938fd1498Szrj  inline float
98038fd1498Szrj  round(float __x)
98138fd1498Szrj  { return __builtin_roundf(__x); }
98238fd1498Szrj
98338fd1498Szrj  inline long double
98438fd1498Szrj  round(long double __x)
98538fd1498Szrj  { return __builtin_roundl(__x); }
98638fd1498Szrj#endif
98738fd1498Szrj
98838fd1498Szrj  template<typename _Tp>
98938fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
99038fd1498Szrj					   double>::__type
99138fd1498Szrj    round(_Tp __x)
99238fd1498Szrj    { return __builtin_round(__x); }
99338fd1498Szrj
99438fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
99538fd1498Szrj  inline float
99638fd1498Szrj  scalbln(float __x, long __ex)
99738fd1498Szrj  { return __builtin_scalblnf(__x, __ex); }
99838fd1498Szrj
99938fd1498Szrj  inline long double
100038fd1498Szrj  scalbln(long double __x, long __ex)
100138fd1498Szrj  { return __builtin_scalblnl(__x, __ex); }
100238fd1498Szrj#endif
100338fd1498Szrj
100438fd1498Szrj  template<typename _Tp>
100538fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
100638fd1498Szrj					   double>::__type
100738fd1498Szrj    scalbln(_Tp __x, long __ex)
100838fd1498Szrj    { return __builtin_scalbln(__x, __ex); }
100938fd1498Szrj
101038fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
101138fd1498Szrj  inline float
101238fd1498Szrj  scalbn(float __x, int __ex)
101338fd1498Szrj  { return __builtin_scalbnf(__x, __ex); }
101438fd1498Szrj
101538fd1498Szrj  inline long double
101638fd1498Szrj  scalbn(long double __x, int __ex)
101738fd1498Szrj  { return __builtin_scalbnl(__x, __ex); }
101838fd1498Szrj#endif
101938fd1498Szrj
102038fd1498Szrj  template<typename _Tp>
102138fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
102238fd1498Szrj					   double>::__type
102338fd1498Szrj    scalbn(_Tp __x, int __ex)
102438fd1498Szrj    { return __builtin_scalbn(__x, __ex); }
102538fd1498Szrj
102638fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
102738fd1498Szrj  inline float
102838fd1498Szrj  tgamma(float __x)
102938fd1498Szrj  { return __builtin_tgammaf(__x); }
103038fd1498Szrj
103138fd1498Szrj  inline long double
103238fd1498Szrj  tgamma(long double __x)
103338fd1498Szrj  { return __builtin_tgammal(__x); }
103438fd1498Szrj#endif
103538fd1498Szrj
103638fd1498Szrj  template<typename _Tp>
103738fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
103838fd1498Szrj					   double>::__type
103938fd1498Szrj    tgamma(_Tp __x)
104038fd1498Szrj    { return __builtin_tgamma(__x); }
104138fd1498Szrj
104238fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
104338fd1498Szrj  inline float
104438fd1498Szrj  trunc(float __x)
104538fd1498Szrj  { return __builtin_truncf(__x); }
104638fd1498Szrj
104738fd1498Szrj  inline long double
104838fd1498Szrj  trunc(long double __x)
104938fd1498Szrj  { return __builtin_truncl(__x); }
105038fd1498Szrj#endif
105138fd1498Szrj
105238fd1498Szrj  template<typename _Tp>
105338fd1498Szrj    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
105438fd1498Szrj					   double>::__type
105538fd1498Szrj    trunc(_Tp __x)
105638fd1498Szrj    { return __builtin_trunc(__x); }
105738fd1498Szrj
105838fd1498Szrj#endif // __cplusplus < 201103L
105938fd1498Szrj
106038fd1498Szrj  // @}
106138fd1498Szrj
106238fd1498Szrj#endif /* _GLIBCXX_USE_C99_MATH_TR1 */
106338fd1498Szrj
106438fd1498Szrj  // DR 550. What should the return type of pow(float,int) be?
106538fd1498Szrj  // NB: C++11 and TR1 != C++03.
106638fd1498Szrj
106738fd1498Szrj  // We cannot do "using std::pow;" because that would bring in unwanted
106838fd1498Szrj  // pow(*, int) overloads in C++03, with the wrong return type. Instead we
106938fd1498Szrj  // define all the necessary overloads, but the std::tr1::pow(double, double)
107038fd1498Szrj  // overload cannot be provided here, because <tr1/math.h> would add it to
107138fd1498Szrj  // the global namespace where it would clash with ::pow(double,double) from
107238fd1498Szrj  // libc (revealed by the fix of PR c++/54537).
107338fd1498Szrj  // The solution is to forward std::tr1::pow(double,double) to
107438fd1498Szrj  // std::pow(double,double) via the function template below. See
107538fd1498Szrj  // the discussion about this issue here:
107638fd1498Szrj  // http://gcc.gnu.org/ml/gcc-patches/2012-09/msg01278.html
107738fd1498Szrj
107838fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
107938fd1498Szrj  inline float
108038fd1498Szrj  pow(float __x, float __y)
108138fd1498Szrj  { return std::pow(__x, __y); }
108238fd1498Szrj
108338fd1498Szrj  inline long double
108438fd1498Szrj  pow(long double __x, long double __y)
108538fd1498Szrj  { return std::pow(__x, __y); }
108638fd1498Szrj#endif
108738fd1498Szrj
108838fd1498Szrj  template<typename _Tp, typename _Up>
108938fd1498Szrj    inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
109038fd1498Szrj    pow(_Tp __x, _Up __y)
109138fd1498Szrj    {
109238fd1498Szrj      typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
109338fd1498Szrj      return std::pow(__type(__x), __type(__y));
109438fd1498Szrj    }
109538fd1498Szrj
109638fd1498Szrj#if __cplusplus >= 201103L
109738fd1498Szrj  // We also deal with fabs in a special way, because "using std::fabs;"
109838fd1498Szrj  // could bring in C++11's std::fabs<T>(const std::complex<T>&) with a
109938fd1498Szrj  // different return type from std::tr1::fabs<T>(const std::complex<T>&).
110038fd1498Szrj  // We define the necessary overloads, except std::tr1::fabs(double) which
110138fd1498Szrj  // could clash with ::fabs(double) from libc.
110238fd1498Szrj  // The function template handles double as well as integers, forwarding
110338fd1498Szrj  // to std::fabs.
110438fd1498Szrj
110538fd1498Szrj#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
110638fd1498Szrj#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
110738fd1498Szrj  inline float
110838fd1498Szrj  fabs(float __x)
110938fd1498Szrj  { return __builtin_fabsf(__x); }
111038fd1498Szrj
111138fd1498Szrj  inline long double
111238fd1498Szrj  fabs(long double __x)
111338fd1498Szrj  { return __builtin_fabsl(__x); }
111438fd1498Szrj#endif
111538fd1498Szrj#endif
111638fd1498Szrj
111738fd1498Szrj  template<typename _Tp>
111838fd1498Szrj    inline typename __gnu_cxx::__promote<_Tp>::__type
111938fd1498Szrj    fabs(_Tp __x)
112038fd1498Szrj    { return std::fabs(__x); }
112138fd1498Szrj
112238fd1498Szrj#else  // ! C++11
112338fd1498Szrj
112438fd1498Szrj  // For C++03 just use std::fabs as there is no overload for std::complex<>.
112538fd1498Szrj  using std::fabs;
112638fd1498Szrj
112738fd1498Szrj#endif // C++11
112838fd1498Szrj
112938fd1498Szrj#if _GLIBCXX_USE_STD_SPEC_FUNCS
113038fd1498Szrj
113138fd1498Szrj  /**
113238fd1498Szrj   * @defgroup tr1_math_spec_func Mathematical Special Functions
113338fd1498Szrj   * @ingroup numerics
113438fd1498Szrj   *
113538fd1498Szrj   * A collection of advanced mathematical special functions.
113638fd1498Szrj   * @{
113738fd1498Szrj   */
113838fd1498Szrj
113938fd1498Szrj  using std::assoc_laguerref;
114038fd1498Szrj  using std::assoc_laguerrel;
114138fd1498Szrj  using std::assoc_laguerre;
114238fd1498Szrj
114338fd1498Szrj  using std::assoc_legendref;
114438fd1498Szrj  using std::assoc_legendrel;
114538fd1498Szrj  using std::assoc_legendre;
114638fd1498Szrj
114738fd1498Szrj  using std::betaf;
114838fd1498Szrj  using std::betal;
114938fd1498Szrj  using std::beta;
115038fd1498Szrj
115138fd1498Szrj  using std::comp_ellint_1f;
115238fd1498Szrj  using std::comp_ellint_1l;
115338fd1498Szrj  using std::comp_ellint_1;
115438fd1498Szrj
115538fd1498Szrj  using std::comp_ellint_2f;
115638fd1498Szrj  using std::comp_ellint_2l;
115738fd1498Szrj  using std::comp_ellint_2;
115838fd1498Szrj
115938fd1498Szrj  using std::comp_ellint_3f;
116038fd1498Szrj  using std::comp_ellint_3l;
116138fd1498Szrj  using std::comp_ellint_3;
116238fd1498Szrj
116338fd1498Szrj  using std::cyl_bessel_if;
116438fd1498Szrj  using std::cyl_bessel_il;
116538fd1498Szrj  using std::cyl_bessel_i;
116638fd1498Szrj
116738fd1498Szrj  using std::cyl_bessel_jf;
116838fd1498Szrj  using std::cyl_bessel_jl;
116938fd1498Szrj  using std::cyl_bessel_j;
117038fd1498Szrj
117138fd1498Szrj  using std::cyl_bessel_kf;
117238fd1498Szrj  using std::cyl_bessel_kl;
117338fd1498Szrj  using std::cyl_bessel_k;
117438fd1498Szrj
117538fd1498Szrj  using std::cyl_neumannf;
117638fd1498Szrj  using std::cyl_neumannl;
117738fd1498Szrj  using std::cyl_neumann;
117838fd1498Szrj
117938fd1498Szrj  using std::ellint_1f;
118038fd1498Szrj  using std::ellint_1l;
118138fd1498Szrj  using std::ellint_1;
118238fd1498Szrj
118338fd1498Szrj  using std::ellint_2f;
118438fd1498Szrj  using std::ellint_2l;
118538fd1498Szrj  using std::ellint_2;
118638fd1498Szrj
118738fd1498Szrj  using std::ellint_3f;
118838fd1498Szrj  using std::ellint_3l;
118938fd1498Szrj  using std::ellint_3;
119038fd1498Szrj
119138fd1498Szrj  using std::expintf;
119238fd1498Szrj  using std::expintl;
119338fd1498Szrj  using std::expint;
119438fd1498Szrj
119538fd1498Szrj  using std::hermitef;
119638fd1498Szrj  using std::hermitel;
119738fd1498Szrj  using std::hermite;
119838fd1498Szrj
119938fd1498Szrj  using std::laguerref;
120038fd1498Szrj  using std::laguerrel;
120138fd1498Szrj  using std::laguerre;
120238fd1498Szrj
120338fd1498Szrj  using std::legendref;
120438fd1498Szrj  using std::legendrel;
120538fd1498Szrj  using std::legendre;
120638fd1498Szrj
120738fd1498Szrj  using std::riemann_zetaf;
120838fd1498Szrj  using std::riemann_zetal;
120938fd1498Szrj  using std::riemann_zeta;
121038fd1498Szrj
121138fd1498Szrj  using std::sph_besself;
121238fd1498Szrj  using std::sph_bessell;
121338fd1498Szrj  using std::sph_bessel;
121438fd1498Szrj
121538fd1498Szrj  using std::sph_legendref;
121638fd1498Szrj  using std::sph_legendrel;
121738fd1498Szrj  using std::sph_legendre;
121838fd1498Szrj
121938fd1498Szrj  using std::sph_neumannf;
122038fd1498Szrj  using std::sph_neumannl;
122138fd1498Szrj  using std::sph_neumann;
122238fd1498Szrj
122338fd1498Szrj  /* @} */ // tr1_math_spec_func
122438fd1498Szrj
122538fd1498Szrj#else // ! _GLIBCXX_USE_STD_SPEC_FUNCS
122638fd1498Szrj
122738fd1498Szrj} // namespace tr1
122838fd1498Szrj
122938fd1498Szrj_GLIBCXX_END_NAMESPACE_VERSION
123038fd1498Szrj} // namespace std
123138fd1498Szrj
123238fd1498Szrj#include <bits/stl_algobase.h>
123338fd1498Szrj#include <limits>
123438fd1498Szrj#include <tr1/type_traits>
123538fd1498Szrj
123638fd1498Szrj#include <tr1/gamma.tcc>
123738fd1498Szrj#include <tr1/bessel_function.tcc>
123838fd1498Szrj#include <tr1/beta_function.tcc>
123938fd1498Szrj#include <tr1/ell_integral.tcc>
124038fd1498Szrj#include <tr1/exp_integral.tcc>
124138fd1498Szrj#include <tr1/legendre_function.tcc>
124238fd1498Szrj#include <tr1/modified_bessel_func.tcc>
124338fd1498Szrj#include <tr1/poly_hermite.tcc>
124438fd1498Szrj#include <tr1/poly_laguerre.tcc>
124538fd1498Szrj#include <tr1/riemann_zeta.tcc>
124638fd1498Szrj
124738fd1498Szrjnamespace std _GLIBCXX_VISIBILITY(default)
124838fd1498Szrj{
124938fd1498Szrj_GLIBCXX_BEGIN_NAMESPACE_VERSION
125038fd1498Szrj
125138fd1498Szrjnamespace tr1
125238fd1498Szrj{
125338fd1498Szrj  /**
125438fd1498Szrj   * @defgroup tr1_math_spec_func Mathematical Special Functions
125538fd1498Szrj   * @ingroup numerics
125638fd1498Szrj   *
125738fd1498Szrj   * A collection of advanced mathematical special functions.
125838fd1498Szrj   * @{
125938fd1498Szrj   */
126038fd1498Szrj
126138fd1498Szrj  inline float
126238fd1498Szrj  assoc_laguerref(unsigned int __n, unsigned int __m, float __x)
126338fd1498Szrj  { return __detail::__assoc_laguerre<float>(__n, __m, __x); }
126438fd1498Szrj
126538fd1498Szrj  inline long double
126638fd1498Szrj  assoc_laguerrel(unsigned int __n, unsigned int __m, long double __x)
126738fd1498Szrj  {
126838fd1498Szrj    return __detail::__assoc_laguerre<long double>(__n, __m, __x);
126938fd1498Szrj  }
127038fd1498Szrj
127138fd1498Szrj  ///  5.2.1.1  Associated Laguerre polynomials.
127238fd1498Szrj  template<typename _Tp>
127338fd1498Szrj    inline typename __gnu_cxx::__promote<_Tp>::__type
127438fd1498Szrj    assoc_laguerre(unsigned int __n, unsigned int __m, _Tp __x)
127538fd1498Szrj    {
127638fd1498Szrj      typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
127738fd1498Szrj      return __detail::__assoc_laguerre<__type>(__n, __m, __x);
127838fd1498Szrj    }
127938fd1498Szrj
128038fd1498Szrj  inline float
128138fd1498Szrj  assoc_legendref(unsigned int __l, unsigned int __m, float __x)
128238fd1498Szrj  { return __detail::__assoc_legendre_p<float>(__l, __m, __x); }
128338fd1498Szrj
128438fd1498Szrj  inline long double
128538fd1498Szrj  assoc_legendrel(unsigned int __l, unsigned int __m, long double __x)
128638fd1498Szrj  { return __detail::__assoc_legendre_p<long double>(__l, __m, __x); }
128738fd1498Szrj
128838fd1498Szrj  ///  5.2.1.2  Associated Legendre functions.
128938fd1498Szrj  template<typename _Tp>
129038fd1498Szrj    inline typename __gnu_cxx::__promote<_Tp>::__type
129138fd1498Szrj    assoc_legendre(unsigned int __l, unsigned int __m, _Tp __x)
129238fd1498Szrj    {
129338fd1498Szrj      typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
129438fd1498Szrj      return __detail::__assoc_legendre_p<__type>(__l, __m, __x);
129538fd1498Szrj    }
129638fd1498Szrj
129738fd1498Szrj  inline float
129838fd1498Szrj  betaf(float __x, float __y)
129938fd1498Szrj  { return __detail::__beta<float>(__x, __y); }
130038fd1498Szrj
130138fd1498Szrj  inline long double
130238fd1498Szrj  betal(long double __x, long double __y)
130338fd1498Szrj  { return __detail::__beta<long double>(__x, __y); }
130438fd1498Szrj
130538fd1498Szrj  ///  5.2.1.3  Beta functions.
130638fd1498Szrj  template<typename _Tpx, typename _Tpy>
130738fd1498Szrj    inline typename __gnu_cxx::__promote_2<_Tpx, _Tpy>::__type
130838fd1498Szrj    beta(_Tpx __x, _Tpy __y)
130938fd1498Szrj    {
131038fd1498Szrj      typedef typename __gnu_cxx::__promote_2<_Tpx, _Tpy>::__type __type;
131138fd1498Szrj      return __detail::__beta<__type>(__x, __y);
131238fd1498Szrj    }
131338fd1498Szrj
131438fd1498Szrj  inline float
131538fd1498Szrj  comp_ellint_1f(float __k)
131638fd1498Szrj  { return __detail::__comp_ellint_1<float>(__k); }
131738fd1498Szrj
131838fd1498Szrj  inline long double
131938fd1498Szrj  comp_ellint_1l(long double __k)
132038fd1498Szrj  { return __detail::__comp_ellint_1<long double>(__k); }
132138fd1498Szrj
132238fd1498Szrj  ///  5.2.1.4  Complete elliptic integrals of the first kind.
132338fd1498Szrj  template<typename _Tp>
132438fd1498Szrj    inline typename __gnu_cxx::__promote<_Tp>::__type
132538fd1498Szrj    comp_ellint_1(_Tp __k)
132638fd1498Szrj    {
132738fd1498Szrj      typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
132838fd1498Szrj      return __detail::__comp_ellint_1<__type>(__k);
132938fd1498Szrj    }
133038fd1498Szrj
133138fd1498Szrj  inline float
133238fd1498Szrj  comp_ellint_2f(float __k)
133338fd1498Szrj  { return __detail::__comp_ellint_2<float>(__k); }
133438fd1498Szrj
133538fd1498Szrj  inline long double
133638fd1498Szrj  comp_ellint_2l(long double __k)
133738fd1498Szrj  { return __detail::__comp_ellint_2<long double>(__k); }
133838fd1498Szrj
133938fd1498Szrj  ///  5.2.1.5  Complete elliptic integrals of the second kind.
134038fd1498Szrj  template<typename _Tp>
134138fd1498Szrj    inline typename __gnu_cxx::__promote<_Tp>::__type
134238fd1498Szrj    comp_ellint_2(_Tp __k)
134338fd1498Szrj    {
134438fd1498Szrj      typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
134538fd1498Szrj      return __detail::__comp_ellint_2<__type>(__k);
134638fd1498Szrj    }
134738fd1498Szrj
134838fd1498Szrj  inline float
134938fd1498Szrj  comp_ellint_3f(float __k, float __nu)
135038fd1498Szrj  { return __detail::__comp_ellint_3<float>(__k, __nu); }
135138fd1498Szrj
135238fd1498Szrj  inline long double
135338fd1498Szrj  comp_ellint_3l(long double __k, long double __nu)
135438fd1498Szrj  { return __detail::__comp_ellint_3<long double>(__k, __nu); }
135538fd1498Szrj
135638fd1498Szrj  ///  5.2.1.6  Complete elliptic integrals of the third kind.
135738fd1498Szrj  template<typename _Tp, typename _Tpn>
135838fd1498Szrj    inline typename __gnu_cxx::__promote_2<_Tp, _Tpn>::__type
135938fd1498Szrj    comp_ellint_3(_Tp __k, _Tpn __nu)
136038fd1498Szrj    {
136138fd1498Szrj      typedef typename __gnu_cxx::__promote_2<_Tp, _Tpn>::__type __type;
136238fd1498Szrj      return __detail::__comp_ellint_3<__type>(__k, __nu);
136338fd1498Szrj    }
136438fd1498Szrj
136538fd1498Szrj  inline float
136638fd1498Szrj  cyl_bessel_if(float __nu, float __x)
136738fd1498Szrj  { return __detail::__cyl_bessel_i<float>(__nu, __x); }
136838fd1498Szrj
136938fd1498Szrj  inline long double
137038fd1498Szrj  cyl_bessel_il(long double __nu, long double __x)
137138fd1498Szrj  { return __detail::__cyl_bessel_i<long double>(__nu, __x); }
137238fd1498Szrj
137338fd1498Szrj  ///  5.2.1.8  Regular modified cylindrical Bessel functions.
137438fd1498Szrj  template<typename _Tpnu, typename _Tp>
137538fd1498Szrj    inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type
137638fd1498Szrj    cyl_bessel_i(_Tpnu __nu, _Tp __x)
137738fd1498Szrj    {
137838fd1498Szrj      typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type;
137938fd1498Szrj      return __detail::__cyl_bessel_i<__type>(__nu, __x);
138038fd1498Szrj    }
138138fd1498Szrj
138238fd1498Szrj  inline float
138338fd1498Szrj  cyl_bessel_jf(float __nu, float __x)
138438fd1498Szrj  { return __detail::__cyl_bessel_j<float>(__nu, __x); }
138538fd1498Szrj
138638fd1498Szrj  inline long double
138738fd1498Szrj  cyl_bessel_jl(long double __nu, long double __x)
138838fd1498Szrj  { return __detail::__cyl_bessel_j<long double>(__nu, __x); }
138938fd1498Szrj
139038fd1498Szrj  ///  5.2.1.9  Cylindrical Bessel functions (of the first kind).
139138fd1498Szrj  template<typename _Tpnu, typename _Tp>
139238fd1498Szrj    inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type
139338fd1498Szrj    cyl_bessel_j(_Tpnu __nu, _Tp __x)
139438fd1498Szrj    {
139538fd1498Szrj      typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type;
139638fd1498Szrj      return __detail::__cyl_bessel_j<__type>(__nu, __x);
139738fd1498Szrj    }
139838fd1498Szrj
139938fd1498Szrj  inline float
140038fd1498Szrj  cyl_bessel_kf(float __nu, float __x)
140138fd1498Szrj  { return __detail::__cyl_bessel_k<float>(__nu, __x); }
140238fd1498Szrj
140338fd1498Szrj  inline long double
140438fd1498Szrj  cyl_bessel_kl(long double __nu, long double __x)
140538fd1498Szrj  { return __detail::__cyl_bessel_k<long double>(__nu, __x); }
140638fd1498Szrj
140738fd1498Szrj  ///  5.2.1.10  Irregular modified cylindrical Bessel functions.
140838fd1498Szrj  template<typename _Tpnu, typename _Tp>
140938fd1498Szrj    inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type
141038fd1498Szrj    cyl_bessel_k(_Tpnu __nu, _Tp __x)
141138fd1498Szrj    {
141238fd1498Szrj      typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type;
141338fd1498Szrj      return __detail::__cyl_bessel_k<__type>(__nu, __x);
141438fd1498Szrj    }
141538fd1498Szrj
141638fd1498Szrj  inline float
141738fd1498Szrj  cyl_neumannf(float __nu, float __x)
141838fd1498Szrj  { return __detail::__cyl_neumann_n<float>(__nu, __x); }
141938fd1498Szrj
142038fd1498Szrj  inline long double
142138fd1498Szrj  cyl_neumannl(long double __nu, long double __x)
142238fd1498Szrj  { return __detail::__cyl_neumann_n<long double>(__nu, __x); }
142338fd1498Szrj
142438fd1498Szrj  ///  5.2.1.11  Cylindrical Neumann functions.
142538fd1498Szrj  template<typename _Tpnu, typename _Tp>
142638fd1498Szrj    inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type
142738fd1498Szrj    cyl_neumann(_Tpnu __nu, _Tp __x)
142838fd1498Szrj    {
142938fd1498Szrj      typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type;
143038fd1498Szrj      return __detail::__cyl_neumann_n<__type>(__nu, __x);
143138fd1498Szrj    }
143238fd1498Szrj
143338fd1498Szrj  inline float
143438fd1498Szrj  ellint_1f(float __k, float __phi)
143538fd1498Szrj  { return __detail::__ellint_1<float>(__k, __phi); }
143638fd1498Szrj
143738fd1498Szrj  inline long double
143838fd1498Szrj  ellint_1l(long double __k, long double __phi)
143938fd1498Szrj  { return __detail::__ellint_1<long double>(__k, __phi); }
144038fd1498Szrj
144138fd1498Szrj  ///  5.2.1.12  Incomplete elliptic integrals of the first kind.
144238fd1498Szrj  template<typename _Tp, typename _Tpp>
144338fd1498Szrj    inline typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type
144438fd1498Szrj    ellint_1(_Tp __k, _Tpp __phi)
144538fd1498Szrj    {
144638fd1498Szrj      typedef typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type __type;
144738fd1498Szrj      return __detail::__ellint_1<__type>(__k, __phi);
144838fd1498Szrj    }
144938fd1498Szrj
145038fd1498Szrj  inline float
145138fd1498Szrj  ellint_2f(float __k, float __phi)
145238fd1498Szrj  { return __detail::__ellint_2<float>(__k, __phi); }
145338fd1498Szrj
145438fd1498Szrj  inline long double
145538fd1498Szrj  ellint_2l(long double __k, long double __phi)
145638fd1498Szrj  { return __detail::__ellint_2<long double>(__k, __phi); }
145738fd1498Szrj
145838fd1498Szrj  ///  5.2.1.13  Incomplete elliptic integrals of the second kind.
145938fd1498Szrj  template<typename _Tp, typename _Tpp>
146038fd1498Szrj    inline typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type
146138fd1498Szrj    ellint_2(_Tp __k, _Tpp __phi)
146238fd1498Szrj    {
146338fd1498Szrj      typedef typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type __type;
146438fd1498Szrj      return __detail::__ellint_2<__type>(__k, __phi);
146538fd1498Szrj    }
146638fd1498Szrj
146738fd1498Szrj  inline float
146838fd1498Szrj  ellint_3f(float __k, float __nu, float __phi)
146938fd1498Szrj  { return __detail::__ellint_3<float>(__k, __nu, __phi); }
147038fd1498Szrj
147138fd1498Szrj  inline long double
147238fd1498Szrj  ellint_3l(long double __k, long double __nu, long double __phi)
147338fd1498Szrj  { return __detail::__ellint_3<long double>(__k, __nu, __phi); }
147438fd1498Szrj
147538fd1498Szrj  ///  5.2.1.14  Incomplete elliptic integrals of the third kind.
147638fd1498Szrj  template<typename _Tp, typename _Tpn, typename _Tpp>
147738fd1498Szrj    inline typename __gnu_cxx::__promote_3<_Tp, _Tpn, _Tpp>::__type
147838fd1498Szrj    ellint_3(_Tp __k, _Tpn __nu, _Tpp __phi)
147938fd1498Szrj    {
148038fd1498Szrj      typedef typename __gnu_cxx::__promote_3<_Tp, _Tpn, _Tpp>::__type __type;
148138fd1498Szrj      return __detail::__ellint_3<__type>(__k, __nu, __phi);
148238fd1498Szrj    }
148338fd1498Szrj
148438fd1498Szrj  inline float
148538fd1498Szrj  expintf(float __x)
148638fd1498Szrj  { return __detail::__expint<float>(__x); }
148738fd1498Szrj
148838fd1498Szrj  inline long double
148938fd1498Szrj  expintl(long double __x)
149038fd1498Szrj  { return __detail::__expint<long double>(__x); }
149138fd1498Szrj
149238fd1498Szrj  ///  5.2.1.15  Exponential integrals.
149338fd1498Szrj  template<typename _Tp>
149438fd1498Szrj    inline typename __gnu_cxx::__promote<_Tp>::__type
149538fd1498Szrj    expint(_Tp __x)
149638fd1498Szrj    {
149738fd1498Szrj      typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
149838fd1498Szrj      return __detail::__expint<__type>(__x);
149938fd1498Szrj    }
150038fd1498Szrj
150138fd1498Szrj  inline float
150238fd1498Szrj  hermitef(unsigned int __n, float __x)
150338fd1498Szrj  { return __detail::__poly_hermite<float>(__n, __x); }
150438fd1498Szrj
150538fd1498Szrj  inline long double
150638fd1498Szrj  hermitel(unsigned int __n, long double __x)
150738fd1498Szrj  { return __detail::__poly_hermite<long double>(__n, __x); }
150838fd1498Szrj
150938fd1498Szrj  ///  5.2.1.16  Hermite polynomials.
151038fd1498Szrj  template<typename _Tp>
151138fd1498Szrj    inline typename __gnu_cxx::__promote<_Tp>::__type
151238fd1498Szrj    hermite(unsigned int __n, _Tp __x)
151338fd1498Szrj    {
151438fd1498Szrj      typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
151538fd1498Szrj      return __detail::__poly_hermite<__type>(__n, __x);
151638fd1498Szrj    }
151738fd1498Szrj
151838fd1498Szrj  inline float
151938fd1498Szrj  laguerref(unsigned int __n, float __x)
152038fd1498Szrj  { return __detail::__laguerre<float>(__n, __x); }
152138fd1498Szrj
152238fd1498Szrj  inline long double
152338fd1498Szrj  laguerrel(unsigned int __n, long double __x)
152438fd1498Szrj  { return __detail::__laguerre<long double>(__n, __x); }
152538fd1498Szrj
152638fd1498Szrj  ///  5.2.1.18  Laguerre polynomials.
152738fd1498Szrj  template<typename _Tp>
152838fd1498Szrj    inline typename __gnu_cxx::__promote<_Tp>::__type
152938fd1498Szrj    laguerre(unsigned int __n, _Tp __x)
153038fd1498Szrj    {
153138fd1498Szrj      typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
153238fd1498Szrj      return __detail::__laguerre<__type>(__n, __x);
153338fd1498Szrj    }
153438fd1498Szrj
153538fd1498Szrj  inline float
153638fd1498Szrj  legendref(unsigned int __n, float __x)
153738fd1498Szrj  { return __detail::__poly_legendre_p<float>(__n, __x); }
153838fd1498Szrj
153938fd1498Szrj  inline long double
154038fd1498Szrj  legendrel(unsigned int __n, long double __x)
154138fd1498Szrj  { return __detail::__poly_legendre_p<long double>(__n, __x); }
154238fd1498Szrj
154338fd1498Szrj  ///  5.2.1.19  Legendre polynomials.
154438fd1498Szrj  template<typename _Tp>
154538fd1498Szrj    inline typename __gnu_cxx::__promote<_Tp>::__type
154638fd1498Szrj    legendre(unsigned int __n, _Tp __x)
154738fd1498Szrj    {
154838fd1498Szrj      typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
154938fd1498Szrj      return __detail::__poly_legendre_p<__type>(__n, __x);
155038fd1498Szrj    }
155138fd1498Szrj
155238fd1498Szrj  inline float
155338fd1498Szrj  riemann_zetaf(float __x)
155438fd1498Szrj  { return __detail::__riemann_zeta<float>(__x); }
155538fd1498Szrj
155638fd1498Szrj  inline long double
155738fd1498Szrj  riemann_zetal(long double __x)
155838fd1498Szrj  { return __detail::__riemann_zeta<long double>(__x); }
155938fd1498Szrj
156038fd1498Szrj  ///  5.2.1.20  Riemann zeta function.
156138fd1498Szrj  template<typename _Tp>
156238fd1498Szrj    inline typename __gnu_cxx::__promote<_Tp>::__type
156338fd1498Szrj    riemann_zeta(_Tp __x)
156438fd1498Szrj    {
156538fd1498Szrj      typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
156638fd1498Szrj      return __detail::__riemann_zeta<__type>(__x);
156738fd1498Szrj    }
156838fd1498Szrj
156938fd1498Szrj  inline float
157038fd1498Szrj  sph_besself(unsigned int __n, float __x)
157138fd1498Szrj  { return __detail::__sph_bessel<float>(__n, __x); }
157238fd1498Szrj
157338fd1498Szrj  inline long double
157438fd1498Szrj  sph_bessell(unsigned int __n, long double __x)
157538fd1498Szrj  { return __detail::__sph_bessel<long double>(__n, __x); }
157638fd1498Szrj
157738fd1498Szrj  ///  5.2.1.21  Spherical Bessel functions.
157838fd1498Szrj  template<typename _Tp>
157938fd1498Szrj    inline typename __gnu_cxx::__promote<_Tp>::__type
158038fd1498Szrj    sph_bessel(unsigned int __n, _Tp __x)
158138fd1498Szrj    {
158238fd1498Szrj      typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
158338fd1498Szrj      return __detail::__sph_bessel<__type>(__n, __x);
158438fd1498Szrj    }
158538fd1498Szrj
158638fd1498Szrj  inline float
158738fd1498Szrj  sph_legendref(unsigned int __l, unsigned int __m, float __theta)
158838fd1498Szrj  { return __detail::__sph_legendre<float>(__l, __m, __theta); }
158938fd1498Szrj
159038fd1498Szrj  inline long double
159138fd1498Szrj  sph_legendrel(unsigned int __l, unsigned int __m, long double __theta)
159238fd1498Szrj  { return __detail::__sph_legendre<long double>(__l, __m, __theta); }
159338fd1498Szrj
159438fd1498Szrj  ///  5.2.1.22  Spherical associated Legendre functions.
159538fd1498Szrj  template<typename _Tp>
159638fd1498Szrj    inline typename __gnu_cxx::__promote<_Tp>::__type
159738fd1498Szrj    sph_legendre(unsigned int __l, unsigned int __m, _Tp __theta)
159838fd1498Szrj    {
159938fd1498Szrj      typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
160038fd1498Szrj      return __detail::__sph_legendre<__type>(__l, __m, __theta);
160138fd1498Szrj    }
160238fd1498Szrj
160338fd1498Szrj  inline float
160438fd1498Szrj  sph_neumannf(unsigned int __n, float __x)
160538fd1498Szrj  { return __detail::__sph_neumann<float>(__n, __x); }
160638fd1498Szrj
160738fd1498Szrj  inline long double
160838fd1498Szrj  sph_neumannl(unsigned int __n, long double __x)
160938fd1498Szrj  { return __detail::__sph_neumann<long double>(__n, __x); }
161038fd1498Szrj
161138fd1498Szrj  ///  5.2.1.23  Spherical Neumann functions.
161238fd1498Szrj  template<typename _Tp>
161338fd1498Szrj    inline typename __gnu_cxx::__promote<_Tp>::__type
161438fd1498Szrj    sph_neumann(unsigned int __n, _Tp __x)
161538fd1498Szrj    {
161638fd1498Szrj      typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
161738fd1498Szrj      return __detail::__sph_neumann<__type>(__n, __x);
161838fd1498Szrj    }
161938fd1498Szrj
162038fd1498Szrj  /* @} */ // tr1_math_spec_func
162138fd1498Szrj#endif // _GLIBCXX_USE_STD_SPEC_FUNCS
162238fd1498Szrj
162338fd1498Szrj} // namespace tr1
162438fd1498Szrj
162538fd1498Szrj_GLIBCXX_END_NAMESPACE_VERSION
162638fd1498Szrj} // namespace std
162738fd1498Szrj
1628*58e805e6Szrj#if _GLIBCXX_USE_STD_SPEC_FUNCS && !defined(__STRICT_ANSI__)
1629*58e805e6Szrjnamespace std _GLIBCXX_VISIBILITY(default)
1630*58e805e6Szrj{
1631*58e805e6Szrj_GLIBCXX_BEGIN_NAMESPACE_VERSION
1632*58e805e6Szrj
1633*58e805e6Szrjnamespace tr1
1634*58e805e6Szrj{
1635*58e805e6Szrj  using __gnu_cxx::conf_hypergf;
1636*58e805e6Szrj  using __gnu_cxx::conf_hypergl;
1637*58e805e6Szrj  using __gnu_cxx::conf_hyperg;
1638*58e805e6Szrj
1639*58e805e6Szrj  using __gnu_cxx::hypergf;
1640*58e805e6Szrj  using __gnu_cxx::hypergl;
1641*58e805e6Szrj  using __gnu_cxx::hyperg;
1642*58e805e6Szrj} // namespace tr1
1643*58e805e6Szrj
1644*58e805e6Szrj_GLIBCXX_END_NAMESPACE_VERSION
1645*58e805e6Szrj} // namespace std
1646*58e805e6Szrj
1647*58e805e6Szrj#else // ! (_GLIBCXX_USE_STD_SPEC_FUNCS && !defined(__STRICT_ANSI__))
1648*58e805e6Szrj
1649*58e805e6Szrj#include <bits/stl_algobase.h>
1650*58e805e6Szrj#include <limits>
1651*58e805e6Szrj#include <tr1/type_traits>
1652*58e805e6Szrj
1653*58e805e6Szrj#include <tr1/hypergeometric.tcc>
1654*58e805e6Szrj
1655*58e805e6Szrjnamespace std _GLIBCXX_VISIBILITY(default)
1656*58e805e6Szrj{
1657*58e805e6Szrj_GLIBCXX_BEGIN_NAMESPACE_VERSION
1658*58e805e6Szrj
1659*58e805e6Szrjnamespace tr1
1660*58e805e6Szrj{
1661*58e805e6Szrj  inline float
1662*58e805e6Szrj  conf_hypergf(float __a, float __c, float __x)
1663*58e805e6Szrj  { return __detail::__conf_hyperg<float>(__a, __c, __x); }
1664*58e805e6Szrj
1665*58e805e6Szrj  inline long double
1666*58e805e6Szrj  conf_hypergl(long double __a, long double __c, long double __x)
1667*58e805e6Szrj  { return __detail::__conf_hyperg<long double>(__a, __c, __x); }
1668*58e805e6Szrj
1669*58e805e6Szrj  ///  5.2.1.7  Confluent hypergeometric functions.
1670*58e805e6Szrj  template<typename _Tpa, typename _Tpc, typename _Tp>
1671*58e805e6Szrj    inline typename __gnu_cxx::__promote_3<_Tpa, _Tpc, _Tp>::__type
1672*58e805e6Szrj    conf_hyperg(_Tpa __a, _Tpc __c, _Tp __x)
1673*58e805e6Szrj    {
1674*58e805e6Szrj      typedef typename __gnu_cxx::__promote_3<_Tpa, _Tpc, _Tp>::__type __type;
1675*58e805e6Szrj      return __detail::__conf_hyperg<__type>(__a, __c, __x);
1676*58e805e6Szrj    }
1677*58e805e6Szrj
1678*58e805e6Szrj  inline float
1679*58e805e6Szrj  hypergf(float __a, float __b, float __c, float __x)
1680*58e805e6Szrj  { return __detail::__hyperg<float>(__a, __b, __c, __x); }
1681*58e805e6Szrj
1682*58e805e6Szrj  inline long double
1683*58e805e6Szrj  hypergl(long double __a, long double __b, long double __c, long double __x)
1684*58e805e6Szrj  { return __detail::__hyperg<long double>(__a, __b, __c, __x); }
1685*58e805e6Szrj
1686*58e805e6Szrj  ///  5.2.1.17  Hypergeometric functions.
1687*58e805e6Szrj  template<typename _Tpa, typename _Tpb, typename _Tpc, typename _Tp>
1688*58e805e6Szrj    inline typename __gnu_cxx::__promote_4<_Tpa, _Tpb, _Tpc, _Tp>::__type
1689*58e805e6Szrj    hyperg(_Tpa __a, _Tpb __b, _Tpc __c, _Tp __x)
1690*58e805e6Szrj    {
1691*58e805e6Szrj      typedef typename __gnu_cxx::__promote_4<_Tpa, _Tpb, _Tpc, _Tp>::__type __type;
1692*58e805e6Szrj      return __detail::__hyperg<__type>(__a, __b, __c, __x);
1693*58e805e6Szrj    }
1694*58e805e6Szrj
1695*58e805e6Szrj} // namespace tr1
1696*58e805e6Szrj
1697*58e805e6Szrj_GLIBCXX_END_NAMESPACE_VERSION
1698*58e805e6Szrj} // namespace std
1699*58e805e6Szrj#endif // _GLIBCXX_USE_STD_SPEC_FUNCS && !defined(__STRICT_ANSI__)
1700*58e805e6Szrj
170138fd1498Szrj#endif // _GLIBCXX_TR1_CMATH
1702