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
This commit is contained in:
Ed Smith-Rowland 2013-06-13 03:04:58 +00:00 committed by Edward Smith-Rowland
parent 5665a4daaf
commit bcc193bf46
3 changed files with 100 additions and 8 deletions

View File

@ -1,3 +1,12 @@
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.
2013-06-11 Ed Smith-Rowland <3dw4rd@verizon.net>
Fix library literals error involving namespace __detail.

View File

@ -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

View File

@ -0,0 +1,37 @@
// { dg-do compile }
// 2013-02-13 Edward Smith-Rowland <3dw4rd@verizon.net>
//
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// PR libstdc++/56430 - In __airy: return-statement with a value,
// in function returning 'void'.
#include <tr1/cmath>
int
test01()
{
bool test __attribute__((unused)) = true;
double x, Ai, Bi, Aip, Bip;
x = 1.0;
std::tr1::__detail::__airy(x, Ai, Bi, Aip, Bip);
double Ai2 = __gnu_cxx::__airy_ai(x);
double Bi2 = __gnu_cxx::__airy_bi(x);
}