diff options
author | Ed Smith-Rowland <3dw4rd@verizon.net> | 2013-06-13 03:04:58 +0000 |
---|---|---|
committer | Edward Smith-Rowland <emsr@gcc.gnu.org> | 2013-06-13 03:04:58 +0000 |
commit | bcc193bf4616b02f5b8869fee13c34cf1d8984e8 (patch) | |
tree | 4ee8430b2647bf2a5ffa74912381b4745ae53906 /libstdc++-v3/include | |
parent | 5665a4daaf486c3b2d30708aff577e3169146249 (diff) | |
download | gcc-bcc193bf4616b02f5b8869fee13c34cf1d8984e8.zip gcc-bcc193bf4616b02f5b8869fee13c34cf1d8984e8.tar.gz gcc-bcc193bf4616b02f5b8869fee13c34cf1d8984e8.tar.bz2 |
re PR libstdc++/56430 (In __airy: return-statement with a value, in function returning 'void'.)
2013-06-12 Ed Smith-Rowland <3dw4rd@verizon.net>
PR libstdc++/56430
* include/tr1/modified_bessel_func.tcc (__airy): Remove return
from void function.
(__gnu_cxx::__airy_ai(), __gnu_cxx::__airy_bi()): New functions.
* testsuite/tr1/5_numerical_facilities/special_functions/
10_cyl_bessel_k/airy.cc: New.
From-SVN: r200054
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r-- | libstdc++-v3/include/tr1/modified_bessel_func.tcc | 62 |
1 files changed, 54 insertions, 8 deletions
diff --git a/libstdc++-v3/include/tr1/modified_bessel_func.tcc b/libstdc++-v3/include/tr1/modified_bessel_func.tcc index 3d1fb90..830bf16 100644 --- a/libstdc++-v3/include/tr1/modified_bessel_func.tcc +++ b/libstdc++-v3/include/tr1/modified_bessel_func.tcc @@ -357,12 +357,13 @@ namespace tr1 * derivatives @f$ Ai'(x) @f$ and @f$ Bi(x) @f$ * respectively. * - * @param __n The order of the Airy functions. * @param __x The argument of the Airy functions. - * @param __i_n The output Airy function. - * @param __k_n The output Airy function. - * @param __ip_n The output derivative of the Airy function. - * @param __kp_n The output derivative of the Airy function. + * @param __Ai The output Airy function of the first kind. + * @param __Bi The output Airy function of the second kind. + * @param __Aip The output derivative of the Airy function + * of the first kind. + * @param __Bip The output derivative of the Airy function + * of the second kind. */ template <typename _Tp> void @@ -372,9 +373,7 @@ namespace tr1 const _Tp __rootx = std::sqrt(__absx); const _Tp __z = _Tp(2) * __absx * __rootx / _Tp(3); - if (__isnan(__x)) - return std::numeric_limits<_Tp>::quiet_NaN(); - else if (__x > _Tp(0)) + if (__x > _Tp(0)) { _Tp __I_nu, __Ip_nu, __K_nu, __Kp_nu; @@ -432,4 +431,51 @@ namespace tr1 } } + +namespace __gnu_cxx +{ + + /** + * @brief Compute the Airy function of the first kind @f$ Ai(x) @f$. + * + * @param __x The argument of the Airy function. + * @return The Airy function of the first kind at x. + */ + template<typename _Tp> + _Tp + __airy_ai(_Tp __x) + { + if (__isnan(__x)) + return std::numeric_limits<_Tp>::quiet_NaN(); + else + { + _Tp __Ai, __Bi, __Aip, __Bip; + std::tr1::__detail::__airy(__x, __Ai, __Bi, __Aip, __Bip); + return __Ai; + } + } + + + /** + * @brief Compute the Airy function of the second kind @f$ Bi(x) @f$. + * + * @param __x The argument of the Airy function. + * @return The Airy function of the second kind at x. + */ + template<typename _Tp> + _Tp + __airy_bi(_Tp __x) + { + if (__isnan(__x)) + return std::numeric_limits<_Tp>::quiet_NaN(); + else + { + _Tp __Ai, __Bi, __Aip, __Bip; + std::tr1::__detail::__airy(__x, __Ai, __Bi, __Aip, __Bip); + return __Bi; + } + } + +} // namespace __gnu_cxx + #endif // _GLIBCXX_TR1_MODIFIED_BESSEL_FUNC_TCC |