libstdc++
|
00001 // TR1 cmath -*- C++ -*- 00002 00003 // Copyright (C) 2006-2018 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 _GLIBCXX_BEGIN_NAMESPACE_VERSION 00149 00150 namespace tr1 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_FP 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_FP 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_FP 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_FP 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_FP 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_FP 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_FP 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_FP 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_FP 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_FP 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_FP 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_FP 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_FP 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_FP 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_FP 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_FP 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_FP 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_FP 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_FP 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_FP 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_FP 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_FP 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_FP 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_FP 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_FP 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_FP 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_FP 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_FP 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_FP 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_FP 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_FP 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_FP 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_FP 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_FP 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 /* _GLIBCXX_USE_C99_MATH_TR1 */ 01063 01064 // DR 550. What should the return type of pow(float,int) be? 01065 // NB: C++11 and TR1 != C++03. 01066 01067 // We cannot do "using std::pow;" because that would bring in unwanted 01068 // pow(*, int) overloads in C++03, with the wrong return type. Instead we 01069 // define all the necessary overloads, but the std::tr1::pow(double, double) 01070 // overload cannot be provided here, because <tr1/math.h> would add it to 01071 // the global namespace where it would clash with ::pow(double,double) from 01072 // libc (revealed by the fix of PR c++/54537). 01073 // The solution is to forward std::tr1::pow(double,double) to 01074 // std::pow(double,double) via the function template below. See 01075 // the discussion about this issue here: 01076 // http://gcc.gnu.org/ml/gcc-patches/2012-09/msg01278.html 01077 01078 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01079 inline float 01080 pow(float __x, float __y) 01081 { return std::pow(__x, __y); } 01082 01083 inline long double 01084 pow(long double __x, long double __y) 01085 { return std::pow(__x, __y); } 01086 #endif 01087 01088 template<typename _Tp, typename _Up> 01089 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type 01090 pow(_Tp __x, _Up __y) 01091 { 01092 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; 01093 return std::pow(__type(__x), __type(__y)); 01094 } 01095 01096 #if __cplusplus >= 201103L 01097 // We also deal with fabs in a special way, because "using std::fabs;" 01098 // could bring in C++11's std::fabs<T>(const std::complex<T>&) with a 01099 // different return type from std::tr1::fabs<T>(const std::complex<T>&). 01100 // We define the necessary overloads, except std::tr1::fabs(double) which 01101 // could clash with ::fabs(double) from libc. 01102 // The function template handles double as well as integers, forwarding 01103 // to std::fabs. 01104 01105 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO 01106 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP 01107 inline float 01108 fabs(float __x) 01109 { return __builtin_fabsf(__x); } 01110 01111 inline long double 01112 fabs(long double __x) 01113 { return __builtin_fabsl(__x); } 01114 #endif 01115 #endif 01116 01117 template<typename _Tp> 01118 inline typename __gnu_cxx::__promote<_Tp>::__type 01119 fabs(_Tp __x) 01120 { return std::fabs(__x); } 01121 01122 #else // ! C++11 01123 01124 // For C++03 just use std::fabs as there is no overload for std::complex<>. 01125 using std::fabs; 01126 01127 #endif // C++11 01128 01129 #if _GLIBCXX_USE_STD_SPEC_FUNCS 01130 01131 /** 01132 * @defgroup tr1_math_spec_func Mathematical Special Functions 01133 * @ingroup numerics 01134 * 01135 * A collection of advanced mathematical special functions. 01136 * @{ 01137 */ 01138 01139 using std::assoc_laguerref; 01140 using std::assoc_laguerrel; 01141 using std::assoc_laguerre; 01142 01143 using std::assoc_legendref; 01144 using std::assoc_legendrel; 01145 using std::assoc_legendre; 01146 01147 using std::betaf; 01148 using std::betal; 01149 using std::beta; 01150 01151 using std::comp_ellint_1f; 01152 using std::comp_ellint_1l; 01153 using std::comp_ellint_1; 01154 01155 using std::comp_ellint_2f; 01156 using std::comp_ellint_2l; 01157 using std::comp_ellint_2; 01158 01159 using std::comp_ellint_3f; 01160 using std::comp_ellint_3l; 01161 using std::comp_ellint_3; 01162 01163 using std::cyl_bessel_if; 01164 using std::cyl_bessel_il; 01165 using std::cyl_bessel_i; 01166 01167 using std::cyl_bessel_jf; 01168 using std::cyl_bessel_jl; 01169 using std::cyl_bessel_j; 01170 01171 using std::cyl_bessel_kf; 01172 using std::cyl_bessel_kl; 01173 using std::cyl_bessel_k; 01174 01175 using std::cyl_neumannf; 01176 using std::cyl_neumannl; 01177 using std::cyl_neumann; 01178 01179 using std::ellint_1f; 01180 using std::ellint_1l; 01181 using std::ellint_1; 01182 01183 using std::ellint_2f; 01184 using std::ellint_2l; 01185 using std::ellint_2; 01186 01187 using std::ellint_3f; 01188 using std::ellint_3l; 01189 using std::ellint_3; 01190 01191 using std::expintf; 01192 using std::expintl; 01193 using std::expint; 01194 01195 using std::hermitef; 01196 using std::hermitel; 01197 using std::hermite; 01198 01199 using std::laguerref; 01200 using std::laguerrel; 01201 using std::laguerre; 01202 01203 using std::legendref; 01204 using std::legendrel; 01205 using std::legendre; 01206 01207 using std::riemann_zetaf; 01208 using std::riemann_zetal; 01209 using std::riemann_zeta; 01210 01211 using std::sph_besself; 01212 using std::sph_bessell; 01213 using std::sph_bessel; 01214 01215 using std::sph_legendref; 01216 using std::sph_legendrel; 01217 using std::sph_legendre; 01218 01219 using std::sph_neumannf; 01220 using std::sph_neumannl; 01221 using std::sph_neumann; 01222 01223 /* @} */ // tr1_math_spec_func 01224 01225 #else // ! _GLIBCXX_USE_STD_SPEC_FUNCS 01226 01227 } // namespace tr1 01228 01229 _GLIBCXX_END_NAMESPACE_VERSION 01230 } // namespace std 01231 01232 #include <bits/stl_algobase.h> 01233 #include <limits> 01234 #include <tr1/type_traits> 01235 01236 #include <tr1/gamma.tcc> 01237 #include <tr1/bessel_function.tcc> 01238 #include <tr1/beta_function.tcc> 01239 #include <tr1/ell_integral.tcc> 01240 #include <tr1/exp_integral.tcc> 01241 #include <tr1/legendre_function.tcc> 01242 #include <tr1/modified_bessel_func.tcc> 01243 #include <tr1/poly_hermite.tcc> 01244 #include <tr1/poly_laguerre.tcc> 01245 #include <tr1/riemann_zeta.tcc> 01246 01247 namespace std _GLIBCXX_VISIBILITY(default) 01248 { 01249 _GLIBCXX_BEGIN_NAMESPACE_VERSION 01250 01251 namespace tr1 01252 { 01253 /** 01254 * @defgroup tr1_math_spec_func Mathematical Special Functions 01255 * @ingroup numerics 01256 * 01257 * A collection of advanced mathematical special functions. 01258 * @{ 01259 */ 01260 01261 inline float 01262 assoc_laguerref(unsigned int __n, unsigned int __m, float __x) 01263 { return __detail::__assoc_laguerre<float>(__n, __m, __x); } 01264 01265 inline long double 01266 assoc_laguerrel(unsigned int __n, unsigned int __m, long double __x) 01267 { 01268 return __detail::__assoc_laguerre<long double>(__n, __m, __x); 01269 } 01270 01271 /// 5.2.1.1 Associated Laguerre polynomials. 01272 template<typename _Tp> 01273 inline typename __gnu_cxx::__promote<_Tp>::__type 01274 assoc_laguerre(unsigned int __n, unsigned int __m, _Tp __x) 01275 { 01276 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 01277 return __detail::__assoc_laguerre<__type>(__n, __m, __x); 01278 } 01279 01280 inline float 01281 assoc_legendref(unsigned int __l, unsigned int __m, float __x) 01282 { return __detail::__assoc_legendre_p<float>(__l, __m, __x); } 01283 01284 inline long double 01285 assoc_legendrel(unsigned int __l, unsigned int __m, long double __x) 01286 { return __detail::__assoc_legendre_p<long double>(__l, __m, __x); } 01287 01288 /// 5.2.1.2 Associated Legendre functions. 01289 template<typename _Tp> 01290 inline typename __gnu_cxx::__promote<_Tp>::__type 01291 assoc_legendre(unsigned int __l, unsigned int __m, _Tp __x) 01292 { 01293 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 01294 return __detail::__assoc_legendre_p<__type>(__l, __m, __x); 01295 } 01296 01297 inline float 01298 betaf(float __x, float __y) 01299 { return __detail::__beta<float>(__x, __y); } 01300 01301 inline long double 01302 betal(long double __x, long double __y) 01303 { return __detail::__beta<long double>(__x, __y); } 01304 01305 /// 5.2.1.3 Beta functions. 01306 template<typename _Tpx, typename _Tpy> 01307 inline typename __gnu_cxx::__promote_2<_Tpx, _Tpy>::__type 01308 beta(_Tpx __x, _Tpy __y) 01309 { 01310 typedef typename __gnu_cxx::__promote_2<_Tpx, _Tpy>::__type __type; 01311 return __detail::__beta<__type>(__x, __y); 01312 } 01313 01314 inline float 01315 comp_ellint_1f(float __k) 01316 { return __detail::__comp_ellint_1<float>(__k); } 01317 01318 inline long double 01319 comp_ellint_1l(long double __k) 01320 { return __detail::__comp_ellint_1<long double>(__k); } 01321 01322 /// 5.2.1.4 Complete elliptic integrals of the first kind. 01323 template<typename _Tp> 01324 inline typename __gnu_cxx::__promote<_Tp>::__type 01325 comp_ellint_1(_Tp __k) 01326 { 01327 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 01328 return __detail::__comp_ellint_1<__type>(__k); 01329 } 01330 01331 inline float 01332 comp_ellint_2f(float __k) 01333 { return __detail::__comp_ellint_2<float>(__k); } 01334 01335 inline long double 01336 comp_ellint_2l(long double __k) 01337 { return __detail::__comp_ellint_2<long double>(__k); } 01338 01339 /// 5.2.1.5 Complete elliptic integrals of the second kind. 01340 template<typename _Tp> 01341 inline typename __gnu_cxx::__promote<_Tp>::__type 01342 comp_ellint_2(_Tp __k) 01343 { 01344 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 01345 return __detail::__comp_ellint_2<__type>(__k); 01346 } 01347 01348 inline float 01349 comp_ellint_3f(float __k, float __nu) 01350 { return __detail::__comp_ellint_3<float>(__k, __nu); } 01351 01352 inline long double 01353 comp_ellint_3l(long double __k, long double __nu) 01354 { return __detail::__comp_ellint_3<long double>(__k, __nu); } 01355 01356 /// 5.2.1.6 Complete elliptic integrals of the third kind. 01357 template<typename _Tp, typename _Tpn> 01358 inline typename __gnu_cxx::__promote_2<_Tp, _Tpn>::__type 01359 comp_ellint_3(_Tp __k, _Tpn __nu) 01360 { 01361 typedef typename __gnu_cxx::__promote_2<_Tp, _Tpn>::__type __type; 01362 return __detail::__comp_ellint_3<__type>(__k, __nu); 01363 } 01364 01365 inline float 01366 cyl_bessel_if(float __nu, float __x) 01367 { return __detail::__cyl_bessel_i<float>(__nu, __x); } 01368 01369 inline long double 01370 cyl_bessel_il(long double __nu, long double __x) 01371 { return __detail::__cyl_bessel_i<long double>(__nu, __x); } 01372 01373 /// 5.2.1.8 Regular modified cylindrical Bessel functions. 01374 template<typename _Tpnu, typename _Tp> 01375 inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type 01376 cyl_bessel_i(_Tpnu __nu, _Tp __x) 01377 { 01378 typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type; 01379 return __detail::__cyl_bessel_i<__type>(__nu, __x); 01380 } 01381 01382 inline float 01383 cyl_bessel_jf(float __nu, float __x) 01384 { return __detail::__cyl_bessel_j<float>(__nu, __x); } 01385 01386 inline long double 01387 cyl_bessel_jl(long double __nu, long double __x) 01388 { return __detail::__cyl_bessel_j<long double>(__nu, __x); } 01389 01390 /// 5.2.1.9 Cylindrical Bessel functions (of the first kind). 01391 template<typename _Tpnu, typename _Tp> 01392 inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type 01393 cyl_bessel_j(_Tpnu __nu, _Tp __x) 01394 { 01395 typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type; 01396 return __detail::__cyl_bessel_j<__type>(__nu, __x); 01397 } 01398 01399 inline float 01400 cyl_bessel_kf(float __nu, float __x) 01401 { return __detail::__cyl_bessel_k<float>(__nu, __x); } 01402 01403 inline long double 01404 cyl_bessel_kl(long double __nu, long double __x) 01405 { return __detail::__cyl_bessel_k<long double>(__nu, __x); } 01406 01407 /// 5.2.1.10 Irregular modified cylindrical Bessel functions. 01408 template<typename _Tpnu, typename _Tp> 01409 inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type 01410 cyl_bessel_k(_Tpnu __nu, _Tp __x) 01411 { 01412 typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type; 01413 return __detail::__cyl_bessel_k<__type>(__nu, __x); 01414 } 01415 01416 inline float 01417 cyl_neumannf(float __nu, float __x) 01418 { return __detail::__cyl_neumann_n<float>(__nu, __x); } 01419 01420 inline long double 01421 cyl_neumannl(long double __nu, long double __x) 01422 { return __detail::__cyl_neumann_n<long double>(__nu, __x); } 01423 01424 /// 5.2.1.11 Cylindrical Neumann functions. 01425 template<typename _Tpnu, typename _Tp> 01426 inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type 01427 cyl_neumann(_Tpnu __nu, _Tp __x) 01428 { 01429 typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type; 01430 return __detail::__cyl_neumann_n<__type>(__nu, __x); 01431 } 01432 01433 inline float 01434 ellint_1f(float __k, float __phi) 01435 { return __detail::__ellint_1<float>(__k, __phi); } 01436 01437 inline long double 01438 ellint_1l(long double __k, long double __phi) 01439 { return __detail::__ellint_1<long double>(__k, __phi); } 01440 01441 /// 5.2.1.12 Incomplete elliptic integrals of the first kind. 01442 template<typename _Tp, typename _Tpp> 01443 inline typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type 01444 ellint_1(_Tp __k, _Tpp __phi) 01445 { 01446 typedef typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type __type; 01447 return __detail::__ellint_1<__type>(__k, __phi); 01448 } 01449 01450 inline float 01451 ellint_2f(float __k, float __phi) 01452 { return __detail::__ellint_2<float>(__k, __phi); } 01453 01454 inline long double 01455 ellint_2l(long double __k, long double __phi) 01456 { return __detail::__ellint_2<long double>(__k, __phi); } 01457 01458 /// 5.2.1.13 Incomplete elliptic integrals of the second kind. 01459 template<typename _Tp, typename _Tpp> 01460 inline typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type 01461 ellint_2(_Tp __k, _Tpp __phi) 01462 { 01463 typedef typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type __type; 01464 return __detail::__ellint_2<__type>(__k, __phi); 01465 } 01466 01467 inline float 01468 ellint_3f(float __k, float __nu, float __phi) 01469 { return __detail::__ellint_3<float>(__k, __nu, __phi); } 01470 01471 inline long double 01472 ellint_3l(long double __k, long double __nu, long double __phi) 01473 { return __detail::__ellint_3<long double>(__k, __nu, __phi); } 01474 01475 /// 5.2.1.14 Incomplete elliptic integrals of the third kind. 01476 template<typename _Tp, typename _Tpn, typename _Tpp> 01477 inline typename __gnu_cxx::__promote_3<_Tp, _Tpn, _Tpp>::__type 01478 ellint_3(_Tp __k, _Tpn __nu, _Tpp __phi) 01479 { 01480 typedef typename __gnu_cxx::__promote_3<_Tp, _Tpn, _Tpp>::__type __type; 01481 return __detail::__ellint_3<__type>(__k, __nu, __phi); 01482 } 01483 01484 inline float 01485 expintf(float __x) 01486 { return __detail::__expint<float>(__x); } 01487 01488 inline long double 01489 expintl(long double __x) 01490 { return __detail::__expint<long double>(__x); } 01491 01492 /// 5.2.1.15 Exponential integrals. 01493 template<typename _Tp> 01494 inline typename __gnu_cxx::__promote<_Tp>::__type 01495 expint(_Tp __x) 01496 { 01497 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 01498 return __detail::__expint<__type>(__x); 01499 } 01500 01501 inline float 01502 hermitef(unsigned int __n, float __x) 01503 { return __detail::__poly_hermite<float>(__n, __x); } 01504 01505 inline long double 01506 hermitel(unsigned int __n, long double __x) 01507 { return __detail::__poly_hermite<long double>(__n, __x); } 01508 01509 /// 5.2.1.16 Hermite polynomials. 01510 template<typename _Tp> 01511 inline typename __gnu_cxx::__promote<_Tp>::__type 01512 hermite(unsigned int __n, _Tp __x) 01513 { 01514 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 01515 return __detail::__poly_hermite<__type>(__n, __x); 01516 } 01517 01518 inline float 01519 laguerref(unsigned int __n, float __x) 01520 { return __detail::__laguerre<float>(__n, __x); } 01521 01522 inline long double 01523 laguerrel(unsigned int __n, long double __x) 01524 { return __detail::__laguerre<long double>(__n, __x); } 01525 01526 /// 5.2.1.18 Laguerre polynomials. 01527 template<typename _Tp> 01528 inline typename __gnu_cxx::__promote<_Tp>::__type 01529 laguerre(unsigned int __n, _Tp __x) 01530 { 01531 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 01532 return __detail::__laguerre<__type>(__n, __x); 01533 } 01534 01535 inline float 01536 legendref(unsigned int __n, float __x) 01537 { return __detail::__poly_legendre_p<float>(__n, __x); } 01538 01539 inline long double 01540 legendrel(unsigned int __n, long double __x) 01541 { return __detail::__poly_legendre_p<long double>(__n, __x); } 01542 01543 /// 5.2.1.19 Legendre polynomials. 01544 template<typename _Tp> 01545 inline typename __gnu_cxx::__promote<_Tp>::__type 01546 legendre(unsigned int __n, _Tp __x) 01547 { 01548 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 01549 return __detail::__poly_legendre_p<__type>(__n, __x); 01550 } 01551 01552 inline float 01553 riemann_zetaf(float __x) 01554 { return __detail::__riemann_zeta<float>(__x); } 01555 01556 inline long double 01557 riemann_zetal(long double __x) 01558 { return __detail::__riemann_zeta<long double>(__x); } 01559 01560 /// 5.2.1.20 Riemann zeta function. 01561 template<typename _Tp> 01562 inline typename __gnu_cxx::__promote<_Tp>::__type 01563 riemann_zeta(_Tp __x) 01564 { 01565 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 01566 return __detail::__riemann_zeta<__type>(__x); 01567 } 01568 01569 inline float 01570 sph_besself(unsigned int __n, float __x) 01571 { return __detail::__sph_bessel<float>(__n, __x); } 01572 01573 inline long double 01574 sph_bessell(unsigned int __n, long double __x) 01575 { return __detail::__sph_bessel<long double>(__n, __x); } 01576 01577 /// 5.2.1.21 Spherical Bessel functions. 01578 template<typename _Tp> 01579 inline typename __gnu_cxx::__promote<_Tp>::__type 01580 sph_bessel(unsigned int __n, _Tp __x) 01581 { 01582 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 01583 return __detail::__sph_bessel<__type>(__n, __x); 01584 } 01585 01586 inline float 01587 sph_legendref(unsigned int __l, unsigned int __m, float __theta) 01588 { return __detail::__sph_legendre<float>(__l, __m, __theta); } 01589 01590 inline long double 01591 sph_legendrel(unsigned int __l, unsigned int __m, long double __theta) 01592 { return __detail::__sph_legendre<long double>(__l, __m, __theta); } 01593 01594 /// 5.2.1.22 Spherical associated Legendre functions. 01595 template<typename _Tp> 01596 inline typename __gnu_cxx::__promote<_Tp>::__type 01597 sph_legendre(unsigned int __l, unsigned int __m, _Tp __theta) 01598 { 01599 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 01600 return __detail::__sph_legendre<__type>(__l, __m, __theta); 01601 } 01602 01603 inline float 01604 sph_neumannf(unsigned int __n, float __x) 01605 { return __detail::__sph_neumann<float>(__n, __x); } 01606 01607 inline long double 01608 sph_neumannl(unsigned int __n, long double __x) 01609 { return __detail::__sph_neumann<long double>(__n, __x); } 01610 01611 /// 5.2.1.23 Spherical Neumann functions. 01612 template<typename _Tp> 01613 inline typename __gnu_cxx::__promote<_Tp>::__type 01614 sph_neumann(unsigned int __n, _Tp __x) 01615 { 01616 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; 01617 return __detail::__sph_neumann<__type>(__n, __x); 01618 } 01619 01620 /* @} */ // tr1_math_spec_func 01621 #endif // _GLIBCXX_USE_STD_SPEC_FUNCS 01622 01623 } // namespace tr1 01624 01625 _GLIBCXX_END_NAMESPACE_VERSION 01626 } // namespace std 01627 01628 #if _GLIBCXX_USE_STD_SPEC_FUNCS && !defined(__STRICT_ANSI__) 01629 namespace std _GLIBCXX_VISIBILITY(default) 01630 { 01631 _GLIBCXX_BEGIN_NAMESPACE_VERSION 01632 01633 namespace tr1 01634 { 01635 using __gnu_cxx::conf_hypergf; 01636 using __gnu_cxx::conf_hypergl; 01637 using __gnu_cxx::conf_hyperg; 01638 01639 using __gnu_cxx::hypergf; 01640 using __gnu_cxx::hypergl; 01641 using __gnu_cxx::hyperg; 01642 } // namespace tr1 01643 01644 _GLIBCXX_END_NAMESPACE_VERSION 01645 } // namespace std 01646 01647 #else // ! (_GLIBCXX_USE_STD_SPEC_FUNCS && !defined(__STRICT_ANSI__)) 01648 01649 #include <bits/stl_algobase.h> 01650 #include <limits> 01651 #include <tr1/type_traits> 01652 01653 #include <tr1/hypergeometric.tcc> 01654 01655 namespace std _GLIBCXX_VISIBILITY(default) 01656 { 01657 _GLIBCXX_BEGIN_NAMESPACE_VERSION 01658 01659 namespace tr1 01660 { 01661 inline float 01662 conf_hypergf(float __a, float __c, float __x) 01663 { return __detail::__conf_hyperg<float>(__a, __c, __x); } 01664 01665 inline long double 01666 conf_hypergl(long double __a, long double __c, long double __x) 01667 { return __detail::__conf_hyperg<long double>(__a, __c, __x); } 01668 01669 /// 5.2.1.7 Confluent hypergeometric functions. 01670 template<typename _Tpa, typename _Tpc, typename _Tp> 01671 inline typename __gnu_cxx::__promote_3<_Tpa, _Tpc, _Tp>::__type 01672 conf_hyperg(_Tpa __a, _Tpc __c, _Tp __x) 01673 { 01674 typedef typename __gnu_cxx::__promote_3<_Tpa, _Tpc, _Tp>::__type __type; 01675 return __detail::__conf_hyperg<__type>(__a, __c, __x); 01676 } 01677 01678 inline float 01679 hypergf(float __a, float __b, float __c, float __x) 01680 { return __detail::__hyperg<float>(__a, __b, __c, __x); } 01681 01682 inline long double 01683 hypergl(long double __a, long double __b, long double __c, long double __x) 01684 { return __detail::__hyperg<long double>(__a, __b, __c, __x); } 01685 01686 /// 5.2.1.17 Hypergeometric functions. 01687 template<typename _Tpa, typename _Tpb, typename _Tpc, typename _Tp> 01688 inline typename __gnu_cxx::__promote_4<_Tpa, _Tpb, _Tpc, _Tp>::__type 01689 hyperg(_Tpa __a, _Tpb __b, _Tpc __c, _Tp __x) 01690 { 01691 typedef typename __gnu_cxx::__promote_4<_Tpa, _Tpb, _Tpc, _Tp>::__type __type; 01692 return __detail::__hyperg<__type>(__a, __b, __c, __x); 01693 } 01694 01695 } // namespace tr1 01696 01697 _GLIBCXX_END_NAMESPACE_VERSION 01698 } // namespace std 01699 #endif // _GLIBCXX_USE_STD_SPEC_FUNCS && !defined(__STRICT_ANSI__) 01700 01701 #endif // _GLIBCXX_TR1_CMATH