libstdc++
|
00001 // TR1 cmath -*- C++ -*- 00002 00003 // Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 00004 // Free Software Foundation, Inc. 00005 // 00006 // This file is part of the GNU ISO C++ Library. This library is free 00007 // software; you can redistribute it and/or modify it under the 00008 // terms of the GNU General Public License as published by the 00009 // Free Software Foundation; either version 3, or (at your option) 00010 // any later version. 00011 00012 // This library is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 00017 // Under Section 7 of GPL version 3, you are granted additional 00018 // permissions described in the GCC Runtime Library Exception, version 00019 // 3.1, as published by the Free Software Foundation. 00020 00021 // You should have received a copy of the GNU General Public License and 00022 // a copy of the GCC Runtime Library Exception along with this program; 00023 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 00024 // <http://www.gnu.org/licenses/>. 00025 00026 /** @file tr1/cmath 00027 * This is a TR1 C++ Library header. 00028 */ 00029 00030 #ifndef _GLIBCXX_TR1_CMATH 00031 #define _GLIBCXX_TR1_CMATH 1 00032 00033 #pragma GCC system_header 00034 00035 #include <cmath> 00036 00037 #ifdef _GLIBCXX_USE_C99_MATH_TR1 00038 00039 #undef acosh 00040 #undef acoshf 00041 #undef acoshl 00042 #undef asinh 00043 #undef asinhf 00044 #undef asinhl 00045 #undef atanh 00046 #undef atanhf 00047 #undef atanhl 00048 #undef cbrt 00049 #undef cbrtf 00050 #undef cbrtl 00051 #undef copysign 00052 #undef copysignf 00053 #undef copysignl 00054 #undef erf 00055 #undef erff 00056 #undef erfl 00057 #undef erfc 00058 #undef erfcf 00059 #undef erfcl 00060 #undef exp2 00061 #undef exp2f 00062 #undef exp2l 00063 #undef expm1 00064 #undef expm1f 00065 #undef expm1l 00066 #undef fdim 00067 #undef fdimf 00068 #undef fdiml 00069 #undef fma 00070 #undef fmaf 00071 #undef fmal 00072 #undef fmax 00073 #undef fmaxf 00074 #undef fmaxl 00075 #undef fmin 00076 #undef fminf 00077 #undef fminl 00078 #undef hypot 00079 #undef hypotf 00080 #undef hypotl 00081 #undef ilogb 00082 #undef ilogbf 00083 #undef ilogbl 00084 #undef lgamma 00085 #undef lgammaf 00086 #undef lgammal 00087 #undef llrint 00088 #undef llrintf 00089 #undef llrintl 00090 #undef llround 00091 #undef llroundf 00092 #undef llroundl 00093 #undef log1p 00094 #undef log1pf 00095 #undef log1pl 00096 #undef log2 00097 #undef log2f 00098 #undef log2l 00099 #undef logb 00100 #undef logbf 00101 #undef logbl 00102 #undef lrint 00103 #undef lrintf 00104 #undef lrintl 00105 #undef lround 00106 #undef lroundf 00107 #undef lroundl 00108 #undef nan 00109 #undef nanf 00110 #undef nanl 00111 #undef nearbyint 00112 #undef nearbyintf 00113 #undef nearbyintl 00114 #undef nextafter 00115 #undef nextafterf 00116 #undef nextafterl 00117 #undef nexttoward 00118 #undef nexttowardf 00119 #undef nexttowardl 00120 #undef remainder 00121 #undef remainderf 00122 #undef remainderl 00123 #undef remquo 00124 #undef remquof 00125 #undef remquol 00126 #undef rint 00127 #undef rintf 00128 #undef rintl 00129 #undef round 00130 #undef roundf 00131 #undef roundl 00132 #undef scalbln 00133 #undef scalblnf 00134 #undef scalblnl 00135 #undef scalbn 00136 #undef scalbnf 00137 #undef scalbnl 00138 #undef tgamma 00139 #undef tgammaf 00140 #undef tgammal 00141 #undef trunc 00142 #undef truncf 00143 #undef truncl 00144 00145 #endif 00146 00147 namespace std _GLIBCXX_VISIBILITY(default) 00148 { 00149 namespace tr1 00150 { 00151 _GLIBCXX_BEGIN_NAMESPACE_VERSION 00152 00153 #if _GLIBCXX_USE_C99_MATH_TR1 00154 00155 // types 00156 using ::double_t; 00157 using ::float_t; 00158 00159 // functions 00160 using ::acosh; 00161 using ::acoshf; 00162 using ::acoshl; 00163 00164 using ::asinh; 00165 using ::asinhf; 00166 using ::asinhl; 00167 00168 using ::atanh; 00169 using ::atanhf; 00170 using ::atanhl; 00171 00172 using ::cbrt; 00173 using ::cbrtf; 00174 using ::cbrtl; 00175 00176 using ::copysign; 00177 using ::copysignf; 00178 using ::copysignl; 00179 00180 using ::erf; 00181 using ::erff; 00182 using ::erfl; 00183 00184 using ::erfc; 00185 using ::erfcf; 00186 using ::erfcl; 00187 00188 using ::exp2; 00189 using ::exp2f; 00190 using ::exp2l; 00191 00192 using ::expm1; 00193 using ::expm1f; 00194 using ::expm1l; 00195 00196 using ::fdim; 00197 using ::fdimf; 00198 using ::fdiml; 00199 00200 using ::fma; 00201 using ::fmaf; 00202 using ::fmal; 00203 00204 using ::fmax; 00205 using ::fmaxf; 00206 using ::fmaxl; 00207 00208 using ::fmin; 00209 using ::fminf; 00210 using ::fminl; 00211 00212 using ::hypot; 00213 using ::hypotf; 00214 using ::hypotl; 00215 00216 using ::ilogb; 00217 using ::ilogbf; 00218 using ::ilogbl; 00219 00220 using ::lgamma; 00221 using ::lgammaf; 00222 using ::lgammal; 00223 00224 using ::llrint; 00225 using ::llrintf; 00226 using ::llrintl; 00227 00228 using ::llround; 00229 using ::llroundf; 00230 using ::llroundl; 00231 00232 using ::log1p; 00233 using ::log1pf; 00234 using ::log1pl; 00235 00236 using ::log2; 00237 using ::log2f; 00238 using ::log2l; 00239 00240 using ::logb; 00241 using ::logbf; 00242 using ::logbl; 00243 00244 using ::lrint; 00245 using ::lrintf; 00246 using ::lrintl; 00247 00248 using ::lround; 00249 using ::lroundf; 00250 using ::lroundl; 00251 00252 using ::nan; 00253 using ::nanf; 00254 using ::nanl; 00255 00256 using ::nearbyint; 00257 using ::nearbyintf; 00258 using ::nearbyintl; 00259 00260 using ::nextafter; 00261 using ::nextafterf; 00262 using ::nextafterl; 00263 00264 using ::nexttoward; 00265 using ::nexttowardf; 00266 using ::nexttowardl; 00267 00268 using ::remainder; 00269 using ::remainderf; 00270 using ::remainderl; 00271 00272 using ::remquo; 00273 using ::remquof; 00274 using ::remquol; 00275 00276 using ::rint; 00277 using ::rintf; 00278 using ::rintl; 00279 00280 using ::round; 00281 using ::roundf; 00282 using ::roundl; 00283 00284 using ::scalbln; 00285 using ::scalblnf; 00286 using ::scalblnl; 00287 00288 using ::scalbn; 00289 using ::scalbnf; 00290 using ::scalbnl; 00291 00292 using ::tgamma; 00293 using ::tgammaf; 00294 using ::tgammal; 00295 00296 using ::trunc; 00297 using ::truncf; 00298 using ::truncl; 00299 00300 #endif 00301 00302 #if _GLIBCXX_USE_C99_MATH 00303 #if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC 00304 00305 /// Function template definitions [8.16.3]. 00306 template<typename _Tp> 00307 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 00308 int>::__type 00309 fpclassify(_Tp __f) 00310 { 00311 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 00312 return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, 00313 FP_SUBNORMAL, FP_ZERO, __type(__f)); 00314 } 00315 00316 template<typename _Tp> 00317 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 00318 int>::__type 00319 isfinite(_Tp __f) 00320 { 00321 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 00322 return __builtin_isfinite(__type(__f)); 00323 } 00324 00325 template<typename _Tp> 00326 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 00327 int>::__type 00328 isinf(_Tp __f) 00329 { 00330 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 00331 return __builtin_isinf(__type(__f)); 00332 } 00333 00334 template<typename _Tp> 00335 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 00336 int>::__type 00337 isnan(_Tp __f) 00338 { 00339 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 00340 return __builtin_isnan(__type(__f)); 00341 } 00342 00343 template<typename _Tp> 00344 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 00345 int>::__type 00346 isnormal(_Tp __f) 00347 { 00348 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 00349 return __builtin_isnormal(__type(__f)); 00350 } 00351 00352 template<typename _Tp> 00353 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 00354 int>::__type 00355 signbit(_Tp __f) 00356 { 00357 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 00358 return __builtin_signbit(__type(__f)); 00359 } 00360 00361 template<typename _Tp> 00362 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 00363 int>::__type 00364 isgreater(_Tp __f1, _Tp __f2) 00365 { 00366 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 00367 return __builtin_isgreater(__type(__f1), __type(__f2)); 00368 } 00369 00370 template<typename _Tp> 00371 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 00372 int>::__type 00373 isgreaterequal(_Tp __f1, _Tp __f2) 00374 { 00375 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 00376 return __builtin_isgreaterequal(__type(__f1), __type(__f2)); 00377 } 00378 00379 template<typename _Tp> 00380 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 00381 int>::__type 00382 isless(_Tp __f1, _Tp __f2) 00383 { 00384 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 00385 return __builtin_isless(__type(__f1), __type(__f2)); 00386 } 00387 00388 template<typename _Tp> 00389 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 00390 int>::__type 00391 islessequal(_Tp __f1, _Tp __f2) 00392 { 00393 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 00394 return __builtin_islessequal(__type(__f1), __type(__f2)); 00395 } 00396 00397 template<typename _Tp> 00398 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 00399 int>::__type 00400 islessgreater(_Tp __f1, _Tp __f2) 00401 { 00402 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 00403 return __builtin_islessgreater(__type(__f1), __type(__f2)); 00404 } 00405 00406 template<typename _Tp> 00407 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, 00408 int>::__type 00409 isunordered(_Tp __f1, _Tp __f2) 00410 { 00411 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 00412 return __builtin_isunordered(__type(__f1), __type(__f2)); 00413 } 00414 00415 #endif 00416 #endif 00417 00418 #if _GLIBCXX_USE_C99_MATH_TR1 00419 00420 /// Additional overloads [8.16.4]. 00421 using std::acos; 00422 00423 inline float 00424 acosh(float __x) 00425 { return __builtin_acoshf(__x); } 00426 00427 inline long double 00428 acosh(long double __x) 00429 { return __builtin_acoshl(__x); } 00430 00431 template<typename _Tp> 00432 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00433 double>::__type 00434 acosh(_Tp __x) 00435 { return __builtin_acosh(__x); } 00436 00437 using std::asin; 00438 00439 inline float 00440 asinh(float __x) 00441 { return __builtin_asinhf(__x); } 00442 00443 inline long double 00444 asinh(long double __x) 00445 { return __builtin_asinhl(__x); } 00446 00447 template<typename _Tp> 00448 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00449 double>::__type 00450 asinh(_Tp __x) 00451 { return __builtin_asinh(__x); } 00452 00453 using std::atan; 00454 using std::atan2; 00455 00456 inline float 00457 atanh(float __x) 00458 { return __builtin_atanhf(__x); } 00459 00460 inline long double 00461 atanh(long double __x) 00462 { return __builtin_atanhl(__x); } 00463 00464 template<typename _Tp> 00465 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00466 double>::__type 00467 atanh(_Tp __x) 00468 { return __builtin_atanh(__x); } 00469 00470 inline float 00471 cbrt(float __x) 00472 { return __builtin_cbrtf(__x); } 00473 00474 inline long double 00475 cbrt(long double __x) 00476 { return __builtin_cbrtl(__x); } 00477 00478 template<typename _Tp> 00479 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00480 double>::__type 00481 cbrt(_Tp __x) 00482 { return __builtin_cbrt(__x); } 00483 00484 using std::ceil; 00485 00486 inline float 00487 copysign(float __x, float __y) 00488 { return __builtin_copysignf(__x, __y); } 00489 00490 inline long double 00491 copysign(long double __x, long double __y) 00492 { return __builtin_copysignl(__x, __y); } 00493 00494 template<typename _Tp, typename _Up> 00495 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type 00496 copysign(_Tp __x, _Up __y) 00497 { 00498 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 00499 return copysign(__type(__x), __type(__y)); 00500 } 00501 00502 using std::cos; 00503 using std::cosh; 00504 00505 inline float 00506 erf(float __x) 00507 { return __builtin_erff(__x); } 00508 00509 inline long double 00510 erf(long double __x) 00511 { return __builtin_erfl(__x); } 00512 00513 template<typename _Tp> 00514 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00515 double>::__type 00516 erf(_Tp __x) 00517 { return __builtin_erf(__x); } 00518 00519 inline float 00520 erfc(float __x) 00521 { return __builtin_erfcf(__x); } 00522 00523 inline long double 00524 erfc(long double __x) 00525 { return __builtin_erfcl(__x); } 00526 00527 template<typename _Tp> 00528 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00529 double>::__type 00530 erfc(_Tp __x) 00531 { return __builtin_erfc(__x); } 00532 00533 using std::exp; 00534 00535 inline float 00536 exp2(float __x) 00537 { return __builtin_exp2f(__x); } 00538 00539 inline long double 00540 exp2(long double __x) 00541 { return __builtin_exp2l(__x); } 00542 00543 template<typename _Tp> 00544 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00545 double>::__type 00546 exp2(_Tp __x) 00547 { return __builtin_exp2(__x); } 00548 00549 inline float 00550 expm1(float __x) 00551 { return __builtin_expm1f(__x); } 00552 00553 inline long double 00554 expm1(long double __x) 00555 { return __builtin_expm1l(__x); } 00556 00557 template<typename _Tp> 00558 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00559 double>::__type 00560 expm1(_Tp __x) 00561 { return __builtin_expm1(__x); } 00562 00563 // Note: we deal with fabs in a special way, because an using std::fabs 00564 // would bring in also the overloads for complex types, which in C++0x 00565 // mode have a different return type. 00566 // With __CORRECT_ISO_CPP_MATH_H_PROTO1, math.h imports std::fabs in the 00567 // global namespace after the declarations of the float / double / long 00568 // double overloads but before the std::complex overloads. 00569 using ::fabs; 00570 00571 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1 00572 inline float 00573 fabs(float __x) 00574 { return __builtin_fabsf(__x); } 00575 00576 inline long double 00577 fabs(long double __x) 00578 { return __builtin_fabsl(__x); } 00579 00580 template<typename _Tp> 00581 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00582 double>::__type 00583 fabs(_Tp __x) 00584 { return __builtin_fabs(__x); } 00585 #endif 00586 00587 inline float 00588 fdim(float __x, float __y) 00589 { return __builtin_fdimf(__x, __y); } 00590 00591 inline long double 00592 fdim(long double __x, long double __y) 00593 { return __builtin_fdiml(__x, __y); } 00594 00595 template<typename _Tp, typename _Up> 00596 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type 00597 fdim(_Tp __x, _Up __y) 00598 { 00599 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 00600 return fdim(__type(__x), __type(__y)); 00601 } 00602 00603 using std::floor; 00604 00605 inline float 00606 fma(float __x, float __y, float __z) 00607 { return __builtin_fmaf(__x, __y, __z); } 00608 00609 inline long double 00610 fma(long double __x, long double __y, long double __z) 00611 { return __builtin_fmal(__x, __y, __z); } 00612 00613 template<typename _Tp, typename _Up, typename _Vp> 00614 inline typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type 00615 fma(_Tp __x, _Up __y, _Vp __z) 00616 { 00617 typedef typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type __type; 00618 return fma(__type(__x), __type(__y), __type(__z)); 00619 } 00620 00621 inline float 00622 fmax(float __x, float __y) 00623 { return __builtin_fmaxf(__x, __y); } 00624 00625 inline long double 00626 fmax(long double __x, long double __y) 00627 { return __builtin_fmaxl(__x, __y); } 00628 00629 template<typename _Tp, typename _Up> 00630 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type 00631 fmax(_Tp __x, _Up __y) 00632 { 00633 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 00634 return fmax(__type(__x), __type(__y)); 00635 } 00636 00637 inline float 00638 fmin(float __x, float __y) 00639 { return __builtin_fminf(__x, __y); } 00640 00641 inline long double 00642 fmin(long double __x, long double __y) 00643 { return __builtin_fminl(__x, __y); } 00644 00645 template<typename _Tp, typename _Up> 00646 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type 00647 fmin(_Tp __x, _Up __y) 00648 { 00649 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 00650 return fmin(__type(__x), __type(__y)); 00651 } 00652 00653 using std::fmod; 00654 using std::frexp; 00655 00656 inline float 00657 hypot(float __x, float __y) 00658 { return __builtin_hypotf(__x, __y); } 00659 00660 inline long double 00661 hypot(long double __x, long double __y) 00662 { return __builtin_hypotl(__x, __y); } 00663 00664 template<typename _Tp, typename _Up> 00665 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type 00666 hypot(_Tp __y, _Up __x) 00667 { 00668 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 00669 return hypot(__type(__y), __type(__x)); 00670 } 00671 00672 inline int 00673 ilogb(float __x) 00674 { return __builtin_ilogbf(__x); } 00675 00676 inline int 00677 ilogb(long double __x) 00678 { return __builtin_ilogbl(__x); } 00679 00680 template<typename _Tp> 00681 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00682 int>::__type 00683 ilogb(_Tp __x) 00684 { return __builtin_ilogb(__x); } 00685 00686 using std::ldexp; 00687 00688 inline float 00689 lgamma(float __x) 00690 { return __builtin_lgammaf(__x); } 00691 00692 inline long double 00693 lgamma(long double __x) 00694 { return __builtin_lgammal(__x); } 00695 00696 template<typename _Tp> 00697 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00698 double>::__type 00699 lgamma(_Tp __x) 00700 { return __builtin_lgamma(__x); } 00701 00702 inline long long 00703 llrint(float __x) 00704 { return __builtin_llrintf(__x); } 00705 00706 inline long long 00707 llrint(long double __x) 00708 { return __builtin_llrintl(__x); } 00709 00710 template<typename _Tp> 00711 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00712 long long>::__type 00713 llrint(_Tp __x) 00714 { return __builtin_llrint(__x); } 00715 00716 inline long long 00717 llround(float __x) 00718 { return __builtin_llroundf(__x); } 00719 00720 inline long long 00721 llround(long double __x) 00722 { return __builtin_llroundl(__x); } 00723 00724 template<typename _Tp> 00725 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00726 long long>::__type 00727 llround(_Tp __x) 00728 { return __builtin_llround(__x); } 00729 00730 using std::log; 00731 using std::log10; 00732 00733 inline float 00734 log1p(float __x) 00735 { return __builtin_log1pf(__x); } 00736 00737 inline long double 00738 log1p(long double __x) 00739 { return __builtin_log1pl(__x); } 00740 00741 template<typename _Tp> 00742 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00743 double>::__type 00744 log1p(_Tp __x) 00745 { return __builtin_log1p(__x); } 00746 00747 // DR 568. 00748 inline float 00749 log2(float __x) 00750 { return __builtin_log2f(__x); } 00751 00752 inline long double 00753 log2(long double __x) 00754 { return __builtin_log2l(__x); } 00755 00756 template<typename _Tp> 00757 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00758 double>::__type 00759 log2(_Tp __x) 00760 { return __builtin_log2(__x); } 00761 00762 inline float 00763 logb(float __x) 00764 { return __builtin_logbf(__x); } 00765 00766 inline long double 00767 logb(long double __x) 00768 { return __builtin_logbl(__x); } 00769 00770 template<typename _Tp> 00771 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00772 double>::__type 00773 logb(_Tp __x) 00774 { 00775 return __builtin_logb(__x); 00776 } 00777 00778 inline long 00779 lrint(float __x) 00780 { return __builtin_lrintf(__x); } 00781 00782 inline long 00783 lrint(long double __x) 00784 { return __builtin_lrintl(__x); } 00785 00786 template<typename _Tp> 00787 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00788 long>::__type 00789 lrint(_Tp __x) 00790 { return __builtin_lrint(__x); } 00791 00792 inline long 00793 lround(float __x) 00794 { return __builtin_lroundf(__x); } 00795 00796 inline long 00797 lround(long double __x) 00798 { return __builtin_lroundl(__x); } 00799 00800 template<typename _Tp> 00801 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00802 long>::__type 00803 lround(_Tp __x) 00804 { return __builtin_lround(__x); } 00805 00806 inline float 00807 nearbyint(float __x) 00808 { return __builtin_nearbyintf(__x); } 00809 00810 inline long double 00811 nearbyint(long double __x) 00812 { return __builtin_nearbyintl(__x); } 00813 00814 template<typename _Tp> 00815 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00816 double>::__type 00817 nearbyint(_Tp __x) 00818 { return __builtin_nearbyint(__x); } 00819 00820 inline float 00821 nextafter(float __x, float __y) 00822 { return __builtin_nextafterf(__x, __y); } 00823 00824 inline long double 00825 nextafter(long double __x, long double __y) 00826 { return __builtin_nextafterl(__x, __y); } 00827 00828 template<typename _Tp, typename _Up> 00829 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type 00830 nextafter(_Tp __x, _Up __y) 00831 { 00832 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 00833 return nextafter(__type(__x), __type(__y)); 00834 } 00835 00836 inline float 00837 nexttoward(float __x, long double __y) 00838 { return __builtin_nexttowardf(__x, __y); } 00839 00840 inline long double 00841 nexttoward(long double __x, long double __y) 00842 { return __builtin_nexttowardl(__x, __y); } 00843 00844 template<typename _Tp> 00845 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00846 double>::__type 00847 nexttoward(_Tp __x, long double __y) 00848 { return __builtin_nexttoward(__x, __y); } 00849 00850 // DR 550. What should the return type of pow(float,int) be? 00851 // NB: C++0x and TR1 != C++03. 00852 // using std::pow; 00853 00854 inline float 00855 remainder(float __x, float __y) 00856 { return __builtin_remainderf(__x, __y); } 00857 00858 inline long double 00859 remainder(long double __x, long double __y) 00860 { return __builtin_remainderl(__x, __y); } 00861 00862 template<typename _Tp, typename _Up> 00863 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type 00864 remainder(_Tp __x, _Up __y) 00865 { 00866 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 00867 return remainder(__type(__x), __type(__y)); 00868 } 00869 00870 inline float 00871 remquo(float __x, float __y, int* __pquo) 00872 { return __builtin_remquof(__x, __y, __pquo); } 00873 00874 inline long double 00875 remquo(long double __x, long double __y, int* __pquo) 00876 { return __builtin_remquol(__x, __y, __pquo); } 00877 00878 template<typename _Tp, typename _Up> 00879 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type 00880 remquo(_Tp __x, _Up __y, int* __pquo) 00881 { 00882 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 00883 return remquo(__type(__x), __type(__y), __pquo); 00884 } 00885 00886 inline float 00887 rint(float __x) 00888 { return __builtin_rintf(__x); } 00889 00890 inline long double 00891 rint(long double __x) 00892 { return __builtin_rintl(__x); } 00893 00894 template<typename _Tp> 00895 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00896 double>::__type 00897 rint(_Tp __x) 00898 { return __builtin_rint(__x); } 00899 00900 inline float 00901 round(float __x) 00902 { return __builtin_roundf(__x); } 00903 00904 inline long double 00905 round(long double __x) 00906 { return __builtin_roundl(__x); } 00907 00908 template<typename _Tp> 00909 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00910 double>::__type 00911 round(_Tp __x) 00912 { return __builtin_round(__x); } 00913 00914 inline float 00915 scalbln(float __x, long __ex) 00916 { return __builtin_scalblnf(__x, __ex); } 00917 00918 inline long double 00919 scalbln(long double __x, long __ex) 00920 { return __builtin_scalblnl(__x, __ex); } 00921 00922 template<typename _Tp> 00923 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00924 double>::__type 00925 scalbln(_Tp __x, long __ex) 00926 { return __builtin_scalbln(__x, __ex); } 00927 00928 inline float 00929 scalbn(float __x, int __ex) 00930 { return __builtin_scalbnf(__x, __ex); } 00931 00932 inline long double 00933 scalbn(long double __x, int __ex) 00934 { return __builtin_scalbnl(__x, __ex); } 00935 00936 template<typename _Tp> 00937 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00938 double>::__type 00939 scalbn(_Tp __x, int __ex) 00940 { return __builtin_scalbn(__x, __ex); } 00941 00942 using std::sin; 00943 using std::sinh; 00944 using std::sqrt; 00945 using std::tan; 00946 using std::tanh; 00947 00948 inline float 00949 tgamma(float __x) 00950 { return __builtin_tgammaf(__x); } 00951 00952 inline long double 00953 tgamma(long double __x) 00954 { return __builtin_tgammal(__x); } 00955 00956 template<typename _Tp> 00957 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00958 double>::__type 00959 tgamma(_Tp __x) 00960 { return __builtin_tgamma(__x); } 00961 00962 inline float 00963 trunc(float __x) 00964 { return __builtin_truncf(__x); } 00965 00966 inline long double 00967 trunc(long double __x) 00968 { return __builtin_truncl(__x); } 00969 00970 template<typename _Tp> 00971 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 00972 double>::__type 00973 trunc(_Tp __x) 00974 { return __builtin_trunc(__x); } 00975 00976 #endif 00977 _GLIBCXX_END_NAMESPACE_VERSION 00978 } 00979 } 00980 00981 namespace std _GLIBCXX_VISIBILITY(default) 00982 { 00983 namespace tr1 00984 { 00985 _GLIBCXX_BEGIN_NAMESPACE_VERSION 00986 00987 // DR 550. What should the return type of pow(float,int) be? 00988 // NB: C++0x and TR1 != C++03. 00989 inline double 00990 pow(double __x, double __y) 00991 { return std::pow(__x, __y); } 00992 00993 inline float 00994 pow(float __x, float __y) 00995 { return std::pow(__x, __y); } 00996 00997 inline long double 00998 pow(long double __x, long double __y) 00999 { return std::pow(__x, __y); } 01000 01001 template<typename _Tp, typename _Up> 01002 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type 01003 pow(_Tp __x, _Up __y) 01004 { 01005 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 01006 return std::pow(__type(__x), __type(__y)); 01007 } 01008 01009 _GLIBCXX_END_NAMESPACE_VERSION 01010 } 01011 } 01012 01013 #include <bits/stl_algobase.h> 01014 #include <limits> 01015 #include <tr1/type_traits> 01016 01017 #include <tr1/gamma.tcc> 01018 #include <tr1/bessel_function.tcc> 01019 #include <tr1/beta_function.tcc> 01020 #include <tr1/ell_integral.tcc> 01021 #include <tr1/exp_integral.tcc> 01022 #include <tr1/hypergeometric.tcc> 01023 #include <tr1/legendre_function.tcc> 01024 #include <tr1/modified_bessel_func.tcc> 01025 #include <tr1/poly_hermite.tcc> 01026 #include <tr1/poly_laguerre.tcc> 01027 #include <tr1/riemann_zeta.tcc> 01028 01029 namespace std _GLIBCXX_VISIBILITY(default) 01030 { 01031 namespace tr1 01032 { 01033 _GLIBCXX_BEGIN_NAMESPACE_VERSION 01034 01035 /** 01036 * @defgroup tr1_math_spec_func Mathematical Special Functions 01037 * @ingroup numerics 01038 * 01039 * A collection of advanced mathematical special functions. 01040 * @{ 01041 */ 01042 01043 inline float 01044 assoc_laguerref(unsigned int __n, unsigned int __m, float __x) 01045 { return __detail::__assoc_laguerre<float>(__n, __m, __x); } 01046 01047 inline long double 01048 assoc_laguerrel(unsigned int __n, unsigned int __m, long double __x) 01049 { 01050 return __detail::__assoc_laguerre<long double>(__n, __m, __x); 01051 } 01052 01053 /// 5.2.1.1 Associated Laguerre polynomials. 01054 template<typename _Tp> 01055 inline typename __gnu_cxx::__promote<_Tp>::__type 01056 assoc_laguerre(unsigned int __n, unsigned int __m, _Tp __x) 01057 { 01058 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 01059 return __detail::__assoc_laguerre<__type>(__n, __m, __x); 01060 } 01061 01062 inline float 01063 assoc_legendref(unsigned int __l, unsigned int __m, float __x) 01064 { return __detail::__assoc_legendre_p<float>(__l, __m, __x); } 01065 01066 inline long double 01067 assoc_legendrel(unsigned int __l, unsigned int __m, long double __x) 01068 { return __detail::__assoc_legendre_p<long double>(__l, __m, __x); } 01069 01070 /// 5.2.1.2 Associated Legendre functions. 01071 template<typename _Tp> 01072 inline typename __gnu_cxx::__promote<_Tp>::__type 01073 assoc_legendre(unsigned int __l, unsigned int __m, _Tp __x) 01074 { 01075 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 01076 return __detail::__assoc_legendre_p<__type>(__l, __m, __x); 01077 } 01078 01079 inline float 01080 betaf(float __x, float __y) 01081 { return __detail::__beta<float>(__x, __y); } 01082 01083 inline long double 01084 betal(long double __x, long double __y) 01085 { return __detail::__beta<long double>(__x, __y); } 01086 01087 /// 5.2.1.3 Beta functions. 01088 template<typename _Tpx, typename _Tpy> 01089 inline typename __gnu_cxx::__promote_2<_Tpx, _Tpy>::__type 01090 beta(_Tpx __x, _Tpy __y) 01091 { 01092 typedef typename __gnu_cxx::__promote_2<_Tpx, _Tpy>::__type __type; 01093 return __detail::__beta<__type>(__x, __y); 01094 } 01095 01096 inline float 01097 comp_ellint_1f(float __k) 01098 { return __detail::__comp_ellint_1<float>(__k); } 01099 01100 inline long double 01101 comp_ellint_1l(long double __k) 01102 { return __detail::__comp_ellint_1<long double>(__k); } 01103 01104 /// 5.2.1.4 Complete elliptic integrals of the first kind. 01105 template<typename _Tp> 01106 inline typename __gnu_cxx::__promote<_Tp>::__type 01107 comp_ellint_1(_Tp __k) 01108 { 01109 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 01110 return __detail::__comp_ellint_1<__type>(__k); 01111 } 01112 01113 inline float 01114 comp_ellint_2f(float __k) 01115 { return __detail::__comp_ellint_2<float>(__k); } 01116 01117 inline long double 01118 comp_ellint_2l(long double __k) 01119 { return __detail::__comp_ellint_2<long double>(__k); } 01120 01121 /// 5.2.1.5 Complete elliptic integrals of the second kind. 01122 template<typename _Tp> 01123 inline typename __gnu_cxx::__promote<_Tp>::__type 01124 comp_ellint_2(_Tp __k) 01125 { 01126 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 01127 return __detail::__comp_ellint_2<__type>(__k); 01128 } 01129 01130 inline float 01131 comp_ellint_3f(float __k, float __nu) 01132 { return __detail::__comp_ellint_3<float>(__k, __nu); } 01133 01134 inline long double 01135 comp_ellint_3l(long double __k, long double __nu) 01136 { return __detail::__comp_ellint_3<long double>(__k, __nu); } 01137 01138 /// 5.2.1.6 Complete elliptic integrals of the third kind. 01139 template<typename _Tp, typename _Tpn> 01140 inline typename __gnu_cxx::__promote_2<_Tp, _Tpn>::__type 01141 comp_ellint_3(_Tp __k, _Tpn __nu) 01142 { 01143 typedef typename __gnu_cxx::__promote_2<_Tp, _Tpn>::__type __type; 01144 return __detail::__comp_ellint_3<__type>(__k, __nu); 01145 } 01146 01147 inline float 01148 conf_hypergf(float __a, float __c, float __x) 01149 { return __detail::__conf_hyperg<float>(__a, __c, __x); } 01150 01151 inline long double 01152 conf_hypergl(long double __a, long double __c, long double __x) 01153 { return __detail::__conf_hyperg<long double>(__a, __c, __x); } 01154 01155 /// 5.2.1.7 Confluent hypergeometric functions. 01156 template<typename _Tpa, typename _Tpc, typename _Tp> 01157 inline typename __gnu_cxx::__promote_3<_Tpa, _Tpc, _Tp>::__type 01158 conf_hyperg(_Tpa __a, _Tpc __c, _Tp __x) 01159 { 01160 typedef typename __gnu_cxx::__promote_3<_Tpa, _Tpc, _Tp>::__type __type; 01161 return __detail::__conf_hyperg<__type>(__a, __c, __x); 01162 } 01163 01164 inline float 01165 cyl_bessel_if(float __nu, float __x) 01166 { return __detail::__cyl_bessel_i<float>(__nu, __x); } 01167 01168 inline long double 01169 cyl_bessel_il(long double __nu, long double __x) 01170 { return __detail::__cyl_bessel_i<long double>(__nu, __x); } 01171 01172 /// 5.2.1.8 Regular modified cylindrical Bessel functions. 01173 template<typename _Tpnu, typename _Tp> 01174 inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type 01175 cyl_bessel_i(_Tpnu __nu, _Tp __x) 01176 { 01177 typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type; 01178 return __detail::__cyl_bessel_i<__type>(__nu, __x); 01179 } 01180 01181 inline float 01182 cyl_bessel_jf(float __nu, float __x) 01183 { return __detail::__cyl_bessel_j<float>(__nu, __x); } 01184 01185 inline long double 01186 cyl_bessel_jl(long double __nu, long double __x) 01187 { return __detail::__cyl_bessel_j<long double>(__nu, __x); } 01188 01189 /// 5.2.1.9 Cylindrical Bessel functions (of the first kind). 01190 template<typename _Tpnu, typename _Tp> 01191 inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type 01192 cyl_bessel_j(_Tpnu __nu, _Tp __x) 01193 { 01194 typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type; 01195 return __detail::__cyl_bessel_j<__type>(__nu, __x); 01196 } 01197 01198 inline float 01199 cyl_bessel_kf(float __nu, float __x) 01200 { return __detail::__cyl_bessel_k<float>(__nu, __x); } 01201 01202 inline long double 01203 cyl_bessel_kl(long double __nu, long double __x) 01204 { return __detail::__cyl_bessel_k<long double>(__nu, __x); } 01205 01206 /// 5.2.1.10 Irregular modified cylindrical Bessel functions. 01207 template<typename _Tpnu, typename _Tp> 01208 inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type 01209 cyl_bessel_k(_Tpnu __nu, _Tp __x) 01210 { 01211 typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type; 01212 return __detail::__cyl_bessel_k<__type>(__nu, __x); 01213 } 01214 01215 inline float 01216 cyl_neumannf(float __nu, float __x) 01217 { return __detail::__cyl_neumann_n<float>(__nu, __x); } 01218 01219 inline long double 01220 cyl_neumannl(long double __nu, long double __x) 01221 { return __detail::__cyl_neumann_n<long double>(__nu, __x); } 01222 01223 /// 5.2.1.11 Cylindrical Neumann functions. 01224 template<typename _Tpnu, typename _Tp> 01225 inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type 01226 cyl_neumann(_Tpnu __nu, _Tp __x) 01227 { 01228 typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type; 01229 return __detail::__cyl_neumann_n<__type>(__nu, __x); 01230 } 01231 01232 inline float 01233 ellint_1f(float __k, float __phi) 01234 { return __detail::__ellint_1<float>(__k, __phi); } 01235 01236 inline long double 01237 ellint_1l(long double __k, long double __phi) 01238 { return __detail::__ellint_1<long double>(__k, __phi); } 01239 01240 /// 5.2.1.12 Incomplete elliptic integrals of the first kind. 01241 template<typename _Tp, typename _Tpp> 01242 inline typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type 01243 ellint_1(_Tp __k, _Tpp __phi) 01244 { 01245 typedef typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type __type; 01246 return __detail::__ellint_1<__type>(__k, __phi); 01247 } 01248 01249 inline float 01250 ellint_2f(float __k, float __phi) 01251 { return __detail::__ellint_2<float>(__k, __phi); } 01252 01253 inline long double 01254 ellint_2l(long double __k, long double __phi) 01255 { return __detail::__ellint_2<long double>(__k, __phi); } 01256 01257 /// 5.2.1.13 Incomplete elliptic integrals of the second kind. 01258 template<typename _Tp, typename _Tpp> 01259 inline typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type 01260 ellint_2(_Tp __k, _Tpp __phi) 01261 { 01262 typedef typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type __type; 01263 return __detail::__ellint_2<__type>(__k, __phi); 01264 } 01265 01266 inline float 01267 ellint_3f(float __k, float __nu, float __phi) 01268 { return __detail::__ellint_3<float>(__k, __nu, __phi); } 01269 01270 inline long double 01271 ellint_3l(long double __k, long double __nu, long double __phi) 01272 { return __detail::__ellint_3<long double>(__k, __nu, __phi); } 01273 01274 /// 5.2.1.14 Incomplete elliptic integrals of the third kind. 01275 template<typename _Tp, typename _Tpn, typename _Tpp> 01276 inline typename __gnu_cxx::__promote_3<_Tp, _Tpn, _Tpp>::__type 01277 ellint_3(_Tp __k, _Tpn __nu, _Tpp __phi) 01278 { 01279 typedef typename __gnu_cxx::__promote_3<_Tp, _Tpn, _Tpp>::__type __type; 01280 return __detail::__ellint_3<__type>(__k, __nu, __phi); 01281 } 01282 01283 inline float 01284 expintf(float __x) 01285 { return __detail::__expint<float>(__x); } 01286 01287 inline long double 01288 expintl(long double __x) 01289 { return __detail::__expint<long double>(__x); } 01290 01291 /// 5.2.1.15 Exponential integrals. 01292 template<typename _Tp> 01293 inline typename __gnu_cxx::__promote<_Tp>::__type 01294 expint(_Tp __x) 01295 { 01296 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 01297 return __detail::__expint<__type>(__x); 01298 } 01299 01300 inline float 01301 hermitef(unsigned int __n, float __x) 01302 { return __detail::__poly_hermite<float>(__n, __x); } 01303 01304 inline long double 01305 hermitel(unsigned int __n, long double __x) 01306 { return __detail::__poly_hermite<long double>(__n, __x); } 01307 01308 /// 5.2.1.16 Hermite polynomials. 01309 template<typename _Tp> 01310 inline typename __gnu_cxx::__promote<_Tp>::__type 01311 hermite(unsigned int __n, _Tp __x) 01312 { 01313 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 01314 return __detail::__poly_hermite<__type>(__n, __x); 01315 } 01316 01317 inline float 01318 hypergf(float __a, float __b, float __c, float __x) 01319 { return __detail::__hyperg<float>(__a, __b, __c, __x); } 01320 01321 inline long double 01322 hypergl(long double __a, long double __b, long double __c, long double __x) 01323 { return __detail::__hyperg<long double>(__a, __b, __c, __x); } 01324 01325 /// 5.2.1.17 Hypergeometric functions. 01326 template<typename _Tpa, typename _Tpb, typename _Tpc, typename _Tp> 01327 inline typename __gnu_cxx::__promote_4<_Tpa, _Tpb, _Tpc, _Tp>::__type 01328 hyperg(_Tpa __a, _Tpb __b, _Tpc __c, _Tp __x) 01329 { 01330 typedef typename __gnu_cxx::__promote_4<_Tpa, _Tpb, _Tpc, _Tp>::__type __type; 01331 return __detail::__hyperg<__type>(__a, __b, __c, __x); 01332 } 01333 01334 inline float 01335 laguerref(unsigned int __n, float __x) 01336 { return __detail::__laguerre<float>(__n, __x); } 01337 01338 inline long double 01339 laguerrel(unsigned int __n, long double __x) 01340 { return __detail::__laguerre<long double>(__n, __x); } 01341 01342 /// 5.2.1.18 Laguerre polynomials. 01343 template<typename _Tp> 01344 inline typename __gnu_cxx::__promote<_Tp>::__type 01345 laguerre(unsigned int __n, _Tp __x) 01346 { 01347 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 01348 return __detail::__laguerre<__type>(__n, __x); 01349 } 01350 01351 inline float 01352 legendref(unsigned int __n, float __x) 01353 { return __detail::__poly_legendre_p<float>(__n, __x); } 01354 01355 inline long double 01356 legendrel(unsigned int __n, long double __x) 01357 { return __detail::__poly_legendre_p<long double>(__n, __x); } 01358 01359 /// 5.2.1.19 Legendre polynomials. 01360 template<typename _Tp> 01361 inline typename __gnu_cxx::__promote<_Tp>::__type 01362 legendre(unsigned int __n, _Tp __x) 01363 { 01364 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 01365 return __detail::__poly_legendre_p<__type>(__n, __x); 01366 } 01367 01368 inline float 01369 riemann_zetaf(float __x) 01370 { return __detail::__riemann_zeta<float>(__x); } 01371 01372 inline long double 01373 riemann_zetal(long double __x) 01374 { return __detail::__riemann_zeta<long double>(__x); } 01375 01376 /// 5.2.1.20 Riemann zeta function. 01377 template<typename _Tp> 01378 inline typename __gnu_cxx::__promote<_Tp>::__type 01379 riemann_zeta(_Tp __x) 01380 { 01381 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 01382 return __detail::__riemann_zeta<__type>(__x); 01383 } 01384 01385 inline float 01386 sph_besself(unsigned int __n, float __x) 01387 { return __detail::__sph_bessel<float>(__n, __x); } 01388 01389 inline long double 01390 sph_bessell(unsigned int __n, long double __x) 01391 { return __detail::__sph_bessel<long double>(__n, __x); } 01392 01393 /// 5.2.1.21 Spherical Bessel functions. 01394 template<typename _Tp> 01395 inline typename __gnu_cxx::__promote<_Tp>::__type 01396 sph_bessel(unsigned int __n, _Tp __x) 01397 { 01398 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 01399 return __detail::__sph_bessel<__type>(__n, __x); 01400 } 01401 01402 inline float 01403 sph_legendref(unsigned int __l, unsigned int __m, float __theta) 01404 { return __detail::__sph_legendre<float>(__l, __m, __theta); } 01405 01406 inline long double 01407 sph_legendrel(unsigned int __l, unsigned int __m, long double __theta) 01408 { return __detail::__sph_legendre<long double>(__l, __m, __theta); } 01409 01410 /// 5.2.1.22 Spherical associated Legendre functions. 01411 template<typename _Tp> 01412 inline typename __gnu_cxx::__promote<_Tp>::__type 01413 sph_legendre(unsigned int __l, unsigned int __m, _Tp __theta) 01414 { 01415 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 01416 return __detail::__sph_legendre<__type>(__l, __m, __theta); 01417 } 01418 01419 inline float 01420 sph_neumannf(unsigned int __n, float __x) 01421 { return __detail::__sph_neumann<float>(__n, __x); } 01422 01423 inline long double 01424 sph_neumannl(unsigned int __n, long double __x) 01425 { return __detail::__sph_neumann<long double>(__n, __x); } 01426 01427 /// 5.2.1.23 Spherical Neumann functions. 01428 template<typename _Tp> 01429 inline typename __gnu_cxx::__promote<_Tp>::__type 01430 sph_neumann(unsigned int __n, _Tp __x) 01431 { 01432 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 01433 return __detail::__sph_neumann<__type>(__n, __x); 01434 } 01435 01436 /* @} */ // tr1_math_spec_func 01437 _GLIBCXX_END_NAMESPACE_VERSION 01438 } 01439 } 01440 01441 #endif // _GLIBCXX_TR1_CMATH