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