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