Implement TR29124 C++ special Math Functions.

2016-01-14  Edward Smith-Rowland  <3dw4rd@verizon.net>
	    Jonathan Wakely  <jwakely@redhat.com>
	    Florian Goth <CaptainSifff@gmx.de>

	Implement TR29124 C++ special Math Functions.
	* include/Makefile.am: Add new headers.
	* include/Makefile.in: Regenerate.
	* include/bits/specfun.h: New.
	* include/c_global/cmath: Adjust for both tr1 and tr29124 maths.
	* include/tr1/bessel_function.tcc: Ditto.
	* include/tr1/beta_function.tcc: Ditto.
	* include/tr1/cmath: Ditto.
	* include/tr1/ell_integral.tcc: Ditto.
	* include/tr1/exp_integral.tcc: Ditto.
	* include/tr1/gamma.tcc: Ditto.
	* include/tr1/hypergeometric.tcc: Ditto.
	* include/tr1/legendre_function.tcc: Ditto.
	* include/tr1/modified_bessel_func.tcc: Ditto.
	* include/tr1/poly_hermite.tcc: Ditto.
	* include/tr1/poly_laguerre.tcc: Ditto.
	* include/tr1/riemann_zeta.tcc: Ditto.
	* include/tr1/special_function_util.h: Ditto.
	* testsuite/ext/special_functions/conf_hyperg: New.
	* testsuite/ext/special_functions/conf_hyperg/check_nan.cc: New.
	* testsuite/ext/special_functions/conf_hyperg/check_value.cc: New.
	* testsuite/ext/special_functions/conf_hyperg/compile.cc: New.
	* testsuite/ext/special_functions/hyperg: New.
	* testsuite/ext/special_functions/hyperg/check_nan.cc: New.
	* testsuite/ext/special_functions/hyperg/check_value.cc: New.
	* testsuite/ext/special_functions/hyperg/compile.cc: New.
	* testsuite/libstdc++-dg/conformance.exp: Add special_functions directory.
	* testsuite/special_functions/01_assoc_laguerre/check_nan.cc: New.
	* testsuite/special_functions/01_assoc_laguerre/check_value.cc: New.
	* testsuite/special_functions/01_assoc_laguerre/compile.cc: New.
	* testsuite/special_functions/01_assoc_laguerre/compile_2.cc: New.
	* testsuite/special_functions/02_assoc_legendre/check_nan.cc: New.
	* testsuite/special_functions/02_assoc_legendre/check_value.cc: New.
	* testsuite/special_functions/02_assoc_legendre/compile.cc: New.
	* testsuite/special_functions/02_assoc_legendre/compile_2.cc: New.
	* testsuite/special_functions/03_beta/check_nan.cc: New.
	* testsuite/special_functions/03_beta/check_value.cc: New.
	* testsuite/special_functions/03_beta/compile.cc: New.
	* testsuite/special_functions/03_beta/compile_2.cc: New.
	* testsuite/special_functions/04_comp_ellint_1/check_nan.cc: New.
	* testsuite/special_functions/04_comp_ellint_1/check_value.cc: New.
	* testsuite/special_functions/04_comp_ellint_1/compile.cc: New.
	* testsuite/special_functions/04_comp_ellint_1/compile_2.cc: New.
	* testsuite/special_functions/05_comp_ellint_2/check_nan.cc: New.
	* testsuite/special_functions/05_comp_ellint_2/check_value.cc: New.
	* testsuite/special_functions/05_comp_ellint_2/compile.cc: New.
	* testsuite/special_functions/05_comp_ellint_2/compile_2.cc: New.
	* testsuite/special_functions/06_comp_ellint_3/check_nan.cc: New.
	* testsuite/special_functions/06_comp_ellint_3/check_value.cc: New.
	* testsuite/special_functions/06_comp_ellint_3/compile.cc: New.
	* testsuite/special_functions/06_comp_ellint_3/compile_2.cc: New.
	* testsuite/special_functions/07_cyl_bessel_i/check_nan.cc: New.
	* testsuite/special_functions/07_cyl_bessel_i/check_value.cc: New.
	* testsuite/special_functions/07_cyl_bessel_i/compile.cc: New.
	* testsuite/special_functions/07_cyl_bessel_i/compile_2.cc: New.
	* testsuite/special_functions/07_cyl_bessel_i/pr56216.cc: New.
	* testsuite/special_functions/08_cyl_bessel_j/check_nan.cc: New.
	* testsuite/special_functions/08_cyl_bessel_j/check_value.cc: New.
	* testsuite/special_functions/08_cyl_bessel_j/compile.cc: New.
	* testsuite/special_functions/08_cyl_bessel_j/compile_2.cc: New.
	* testsuite/special_functions/09_cyl_bessel_k/check_nan.cc: New.
	* testsuite/special_functions/09_cyl_bessel_k/check_value.cc: New.
	* testsuite/special_functions/09_cyl_bessel_k/compile.cc: New.
	* testsuite/special_functions/09_cyl_bessel_k/compile_2.cc: New.
	* testsuite/special_functions/10_cyl_neumann/check_nan.cc: New.
	* testsuite/special_functions/10_cyl_neumann/check_value.cc: New.
	* testsuite/special_functions/10_cyl_neumann/compile.cc: New.
	* testsuite/special_functions/10_cyl_neumann/compile_2.cc: New.
	* testsuite/special_functions/11_ellint_1/check_nan.cc: New.
	* testsuite/special_functions/11_ellint_1/check_value.cc: New.
	* testsuite/special_functions/11_ellint_1/compile.cc: New.
	* testsuite/special_functions/11_ellint_1/compile_2.cc: New.
	* testsuite/special_functions/12_ellint_2/check_nan.cc: New.
	* testsuite/special_functions/12_ellint_2/check_value.cc: New.
	* testsuite/special_functions/12_ellint_2/compile.cc: New.
	* testsuite/special_functions/12_ellint_2/compile_2.cc: New.
	* testsuite/special_functions/13_ellint_3/check_nan.cc: New.
	* testsuite/special_functions/13_ellint_3/check_value.cc: New.
	* testsuite/special_functions/13_ellint_3/compile.cc: New.
	* testsuite/special_functions/13_ellint_3/compile_2.cc: New.
	* testsuite/special_functions/14_expint/check_nan.cc: New.
	* testsuite/special_functions/14_expint/check_value.cc: New.
	* testsuite/special_functions/14_expint/compile.cc: New.
	* testsuite/special_functions/14_expint/compile_2.cc: New.
	* testsuite/special_functions/15_hermite/check_nan.cc: New.
	* testsuite/special_functions/15_hermite/check_value.cc: New.
	* testsuite/special_functions/15_hermite/compile.cc: New.
	* testsuite/special_functions/15_hermite/compile_2.cc: New.
	* testsuite/special_functions/16_laguerre/check_nan.cc: New.
	* testsuite/special_functions/16_laguerre/check_value.cc: New.
	* testsuite/special_functions/16_laguerre/compile.cc: New.
	* testsuite/special_functions/16_laguerre/compile_2.cc: New.
	* testsuite/special_functions/17_legendre/check_nan.cc: New.
	* testsuite/special_functions/17_legendre/check_value.cc: New.
	* testsuite/special_functions/17_legendre/compile.cc: New.
	* testsuite/special_functions/17_legendre/compile_2.cc: New.
	* testsuite/special_functions/18_riemann_zeta/check_nan.cc: New.
	* testsuite/special_functions/18_riemann_zeta/check_value.cc: New.
	* testsuite/special_functions/18_riemann_zeta/compile.cc: New.
	* testsuite/special_functions/18_riemann_zeta/compile_2.cc: New.
	* testsuite/special_functions/19_sph_bessel/check_nan.cc: New.
	* testsuite/special_functions/19_sph_bessel/check_value.cc: New.
	* testsuite/special_functions/19_sph_bessel/compile.cc: New.
	* testsuite/special_functions/19_sph_bessel/compile_2.cc: New.
	* testsuite/special_functions/20_sph_legendre/check_nan.cc: New.
	* testsuite/special_functions/20_sph_legendre/check_value.cc: New.
	* testsuite/special_functions/20_sph_legendre/compile.cc: New.
	* testsuite/special_functions/20_sph_legendre/compile_2.cc: New.
	* testsuite/special_functions/21_sph_neumann/check_nan.cc: New.
	* testsuite/special_functions/21_sph_neumann/check_value.cc: New.
	* testsuite/special_functions/21_sph_neumann/compile.cc: New.
	* testsuite/special_functions/21_sph_neumann/compile_2.cc: New.
	* testsuite/util/specfun_testcase.h: New.
	* testsuite/tr1/5_numerical_facilities/special_functions/08_cyl_bessel_i/check_value.cc: More testcases.
	* testsuite/tr1/5_numerical_facilities/special_functions/09_cyl_bessel_j/check_value.cc: Ditto.
	* testsuite/tr1/5_numerical_facilities/special_functions/10_cyl_bessel_k/check_value.cc: Ditto.
	* testsuite/tr1/5_numerical_facilities/special_functions/11_cyl_neumann/check_value.cc: Ditto.
	* testsuite/tr1/5_numerical_facilities/special_functions/21_sph_bessel/check_value.cc: Ditto.
	* testsuite/tr1/5_numerical_facilities/special_functions/23_sph_neumann/check_value.cc: Ditto.
	* testsuite/tr1/5_numerical_facilities/special_functions/16_hermite/check_value.cc: New.


Co-Authored-By: Florian Goth <CaptainSifff@gmx.de>
Co-Authored-By: Jonathan Wakely <jwakely@redhat.com>

From-SVN: r232377
This commit is contained in:
Edward Smith-Rowland 2016-01-14 18:12:43 +00:00 committed by Edward Smith-Rowland
parent 00083992a6
commit 2be75957b8
119 changed files with 48248 additions and 2305 deletions

View File

@ -1,3 +1,128 @@
2016-01-14 Edward Smith-Rowland <3dw4rd@verizon.net>
Jonathan Wakely <jwakely@redhat.com>
Florian Goth <CaptainSifff@gmx.de>
Implement TR29124 C++ special Math Functions.
* include/Makefile.am: Add new headers.
* include/Makefile.in: Regenerate.
* include/bits/specfun.h: New.
* include/c_global/cmath: Adjust for both tr1 and tr29124 maths.
* include/tr1/bessel_function.tcc: Ditto.
* include/tr1/beta_function.tcc: Ditto.
* include/tr1/cmath: Ditto.
* include/tr1/ell_integral.tcc: Ditto.
* include/tr1/exp_integral.tcc: Ditto.
* include/tr1/gamma.tcc: Ditto.
* include/tr1/hypergeometric.tcc: Ditto.
* include/tr1/legendre_function.tcc: Ditto.
* include/tr1/modified_bessel_func.tcc: Ditto.
* include/tr1/poly_hermite.tcc: Ditto.
* include/tr1/poly_laguerre.tcc: Ditto.
* include/tr1/riemann_zeta.tcc: Ditto.
* include/tr1/special_function_util.h: Ditto.
* testsuite/ext/special_functions/conf_hyperg: New.
* testsuite/ext/special_functions/conf_hyperg/check_nan.cc: New.
* testsuite/ext/special_functions/conf_hyperg/check_value.cc: New.
* testsuite/ext/special_functions/conf_hyperg/compile.cc: New.
* testsuite/ext/special_functions/hyperg: New.
* testsuite/ext/special_functions/hyperg/check_nan.cc: New.
* testsuite/ext/special_functions/hyperg/check_value.cc: New.
* testsuite/ext/special_functions/hyperg/compile.cc: New.
* testsuite/libstdc++-dg/conformance.exp: Add special_functions directory.
* testsuite/special_functions/01_assoc_laguerre/check_nan.cc: New.
* testsuite/special_functions/01_assoc_laguerre/check_value.cc: New.
* testsuite/special_functions/01_assoc_laguerre/compile.cc: New.
* testsuite/special_functions/01_assoc_laguerre/compile_2.cc: New.
* testsuite/special_functions/02_assoc_legendre/check_nan.cc: New.
* testsuite/special_functions/02_assoc_legendre/check_value.cc: New.
* testsuite/special_functions/02_assoc_legendre/compile.cc: New.
* testsuite/special_functions/02_assoc_legendre/compile_2.cc: New.
* testsuite/special_functions/03_beta/check_nan.cc: New.
* testsuite/special_functions/03_beta/check_value.cc: New.
* testsuite/special_functions/03_beta/compile.cc: New.
* testsuite/special_functions/03_beta/compile_2.cc: New.
* testsuite/special_functions/04_comp_ellint_1/check_nan.cc: New.
* testsuite/special_functions/04_comp_ellint_1/check_value.cc: New.
* testsuite/special_functions/04_comp_ellint_1/compile.cc: New.
* testsuite/special_functions/04_comp_ellint_1/compile_2.cc: New.
* testsuite/special_functions/05_comp_ellint_2/check_nan.cc: New.
* testsuite/special_functions/05_comp_ellint_2/check_value.cc: New.
* testsuite/special_functions/05_comp_ellint_2/compile.cc: New.
* testsuite/special_functions/05_comp_ellint_2/compile_2.cc: New.
* testsuite/special_functions/06_comp_ellint_3/check_nan.cc: New.
* testsuite/special_functions/06_comp_ellint_3/check_value.cc: New.
* testsuite/special_functions/06_comp_ellint_3/compile.cc: New.
* testsuite/special_functions/06_comp_ellint_3/compile_2.cc: New.
* testsuite/special_functions/07_cyl_bessel_i/check_nan.cc: New.
* testsuite/special_functions/07_cyl_bessel_i/check_value.cc: New.
* testsuite/special_functions/07_cyl_bessel_i/compile.cc: New.
* testsuite/special_functions/07_cyl_bessel_i/compile_2.cc: New.
* testsuite/special_functions/07_cyl_bessel_i/pr56216.cc: New.
* testsuite/special_functions/08_cyl_bessel_j/check_nan.cc: New.
* testsuite/special_functions/08_cyl_bessel_j/check_value.cc: New.
* testsuite/special_functions/08_cyl_bessel_j/compile.cc: New.
* testsuite/special_functions/08_cyl_bessel_j/compile_2.cc: New.
* testsuite/special_functions/09_cyl_bessel_k/check_nan.cc: New.
* testsuite/special_functions/09_cyl_bessel_k/check_value.cc: New.
* testsuite/special_functions/09_cyl_bessel_k/compile.cc: New.
* testsuite/special_functions/09_cyl_bessel_k/compile_2.cc: New.
* testsuite/special_functions/10_cyl_neumann/check_nan.cc: New.
* testsuite/special_functions/10_cyl_neumann/check_value.cc: New.
* testsuite/special_functions/10_cyl_neumann/compile.cc: New.
* testsuite/special_functions/10_cyl_neumann/compile_2.cc: New.
* testsuite/special_functions/11_ellint_1/check_nan.cc: New.
* testsuite/special_functions/11_ellint_1/check_value.cc: New.
* testsuite/special_functions/11_ellint_1/compile.cc: New.
* testsuite/special_functions/11_ellint_1/compile_2.cc: New.
* testsuite/special_functions/12_ellint_2/check_nan.cc: New.
* testsuite/special_functions/12_ellint_2/check_value.cc: New.
* testsuite/special_functions/12_ellint_2/compile.cc: New.
* testsuite/special_functions/12_ellint_2/compile_2.cc: New.
* testsuite/special_functions/13_ellint_3/check_nan.cc: New.
* testsuite/special_functions/13_ellint_3/check_value.cc: New.
* testsuite/special_functions/13_ellint_3/compile.cc: New.
* testsuite/special_functions/13_ellint_3/compile_2.cc: New.
* testsuite/special_functions/14_expint/check_nan.cc: New.
* testsuite/special_functions/14_expint/check_value.cc: New.
* testsuite/special_functions/14_expint/compile.cc: New.
* testsuite/special_functions/14_expint/compile_2.cc: New.
* testsuite/special_functions/15_hermite/check_nan.cc: New.
* testsuite/special_functions/15_hermite/check_value.cc: New.
* testsuite/special_functions/15_hermite/compile.cc: New.
* testsuite/special_functions/15_hermite/compile_2.cc: New.
* testsuite/special_functions/16_laguerre/check_nan.cc: New.
* testsuite/special_functions/16_laguerre/check_value.cc: New.
* testsuite/special_functions/16_laguerre/compile.cc: New.
* testsuite/special_functions/16_laguerre/compile_2.cc: New.
* testsuite/special_functions/17_legendre/check_nan.cc: New.
* testsuite/special_functions/17_legendre/check_value.cc: New.
* testsuite/special_functions/17_legendre/compile.cc: New.
* testsuite/special_functions/17_legendre/compile_2.cc: New.
* testsuite/special_functions/18_riemann_zeta/check_nan.cc: New.
* testsuite/special_functions/18_riemann_zeta/check_value.cc: New.
* testsuite/special_functions/18_riemann_zeta/compile.cc: New.
* testsuite/special_functions/18_riemann_zeta/compile_2.cc: New.
* testsuite/special_functions/19_sph_bessel/check_nan.cc: New.
* testsuite/special_functions/19_sph_bessel/check_value.cc: New.
* testsuite/special_functions/19_sph_bessel/compile.cc: New.
* testsuite/special_functions/19_sph_bessel/compile_2.cc: New.
* testsuite/special_functions/20_sph_legendre/check_nan.cc: New.
* testsuite/special_functions/20_sph_legendre/check_value.cc: New.
* testsuite/special_functions/20_sph_legendre/compile.cc: New.
* testsuite/special_functions/20_sph_legendre/compile_2.cc: New.
* testsuite/special_functions/21_sph_neumann/check_nan.cc: New.
* testsuite/special_functions/21_sph_neumann/check_value.cc: New.
* testsuite/special_functions/21_sph_neumann/compile.cc: New.
* testsuite/special_functions/21_sph_neumann/compile_2.cc: New.
* testsuite/util/specfun_testcase.h: New.
* testsuite/tr1/5_numerical_facilities/special_functions/08_cyl_bessel_i/check_value.cc: More testcases.
* testsuite/tr1/5_numerical_facilities/special_functions/09_cyl_bessel_j/check_value.cc: Ditto.
* testsuite/tr1/5_numerical_facilities/special_functions/10_cyl_bessel_k/check_value.cc: Ditto.
* testsuite/tr1/5_numerical_facilities/special_functions/11_cyl_neumann/check_value.cc: Ditto.
* testsuite/tr1/5_numerical_facilities/special_functions/21_sph_bessel/check_value.cc: Ditto.
* testsuite/tr1/5_numerical_facilities/special_functions/23_sph_neumann/check_value.cc: Ditto.
* testsuite/tr1/5_numerical_facilities/special_functions/16_hermite/check_value.cc: New.
2016-01-13 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/48891

View File

@ -120,6 +120,7 @@ bits_headers = \
${bits_srcdir}/locale_facets_nonio.tcc \
${bits_srcdir}/localefwd.h \
${bits_srcdir}/mask_array.h \
${bits_srcdir}/specfun.h \
${bits_srcdir}/memoryfwd.h \
${bits_srcdir}/move.h \
${bits_srcdir}/std_mutex.h \

View File

@ -410,6 +410,7 @@ bits_headers = \
${bits_srcdir}/locale_facets_nonio.tcc \
${bits_srcdir}/localefwd.h \
${bits_srcdir}/mask_array.h \
${bits_srcdir}/specfun.h \
${bits_srcdir}/memoryfwd.h \
${bits_srcdir}/move.h \
${bits_srcdir}/std_mutex.h \

View File

@ -0,0 +1,499 @@
// Mathematical Special Functions for -*- C++ -*-
// Copyright (C) 2006-2015 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.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/specfun.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{cmath}
*/
#ifndef _GLIBCXX_BITS_SPECFUN_H
#define _GLIBCXX_BITS_SPECFUN_H 1
#pragma GCC visibility push(default)
#include <bits/c++config.h>
#if __STDCPP_WANT_MATH_SPEC_FUNCS__ == 0
# error include <cmath> and define __STDCPP_WANT_MATH_SPEC_FUNCS__
#endif
#define __STDCPP_MATH_SPEC_FUNCS__ 201003L
#include <bits/stl_algobase.h>
#include <limits>
#include <type_traits>
#include <tr1/gamma.tcc>
#include <tr1/bessel_function.tcc>
#include <tr1/beta_function.tcc>
#include <tr1/ell_integral.tcc>
#include <tr1/exp_integral.tcc>
#include <tr1/hypergeometric.tcc>
#include <tr1/legendre_function.tcc>
#include <tr1/modified_bessel_func.tcc>
#include <tr1/poly_hermite.tcc>
#include <tr1/poly_laguerre.tcc>
#include <tr1/riemann_zeta.tcc>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* @defgroup mathsf Mathematical Special Functions
* @ingroup numerics
*
* A collection of advanced mathematical special functions,
* defined by ISO/IEC IS 29124.
* @{
*/
// Associated Laguerre polynomials
inline float
assoc_laguerref(unsigned int __n, unsigned int __m, float __x)
{ return __detail::__assoc_laguerre<float>(__n, __m, __x); }
inline long double
assoc_laguerrel(unsigned int __n, unsigned int __m, long double __x)
{ return __detail::__assoc_laguerre<long double>(__n, __m, __x); }
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
assoc_laguerre(unsigned int __n, unsigned int __m, _Tp __x)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __detail::__assoc_laguerre<__type>(__n, __m, __x);
}
// Associated Legendre functions
inline float
assoc_legendref(unsigned int __l, unsigned int __m, float __x)
{ return __detail::__assoc_legendre_p<float>(__l, __m, __x); }
inline long double
assoc_legendrel(unsigned int __l, unsigned int __m, long double __x)
{ return __detail::__assoc_legendre_p<long double>(__l, __m, __x); }
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
assoc_legendre(unsigned int __l, unsigned int __m, _Tp __x)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __detail::__assoc_legendre_p<__type>(__l, __m, __x);
}
// Beta functions
inline float
betaf(float __x, float __y)
{ return __detail::__beta<float>(__x, __y); }
inline long double
betal(long double __x, long double __y)
{ return __detail::__beta<long double>(__x, __y); }
template<typename _Tpx, typename _Tpy>
inline typename __gnu_cxx::__promote_2<_Tpx, _Tpy>::__type
beta(_Tpx __x, _Tpy __y)
{
typedef typename __gnu_cxx::__promote_2<_Tpx, _Tpy>::__type __type;
return __detail::__beta<__type>(__x, __y);
}
// Complete elliptic integrals of the first kind
inline float
comp_ellint_1f(float __k)
{ return __detail::__comp_ellint_1<float>(__k); }
inline long double
comp_ellint_1l(long double __k)
{ return __detail::__comp_ellint_1<long double>(__k); }
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
comp_ellint_1(_Tp __k)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __detail::__comp_ellint_1<__type>(__k);
}
// Complete elliptic integrals of the second kind
inline float
comp_ellint_2f(float __k)
{ return __detail::__comp_ellint_2<float>(__k); }
inline long double
comp_ellint_2l(long double __k)
{ return __detail::__comp_ellint_2<long double>(__k); }
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
comp_ellint_2(_Tp __k)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __detail::__comp_ellint_2<__type>(__k);
}
// Complete elliptic integrals of the third kind
inline float
comp_ellint_3f(float __k, float __nu)
{ return __detail::__comp_ellint_3<float>(__k, __nu); }
inline long double
comp_ellint_3l(long double __k, long double __nu)
{ return __detail::__comp_ellint_3<long double>(__k, __nu); }
template<typename _Tp, typename _Tpn>
inline typename __gnu_cxx::__promote_2<_Tp, _Tpn>::__type
comp_ellint_3(_Tp __k, _Tpn __nu)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Tpn>::__type __type;
return __detail::__comp_ellint_3<__type>(__k, __nu);
}
// Regular modified cylindrical Bessel functions
inline float
cyl_bessel_if(float __nu, float __x)
{ return __detail::__cyl_bessel_i<float>(__nu, __x); }
inline long double
cyl_bessel_il(long double __nu, long double __x)
{ return __detail::__cyl_bessel_i<long double>(__nu, __x); }
template<typename _Tpnu, typename _Tp>
inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type
cyl_bessel_i(_Tpnu __nu, _Tp __x)
{
typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type;
return __detail::__cyl_bessel_i<__type>(__nu, __x);
}
// Cylindrical Bessel functions (of the first kind)
inline float
cyl_bessel_jf(float __nu, float __x)
{ return __detail::__cyl_bessel_j<float>(__nu, __x); }
inline long double
cyl_bessel_jl(long double __nu, long double __x)
{ return __detail::__cyl_bessel_j<long double>(__nu, __x); }
template<typename _Tpnu, typename _Tp>
inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type
cyl_bessel_j(_Tpnu __nu, _Tp __x)
{
typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type;
return __detail::__cyl_bessel_j<__type>(__nu, __x);
}
// Irregular modified cylindrical Bessel functions
inline float
cyl_bessel_kf(float __nu, float __x)
{ return __detail::__cyl_bessel_k<float>(__nu, __x); }
inline long double
cyl_bessel_kl(long double __nu, long double __x)
{ return __detail::__cyl_bessel_k<long double>(__nu, __x); }
template<typename _Tpnu, typename _Tp>
inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type
cyl_bessel_k(_Tpnu __nu, _Tp __x)
{
typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type;
return __detail::__cyl_bessel_k<__type>(__nu, __x);
}
// Cylindrical Neumann functions
inline float
cyl_neumannf(float __nu, float __x)
{ return __detail::__cyl_neumann_n<float>(__nu, __x); }
inline long double
cyl_neumannl(long double __nu, long double __x)
{ return __detail::__cyl_neumann_n<long double>(__nu, __x); }
template<typename _Tpnu, typename _Tp>
inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type
cyl_neumann(_Tpnu __nu, _Tp __x)
{
typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type;
return __detail::__cyl_neumann_n<__type>(__nu, __x);
}
// Incomplete elliptic integrals of the first kind
inline float
ellint_1f(float __k, float __phi)
{ return __detail::__ellint_1<float>(__k, __phi); }
inline long double
ellint_1l(long double __k, long double __phi)
{ return __detail::__ellint_1<long double>(__k, __phi); }
template<typename _Tp, typename _Tpp>
inline typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type
ellint_1(_Tp __k, _Tpp __phi)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type __type;
return __detail::__ellint_1<__type>(__k, __phi);
}
// Incomplete elliptic integrals of the second kind
inline float
ellint_2f(float __k, float __phi)
{ return __detail::__ellint_2<float>(__k, __phi); }
inline long double
ellint_2l(long double __k, long double __phi)
{ return __detail::__ellint_2<long double>(__k, __phi); }
template<typename _Tp, typename _Tpp>
inline typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type
ellint_2(_Tp __k, _Tpp __phi)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type __type;
return __detail::__ellint_2<__type>(__k, __phi);
}
// Incomplete elliptic integrals of the third kind
inline float
ellint_3f(float __k, float __nu, float __phi)
{ return __detail::__ellint_3<float>(__k, __nu, __phi); }
inline long double
ellint_3l(long double __k, long double __nu, long double __phi)
{ return __detail::__ellint_3<long double>(__k, __nu, __phi); }
template<typename _Tp, typename _Tpn, typename _Tpp>
inline typename __gnu_cxx::__promote_3<_Tp, _Tpn, _Tpp>::__type
ellint_3(_Tp __k, _Tpn __nu, _Tpp __phi)
{
typedef typename __gnu_cxx::__promote_3<_Tp, _Tpn, _Tpp>::__type __type;
return __detail::__ellint_3<__type>(__k, __nu, __phi);
}
// Exponential integrals
inline float
expintf(float __x)
{ return __detail::__expint<float>(__x); }
inline long double
expintl(long double __x)
{ return __detail::__expint<long double>(__x); }
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
expint(_Tp __x)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __detail::__expint<__type>(__x);
}
// Hermite polynomials
inline float
hermitef(unsigned int __n, float __x)
{ return __detail::__poly_hermite<float>(__n, __x); }
inline long double
hermitel(unsigned int __n, long double __x)
{ return __detail::__poly_hermite<long double>(__n, __x); }
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
hermite(unsigned int __n, _Tp __x)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __detail::__poly_hermite<__type>(__n, __x);
}
// Laguerre polynomials
inline float
laguerref(unsigned int __n, float __x)
{ return __detail::__laguerre<float>(__n, __x); }
inline long double
laguerrel(unsigned int __n, long double __x)
{ return __detail::__laguerre<long double>(__n, __x); }
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
laguerre(unsigned int __n, _Tp __x)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __detail::__laguerre<__type>(__n, __x);
}
// Legendre polynomials
inline float
legendref(unsigned int __n, float __x)
{ return __detail::__poly_legendre_p<float>(__n, __x); }
inline long double
legendrel(unsigned int __n, long double __x)
{ return __detail::__poly_legendre_p<long double>(__n, __x); }
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
legendre(unsigned int __n, _Tp __x)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __detail::__poly_legendre_p<__type>(__n, __x);
}
// Riemann zeta functions
inline float
riemann_zetaf(float __s)
{ return __detail::__riemann_zeta<float>(__s); }
inline long double
riemann_zetal(long double __s)
{ return __detail::__riemann_zeta<long double>(__s); }
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
riemann_zeta(_Tp __s)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __detail::__riemann_zeta<__type>(__s);
}
// Spherical Bessel functions
inline float
sph_besself(unsigned int __n, float __x)
{ return __detail::__sph_bessel<float>(__n, __x); }
inline long double
sph_bessell(unsigned int __n, long double __x)
{ return __detail::__sph_bessel<long double>(__n, __x); }
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
sph_bessel(unsigned int __n, _Tp __x)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __detail::__sph_bessel<__type>(__n, __x);
}
// Spherical associated Legendre functions
inline float
sph_legendref(unsigned int __l, unsigned int __m, float __theta)
{ return __detail::__sph_legendre<float>(__l, __m, __theta); }
inline long double
sph_legendrel(unsigned int __l, unsigned int __m, long double __theta)
{ return __detail::__sph_legendre<long double>(__l, __m, __theta); }
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
sph_legendre(unsigned int __l, unsigned int __m, _Tp __theta)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __detail::__sph_legendre<__type>(__l, __m, __theta);
}
// Spherical Neumann functions
inline float
sph_neumannf(unsigned int __n, float __x)
{ return __detail::__sph_neumann<float>(__n, __x); }
inline long double
sph_neumannl(unsigned int __n, long double __x)
{ return __detail::__sph_neumann<long double>(__n, __x); }
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
sph_neumann(unsigned int __n, _Tp __x)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __detail::__sph_neumann<__type>(__n, __x);
}
// @} group mathsf
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
// Confluent hypergeometric functions
inline float
conf_hypergf(float __a, float __c, float __x)
{ return std::__detail::__conf_hyperg<float>(__a, __c, __x); }
inline long double
conf_hypergl(long double __a, long double __c, long double __x)
{ return std::__detail::__conf_hyperg<long double>(__a, __c, __x); }
template<typename _Tpa, typename _Tpc, typename _Tp>
inline typename __gnu_cxx::__promote_3<_Tpa, _Tpc, _Tp>::__type
conf_hyperg(_Tpa __a, _Tpc __c, _Tp __x)
{
typedef typename __gnu_cxx::__promote_3<_Tpa, _Tpc, _Tp>::__type __type;
return std::__detail::__conf_hyperg<__type>(__a, __c, __x);
}
// Hypergeometric functions
inline float
hypergf(float __a, float __b, float __c, float __x)
{ return std::__detail::__hyperg<float>(__a, __b, __c, __x); }
inline long double
hypergl(long double __a, long double __b, long double __c, long double __x)
{ return std::__detail::__hyperg<long double>(__a, __b, __c, __x); }
template<typename _Tpa, typename _Tpb, typename _Tpc, typename _Tp>
inline typename __gnu_cxx::__promote_4<_Tpa, _Tpb, _Tpc, _Tp>::__type
hyperg(_Tpa __a, _Tpb __b, _Tpc __c, _Tp __x)
{
typedef typename __gnu_cxx::__promote_4<_Tpa, _Tpb, _Tpc, _Tp>
::__type __type;
return std::__detail::__hyperg<__type>(__a, __b, __c, __x);
}
} // namespace __gnu_cxx
#pragma GCC visibility pop
#endif // _GLIBCXX_BITS_SPECFUN_H

View File

@ -1784,4 +1784,8 @@ _GLIBCXX_END_NAMESPACE_VERSION
#endif // C++11
#if __STDCPP_WANT_MATH_SPEC_FUNCS__ == 1
# include <bits/specfun.h>
#endif
#endif

View File

@ -0,0 +1,57 @@
// C++ includes used for precompiling extensions -*- C++ -*-
// Copyright (C) 2006-2015 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.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file expc++.h
* This is an implementation file for a precompiled header.
*/
#if __cplusplus < 201103L
#include <bits/extc++.h>
#endif
#if __cplusplus > 201103L
#include <experimental/algorithm>
#include <experimental/any>
#include <experimental/chrono>
#include <experimental/deque>
#include <experimental/filesystem>
#include <experimental/forward_list>
#include <experimental/functional>
#include <experimental/iterator>
#include <experimental/list>
#include <experimental/map>
#include <experimental/memory>
#include <experimental/numeric>
#include <experimental/optional>
#include <experimental/ratio>
#include <experimental/set>
#include <experimental/string>
#include <experimental/string_view>
#include <experimental/system_error>
#include <experimental/tuple>
#include <experimental/type_traits>
#include <experimental/unordered_map>
#include <experimental/unordered_set>
#include <experimental/vector>
#endif

View File

@ -50,8 +50,15 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
#if __STDCPP_WANT_MATH_SPEC_FUNCS__
# define _GLIBCXX_MATH_NS ::std
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
{
# define _GLIBCXX_MATH_NS ::std::tr1
#else
# error do not include this header directly, use <cmath> or <tr1/cmath>
#endif
// [5.2] Special functions
// Implementation-space details.
@ -90,8 +97,8 @@ namespace tr1
_Tp & __gam1, _Tp & __gam2, _Tp & __gampl, _Tp & __gammi)
{
#if _GLIBCXX_USE_C99_MATH_TR1
__gampl = _Tp(1) / std::tr1::tgamma(_Tp(1) + __mu);
__gammi = _Tp(1) / std::tr1::tgamma(_Tp(1) - __mu);
__gampl = _Tp(1) / _GLIBCXX_MATH_NS::tgamma(_Tp(1) + __mu);
__gammi = _Tp(1) / _GLIBCXX_MATH_NS::tgamma(_Tp(1) - __mu);
#else
__gampl = _Tp(1) / __gamma(_Tp(1) + __mu);
__gammi = _Tp(1) / __gamma(_Tp(1) - __mu);
@ -306,7 +313,7 @@ namespace tr1
const _Tp __gam = (__p - __f) / __q;
__Jmu = std::sqrt(__w / ((__p - __f) * __gam + __q));
#if _GLIBCXX_USE_C99_MATH_TR1
__Jmu = std::tr1::copysign(__Jmu, __Jnul);
__Jmu = _GLIBCXX_MATH_NS::copysign(__Jmu, __Jnul);
#else
if (__Jmu * __Jnul < _Tp(0))
__Jmu = -__Jmu;
@ -414,7 +421,7 @@ namespace tr1
const _Tp __x2 = __x / _Tp(2);
_Tp __fact = __nu * std::log(__x2);
#if _GLIBCXX_USE_C99_MATH_TR1
__fact -= std::tr1::lgamma(__nu + _Tp(1));
__fact -= _GLIBCXX_MATH_NS::lgamma(__nu + _Tp(1));
#else
__fact -= __log_gamma(__nu + _Tp(1));
#endif
@ -621,8 +628,11 @@ namespace tr1
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std::tr1::__detail
}
} // namespace __detail
#undef _GLIBCXX_MATH_NS
#if ! __STDCPP_WANT_MATH_SPEC_FUNCS__ && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
}
#endif // _GLIBCXX_TR1_BESSEL_FUNCTION_TCC

View File

@ -48,8 +48,15 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
#if __STDCPP_WANT_MATH_SPEC_FUNCS__
# define _GLIBCXX_MATH_NS ::std
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
{
# define _GLIBCXX_MATH_NS ::std::tr1
#else
# error do not include this header directly, use <cmath> or <tr1/cmath>
#endif
// [5.2] Special functions
// Implementation-space details.
@ -78,15 +85,15 @@ namespace tr1
#if _GLIBCXX_USE_C99_MATH_TR1
if (__x > __y)
{
__bet = std::tr1::tgamma(__x)
/ std::tr1::tgamma(__x + __y);
__bet *= std::tr1::tgamma(__y);
__bet = _GLIBCXX_MATH_NS::tgamma(__x)
/ _GLIBCXX_MATH_NS::tgamma(__x + __y);
__bet *= _GLIBCXX_MATH_NS::tgamma(__y);
}
else
{
__bet = std::tr1::tgamma(__y)
/ std::tr1::tgamma(__x + __y);
__bet *= std::tr1::tgamma(__x);
__bet = _GLIBCXX_MATH_NS::tgamma(__y)
/ _GLIBCXX_MATH_NS::tgamma(__x + __y);
__bet *= _GLIBCXX_MATH_NS::tgamma(__x);
}
#else
if (__x > __y)
@ -122,9 +129,9 @@ namespace tr1
__beta_lgamma(_Tp __x, _Tp __y)
{
#if _GLIBCXX_USE_C99_MATH_TR1
_Tp __bet = std::tr1::lgamma(__x)
+ std::tr1::lgamma(__y)
- std::tr1::lgamma(__x + __y);
_Tp __bet = _GLIBCXX_MATH_NS::lgamma(__x)
+ _GLIBCXX_MATH_NS::lgamma(__y)
- _GLIBCXX_MATH_NS::lgamma(__x + __y);
#else
_Tp __bet = __log_gamma(__x)
+ __log_gamma(__y)
@ -190,8 +197,11 @@ namespace tr1
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std::tr1::__detail
}
} // namespace __detail
#undef _GLIBCXX_MATH_NS
#if ! __STDCPP_WANT_MATH_SPEC_FUNCS__ && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
}
#endif // _GLIBCXX_TR1_BETA_FUNCTION_TCC

View File

@ -1086,6 +1086,121 @@ _GLIBCXX_END_NAMESPACE_VERSION
}
}
#if __STDCPP_WANT_MATH_SPEC_FUNCS__
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace tr1
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* @defgroup tr1_math_spec_func Mathematical Special Functions
* @ingroup numerics
*
* A collection of advanced mathematical special functions.
* @{
*/
using std::assoc_laguerref;
using std::assoc_laguerrel;
using std::assoc_laguerre;
using std::assoc_legendref;
using std::assoc_legendrel;
using std::assoc_legendre;
using std::betaf;
using std::betal;
using std::beta;
using std::comp_ellint_1f;
using std::comp_ellint_1l;
using std::comp_ellint_1;
using std::comp_ellint_2f;
using std::comp_ellint_2l;
using std::comp_ellint_2;
using std::comp_ellint_3f;
using std::comp_ellint_3l;
using std::comp_ellint_3;
using __gnu_cxx::conf_hypergf;
using __gnu_cxx::conf_hypergl;
using __gnu_cxx::conf_hyperg;
using std::cyl_bessel_if;
using std::cyl_bessel_il;
using std::cyl_bessel_i;
using std::cyl_bessel_jf;
using std::cyl_bessel_jl;
using std::cyl_bessel_j;
using std::cyl_bessel_kf;
using std::cyl_bessel_kl;
using std::cyl_bessel_k;
using std::cyl_neumannf;
using std::cyl_neumannl;
using std::cyl_neumann;
using std::ellint_1f;
using std::ellint_1l;
using std::ellint_1;
using std::ellint_2f;
using std::ellint_2l;
using std::ellint_2;
using std::ellint_3f;
using std::ellint_3l;
using std::ellint_3;
using std::expintf;
using std::expintl;
using std::expint;
using std::hermitef;
using std::hermitel;
using std::hermite;
using __gnu_cxx::hypergf;
using __gnu_cxx::hypergl;
using __gnu_cxx::hyperg;
using std::laguerref;
using std::laguerrel;
using std::laguerre;
using std::legendref;
using std::legendrel;
using std::legendre;
using std::riemann_zetaf;
using std::riemann_zetal;
using std::riemann_zeta;
using std::sph_besself;
using std::sph_bessell;
using std::sph_bessel;
using std::sph_legendref;
using std::sph_legendrel;
using std::sph_legendre;
using std::sph_neumannf;
using std::sph_neumannl;
using std::sph_neumann;
/* @} */ // tr1_math_spec_func
_GLIBCXX_END_NAMESPACE_VERSION
}
}
#else // ! __STDCPP_WANT_MATH_SPEC_FUNCS__
#include <bits/stl_algobase.h>
#include <limits>
#include <tr1/type_traits>
@ -1513,5 +1628,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
}
}
#endif // __STDCPP_WANT_MATH_SPEC_FUNCS__
#endif // _GLIBCXX_TR1_CMATH

View File

@ -44,8 +44,13 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
#if __STDCPP_WANT_MATH_SPEC_FUNCS__
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
{
#else
# error do not include this header directly, use <cmath> or <tr1/cmath>
#endif
// [5.2] Special functions
// Implementation-space details.
@ -742,8 +747,10 @@ namespace tr1
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std::tr1::__detail
}
} // namespace __detail
#if ! __STDCPP_WANT_MATH_SPEC_FUNCS__ && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
}
#endif // _GLIBCXX_TR1_ELL_INTEGRAL_TCC

View File

@ -49,8 +49,13 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
#if __STDCPP_WANT_MATH_SPEC_FUNCS__
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
{
#else
# error do not include this header directly, use <cmath> or <tr1/cmath>
#endif
// [5.2] Special functions
// Implementation-space details.
@ -519,8 +524,10 @@ namespace tr1
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std::tr1::__detail
}
} // namespace __detail
#if ! __STDCPP_WANT_MATH_SPEC_FUNCS__ && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
}
#endif // _GLIBCXX_TR1_EXP_INTEGRAL_TCC

View File

@ -46,12 +46,19 @@
#ifndef _GLIBCXX_TR1_GAMMA_TCC
#define _GLIBCXX_TR1_GAMMA_TCC 1
#include "special_function_util.h"
#include <tr1/special_function_util.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
#if __STDCPP_WANT_MATH_SPEC_FUNCS__
# define _GLIBCXX_MATH_NS ::std
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
{
# define _GLIBCXX_MATH_NS ::std::tr1
#else
# error do not include this header directly, use <cmath> or <tr1/cmath>
#endif
// Implementation-space details.
namespace __detail
{
@ -282,9 +289,9 @@ namespace tr1
= std::numeric_limits<_Tp>::max_exponent10
* std::log(_Tp(10)) - _Tp(1);
#if _GLIBCXX_USE_C99_MATH_TR1
_Tp __coeff = std::tr1::lgamma(_Tp(1 + __n))
- std::tr1::lgamma(_Tp(1 + __k))
- std::tr1::lgamma(_Tp(1 + __n - __k));
_Tp __coeff = _GLIBCXX_MATH_NS::lgamma(_Tp(1 + __n))
- _GLIBCXX_MATH_NS::lgamma(_Tp(1 + __k))
- _GLIBCXX_MATH_NS::lgamma(_Tp(1 + __n - __k));
#else
_Tp __coeff = __log_gamma(_Tp(1 + __n))
- __log_gamma(_Tp(1 + __k))
@ -449,7 +456,7 @@ namespace tr1
{
const _Tp __hzeta = __hurwitz_zeta(_Tp(__n + 1), __x);
#if _GLIBCXX_USE_C99_MATH_TR1
const _Tp __ln_nfact = std::tr1::lgamma(_Tp(__n + 1));
const _Tp __ln_nfact = _GLIBCXX_MATH_NS::lgamma(_Tp(__n + 1));
#else
const _Tp __ln_nfact = __log_gamma(_Tp(__n + 1));
#endif
@ -461,9 +468,12 @@ namespace tr1
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std::tr1::__detail
}
}
} // namespace __detail
#undef _GLIBCXX_MATH_NS
#if ! __STDCPP_WANT_MATH_SPEC_FUNCS__ && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
} // namespace std
#endif // _GLIBCXX_TR1_GAMMA_TCC

View File

@ -43,8 +43,15 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
#if __STDCPP_WANT_MATH_SPEC_FUNCS__
# define _GLIBCXX_MATH_NS ::std
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
{
# define _GLIBCXX_MATH_NS ::std::tr1
#else
# error do not include this header directly, use <cmath> or <tr1/cmath>
#endif
// [5.2] Special functions
// Implementation-space details.
@ -222,7 +229,7 @@ namespace tr1
__conf_hyperg(_Tp __a, _Tp __c, _Tp __x)
{
#if _GLIBCXX_USE_C99_MATH_TR1
const _Tp __c_nint = std::tr1::nearbyint(__c);
const _Tp __c_nint = _GLIBCXX_MATH_NS::nearbyint(__c);
#else
const _Tp __c_nint = static_cast<int>(__c + _Tp(0.5L));
#endif
@ -723,9 +730,9 @@ namespace tr1
__hyperg(_Tp __a, _Tp __b, _Tp __c, _Tp __x)
{
#if _GLIBCXX_USE_C99_MATH_TR1
const _Tp __a_nint = std::tr1::nearbyint(__a);
const _Tp __b_nint = std::tr1::nearbyint(__b);
const _Tp __c_nint = std::tr1::nearbyint(__c);
const _Tp __a_nint = _GLIBCXX_MATH_NS::nearbyint(__a);
const _Tp __b_nint = _GLIBCXX_MATH_NS::nearbyint(__b);
const _Tp __c_nint = _GLIBCXX_MATH_NS::nearbyint(__c);
#else
const _Tp __a_nint = static_cast<int>(__a + _Tp(0.5L));
const _Tp __b_nint = static_cast<int>(__b + _Tp(0.5L));
@ -768,8 +775,11 @@ namespace tr1
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std::tr1::__detail
}
} // namespace __detail
#undef _GLIBCXX_MATH_NS
#if ! __STDCPP_WANT_MATH_SPEC_FUNCS__ && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
}
#endif // _GLIBCXX_TR1_HYPERGEOMETRIC_TCC

View File

@ -48,8 +48,15 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
#if __STDCPP_WANT_MATH_SPEC_FUNCS__
# define _GLIBCXX_MATH_NS ::std
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
{
# define _GLIBCXX_MATH_NS ::std::tr1
#else
# error do not include this header directly, use <cmath> or <tr1/cmath>
#endif
// [5.2] Special functions
// Implementation-space details.
@ -243,14 +250,14 @@ namespace tr1
const _Tp __sgn = ( __m % 2 == 1 ? -_Tp(1) : _Tp(1));
const _Tp __y_mp1m_factor = __x * std::sqrt(_Tp(2 * __m + 3));
#if _GLIBCXX_USE_C99_MATH_TR1
const _Tp __lncirc = std::tr1::log1p(-__x * __x);
const _Tp __lncirc = _GLIBCXX_MATH_NS::log1p(-__x * __x);
#else
const _Tp __lncirc = std::log(_Tp(1) - __x * __x);
#endif
// Gamma(m+1/2) / Gamma(m)
#if _GLIBCXX_USE_C99_MATH_TR1
const _Tp __lnpoch = std::tr1::lgamma(_Tp(__m + _Tp(0.5L)))
- std::tr1::lgamma(_Tp(__m));
const _Tp __lnpoch = _GLIBCXX_MATH_NS::lgamma(_Tp(__m + _Tp(0.5L)))
- _GLIBCXX_MATH_NS::lgamma(_Tp(__m));
#else
const _Tp __lnpoch = __log_gamma(_Tp(__m + _Tp(0.5L)))
- __log_gamma(_Tp(__m));
@ -296,8 +303,11 @@ namespace tr1
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std::tr1::__detail
}
} // namespace __detail
#undef _GLIBCXX_MATH_NS
#if ! __STDCPP_WANT_MATH_SPEC_FUNCS__ && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
}
#endif // _GLIBCXX_TR1_LEGENDRE_FUNCTION_TCC

View File

@ -50,8 +50,13 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
#if __STDCPP_WANT_MATH_SPEC_FUNCS__
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
{
#else
# error do not include this header directly, use <cmath> or <tr1/cmath>
#endif
// [5.2] Special functions
// Implementation-space details.
@ -427,8 +432,10 @@ namespace tr1
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std::tr1::__detail
}
} // namespace __detail
#if ! __STDCPP_WANT_MATH_SPEC_FUNCS__ && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
}
#endif // _GLIBCXX_TR1_MODIFIED_BESSEL_FUNC_TCC

View File

@ -41,8 +41,13 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
#if __STDCPP_WANT_MATH_SPEC_FUNCS__
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
{
#else
# error do not include this header directly, use <cmath> or <tr1/cmath>
#endif
// [5.2] Special functions
// Implementation-space details.
@ -117,8 +122,10 @@ namespace tr1
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std::tr1::__detail
}
} // namespace __detail
#if ! __STDCPP_WANT_MATH_SPEC_FUNCS__ && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
}
#endif // _GLIBCXX_TR1_POLY_HERMITE_TCC

View File

@ -43,8 +43,15 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
#if __STDCPP_WANT_MATH_SPEC_FUNCS__
# define _GLIBCXX_MATH_NS ::std
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
{
# define _GLIBCXX_MATH_NS ::std::tr1
#else
# error do not include this header directly, use <cmath> or <tr1/cmath>
#endif
// [5.2] Special functions
// Implementation-space details.
@ -80,8 +87,8 @@ namespace tr1
* __eta * __eta * __cos2th * __sin2th;
#if _GLIBCXX_USE_C99_MATH_TR1
const _Tp __lg_b = std::tr1::lgamma(_Tp(__n) + __b);
const _Tp __lnfact = std::tr1::lgamma(_Tp(__n + 1));
const _Tp __lg_b = _GLIBCXX_MATH_NS::lgamma(_Tp(__n) + __b);
const _Tp __lnfact = _GLIBCXX_MATH_NS::lgamma(_Tp(__n + 1));
#else
const _Tp __lg_b = __log_gamma(_Tp(__n) + __b);
const _Tp __lnfact = __log_gamma(_Tp(__n + 1));
@ -312,8 +319,11 @@ namespace tr1
{ return __poly_laguerre<unsigned int, _Tp>(__n, 0, __x); }
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std::tr1::__detail
}
} // namespace __detail
#undef _GLIBCXX_MATH_NS
#if ! __STDCPP_WANT_MATH_SPEC_FUNCS__ && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
}
#endif // _GLIBCXX_TR1_POLY_LAGUERRE_TCC

View File

@ -46,8 +46,15 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
#if __STDCPP_WANT_MATH_SPEC_FUNCS__
# define _GLIBCXX_MATH_NS ::std
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
{
# define _GLIBCXX_MATH_NS ::std::tr1
#else
# error do not include this header directly, use <cmath> or <tr1/cmath>
#endif
// [5.2] Special functions
// Implementation-space details.
@ -163,7 +170,7 @@ namespace tr1
if (__s < _Tp(0))
{
#if _GLIBCXX_USE_C99_MATH_TR1
if (std::tr1::fmod(__s,_Tp(2)) == _Tp(0))
if (_GLIBCXX_MATH_NS::fmod(__s,_Tp(2)) == _Tp(0))
return _Tp(0);
else
#endif
@ -173,7 +180,7 @@ namespace tr1
* __numeric_constants<_Tp>::__pi(), __s)
* std::sin(__numeric_constants<_Tp>::__pi_2() * __s)
#if _GLIBCXX_USE_C99_MATH_TR1
* std::exp(std::tr1::lgamma(_Tp(1) - __s))
* std::exp(_GLIBCXX_MATH_NS::lgamma(_Tp(1) - __s))
#else
* std::exp(__log_gamma(_Tp(1) - __s))
#endif
@ -192,9 +199,9 @@ namespace tr1
for (unsigned int __j = 0; __j <= __i; ++__j)
{
#if _GLIBCXX_USE_C99_MATH_TR1
_Tp __bincoeff = std::tr1::lgamma(_Tp(1 + __i))
- std::tr1::lgamma(_Tp(1 + __j))
- std::tr1::lgamma(_Tp(1 + __i - __j));
_Tp __bincoeff = _GLIBCXX_MATH_NS::lgamma(_Tp(1 + __i))
- _GLIBCXX_MATH_NS::lgamma(_Tp(1 + __j))
- _GLIBCXX_MATH_NS::lgamma(_Tp(1 + __i - __j));
#else
_Tp __bincoeff = __log_gamma(_Tp(1 + __i))
- __log_gamma(_Tp(1 + __j))
@ -297,7 +304,7 @@ namespace tr1
__zeta *= std::pow(_Tp(2) * __numeric_constants<_Tp>::__pi(), __s)
* std::sin(__numeric_constants<_Tp>::__pi_2() * __s)
#if _GLIBCXX_USE_C99_MATH_TR1
* std::exp(std::tr1::lgamma(_Tp(1) - __s))
* std::exp(_GLIBCXX_MATH_NS::lgamma(_Tp(1) - __s))
#else
* std::exp(__log_gamma(_Tp(1) - __s))
#endif
@ -320,7 +327,7 @@ namespace tr1
* __numeric_constants<_Tp>::__pi(), __s)
* std::sin(__numeric_constants<_Tp>::__pi_2() * __s)
#if _GLIBCXX_USE_C99_MATH_TR1
* std::tr1::tgamma(_Tp(1) - __s)
* _GLIBCXX_MATH_NS::tgamma(_Tp(1) - __s)
#else
* std::exp(__log_gamma(_Tp(1) - __s))
#endif
@ -375,9 +382,9 @@ namespace tr1
for (unsigned int __j = 0; __j <= __i; ++__j)
{
#if _GLIBCXX_USE_C99_MATH_TR1
_Tp __bincoeff = std::tr1::lgamma(_Tp(1 + __i))
- std::tr1::lgamma(_Tp(1 + __j))
- std::tr1::lgamma(_Tp(1 + __i - __j));
_Tp __bincoeff = _GLIBCXX_MATH_NS::lgamma(_Tp(1 + __i))
- _GLIBCXX_MATH_NS::lgamma(_Tp(1 + __j))
- _GLIBCXX_MATH_NS::lgamma(_Tp(1 + __i - __j));
#else
_Tp __bincoeff = __log_gamma(_Tp(1 + __i))
- __log_gamma(_Tp(1 + __j))
@ -426,8 +433,11 @@ namespace tr1
{ return __hurwitz_zeta_glob(__a, __s); }
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std::tr1::__detail
}
} // namespace __detail
#undef _GLIBCXX_MATH_NS
#if ! __STDCPP_WANT_MATH_SPEC_FUNCS__ && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
}
#endif // _GLIBCXX_TR1_RIEMANN_ZETA_TCC

View File

@ -38,8 +38,13 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
#if __STDCPP_WANT_MATH_SPEC_FUNCS__
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
{
#else
# error do not include this header directly, use <cmath> or <tr1/cmath>
#endif
namespace __detail
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@ -128,7 +133,9 @@ namespace tr1
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __detail
}
#if ! __STDCPP_WANT_MATH_SPEC_FUNCS__ && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
}
#endif // _GLIBCXX_TR1_SPECIAL_FUNCTION_UTIL_H

View File

@ -0,0 +1,128 @@
// { dg-require-c-std "" }
// { dg-add-options ieee }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// conf_hyperg
#include <cmath>
#include <testsuite_hooks.h>
void
test01()
{
float af = std::numeric_limits<float>::quiet_NaN();
double ad = std::numeric_limits<double>::quiet_NaN();
long double al = std::numeric_limits<long double>::quiet_NaN();
float cf = 3.0F;
double cd = 3.0;
long double cl = 3.0L;
float xf = 0.5F;
double xd = 0.5;
long double xl = 0.5L;
float a = __gnu_cxx::conf_hyperg(af, cf, xf);
float b = __gnu_cxx::conf_hypergf(af, cf, xf);
double c = __gnu_cxx::conf_hyperg(ad, cd, xd);
long double d = __gnu_cxx::conf_hyperg(al, cl, xl);
long double e = __gnu_cxx::conf_hypergl(al, cl, xl);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
void
test02()
{
float af = 2.0F;
double ad = 2.0;
long double al = 2.0L;
float cf = std::numeric_limits<float>::quiet_NaN();
double cd = std::numeric_limits<double>::quiet_NaN();
long double cl = std::numeric_limits<long double>::quiet_NaN();
float xf = 0.5F;
double xd = 0.5;
long double xl = 0.5L;
float a = __gnu_cxx::conf_hyperg(af, cf, xf);
float b = __gnu_cxx::conf_hypergf(af, cf, xf);
double c = __gnu_cxx::conf_hyperg(ad, cd, xd);
long double d = __gnu_cxx::conf_hyperg(al, cl, xl);
long double e = __gnu_cxx::conf_hypergl(al, cl, xl);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
void
test03()
{
float af = 2.0F;
double ad = 2.0;
long double al = 2.0L;
float cf = 3.0F;
double cd = 3.0;
long double cl = 3.0L;
float xf = std::numeric_limits<float>::quiet_NaN();
double xd = std::numeric_limits<double>::quiet_NaN();
long double xl = std::numeric_limits<long double>::quiet_NaN();
float a = __gnu_cxx::conf_hyperg(af, cf, xf);
float b = __gnu_cxx::conf_hypergf(af, cf, xf);
double c = __gnu_cxx::conf_hyperg(ad, cd, xd);
long double d = __gnu_cxx::conf_hyperg(al, cl, xl);
long double e = __gnu_cxx::conf_hypergl(al, cl, xl);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
int
main()
{
test01();
test02();
test03();
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,40 @@
// { dg-do compile }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// conf_hyperg
#include <cmath>
void
test01()
{
float af = 2.0F, cf = 3.0F, xf = 0.5F;
double ad = 2.0, cd = 3.0, xd = 0.5;
long double al = 2.0L, cl = 3.0L, xl = 0.5L;
__gnu_cxx::conf_hyperg(af, cf, xf);
__gnu_cxx::conf_hypergf(af, cf, xf);
__gnu_cxx::conf_hyperg(ad, cd, xd);
__gnu_cxx::conf_hyperg(al, cl, xl);
__gnu_cxx::conf_hypergl(al, cl, xl);
return;
}

View File

@ -0,0 +1,176 @@
// { dg-require-c-std "" }
// { dg-add-options ieee }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// hyperg
#include <cmath>
#include <testsuite_hooks.h>
void
test01()
{
float af = std::numeric_limits<float>::quiet_NaN();
double ad = std::numeric_limits<double>::quiet_NaN();
long double al = std::numeric_limits<long double>::quiet_NaN();
float bf = 10.0F;
double bd = 10.0;
long double bl = 10.0L;
float cf = 3.0F;
double cd = 3.0;
long double cl = 3.0L;
float xf = 0.5F;
double xd = 0.5;
long double xl = 0.5L;
float a = __gnu_cxx::hyperg(af, bf, cf, xf);
float b = __gnu_cxx::hypergf(af, bf, cf, xf);
double c = __gnu_cxx::hyperg(ad, bd, cd, xd);
long double d = __gnu_cxx::hyperg(al, bl, cl, xl);
long double e = __gnu_cxx::hypergl(al, bl, cl, xl);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
void
test02()
{
float af = 2.0F;
double ad = 2.0;
long double al = 2.0L;
float bf = std::numeric_limits<float>::quiet_NaN();
double bd = std::numeric_limits<double>::quiet_NaN();
long double bl = std::numeric_limits<long double>::quiet_NaN();
float cf = 3.0F;
double cd = 3.0;
long double cl = 3.0L;
float xf = 0.5F;
double xd = 0.5;
long double xl = 0.5L;
float a = __gnu_cxx::hyperg(af, bf, cf, xf);
float b = __gnu_cxx::hypergf(af, bf, cf, xf);
double c = __gnu_cxx::hyperg(ad, bd, cd, xd);
long double d = __gnu_cxx::hyperg(al, bl, cl, xl);
long double e = __gnu_cxx::hypergl(al, bl, cl, xl);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
void
test03()
{
float af = 2.0F;
double ad = 2.0;
long double al = 2.0L;
float bf = 10.0F;
double bd = 10.0;
long double bl = 10.0L;
float cf = std::numeric_limits<float>::quiet_NaN();
double cd = std::numeric_limits<double>::quiet_NaN();
long double cl = std::numeric_limits<long double>::quiet_NaN();
float xf = 0.5F;
double xd = 0.5;
long double xl = 0.5L;
float a = __gnu_cxx::hyperg(af, bf, cf, xf);
float b = __gnu_cxx::hypergf(af, bf, cf, xf);
double c = __gnu_cxx::hyperg(ad, bd, cd, xd);
long double d = __gnu_cxx::hyperg(al, bl, cl, xl);
long double e = __gnu_cxx::hypergl(al, bl, cl, xl);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
void
test04()
{
float af = 2.0F;
double ad = 2.0;
long double al = 2.0L;
float bf = 10.0F;
double bd = 10.0;
long double bl = 10.0L;
float cf = 3.0F;
double cd = 3.0;
long double cl = 3.0L;
float xf = std::numeric_limits<float>::quiet_NaN();
double xd = std::numeric_limits<double>::quiet_NaN();
long double xl = std::numeric_limits<long double>::quiet_NaN();
float a = __gnu_cxx::hyperg(af, bf, cf, xf);
float b = __gnu_cxx::hypergf(af, bf, cf, xf);
double c = __gnu_cxx::hyperg(ad, bd, cd, xd);
long double d = __gnu_cxx::hyperg(al, bl, cl, xl);
long double e = __gnu_cxx::hypergl(al, bl, cl, xl);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
int
main()
{
test01();
test02();
test03();
test04();
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,40 @@
// { dg-do compile }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// hyperg
#include <cmath>
void
test01()
{
float af = 2.0F, bf = 10.0F, cf = 3.0F, xf = 0.5F;
double ad = 2.0, bd = 10.0, cd = 3.0, xd = 0.5;
long double al = 2.0L, bl = 10.0L, cl = 3.0L, xl = 0.5L;
__gnu_cxx::hyperg(af, bf, cf, xf);
__gnu_cxx::hypergf(af, bf, cf, xf);
__gnu_cxx::hyperg(ad, bd, cd, xd);
__gnu_cxx::hyperg(al, bl, cl, xl);
__gnu_cxx::hypergl(al, bl, cl, xl);
return;
}

View File

@ -61,6 +61,7 @@ if {[info exists tests_file] && [file exists $tests_file]} {
lappend subdirs "$srcdir/tr2"
lappend subdirs "$srcdir/decimal"
lappend subdirs "$srcdir/experimental"
lappend subdirs "$srcdir/special_functions"
verbose "subdirs are $subdirs"
# Find all the tests.

View File

@ -0,0 +1,58 @@
// { dg-require-c-std "" }
// { dg-add-options ieee }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.1 assoc_laguerre
#include <cmath>
#include <limits>
#include <testsuite_hooks.h>
void
test01()
{
bool test [[gnu::unused]] = true;
float xf = std::numeric_limits<float>::quiet_NaN();
double xd = std::numeric_limits<double>::quiet_NaN();
long double xl = std::numeric_limits<long double>::quiet_NaN();
unsigned int n = 2, m = 1;
float a = std::assoc_laguerre(n, m, xf);
float b = std::assoc_laguerref(n, m, xf);
double c = std::assoc_laguerre(n, m, xd);
long double d = std::assoc_laguerre(n, m, xl);
long double e = std::assoc_laguerrel(n, m, xl);
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
int
main()
{
test01();
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,40 @@
// { dg-do compile }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.1 assoc_laguerre
#include <cmath>
void
test01()
{
float xf = 0.5F;
double xd = 0.5;
long double xl = 0.5L;
unsigned int n = 2, m = 1;
std::assoc_laguerre(n, m, xf);
std::assoc_laguerref(n, m, xf);
std::assoc_laguerre(n, m, xd);
std::assoc_laguerre(n, m, xl);
std::assoc_laguerrel(n, m, xl);
return;
}

View File

@ -0,0 +1,42 @@
// { dg-do compile { xfail *-*-* } }
// { dg-excess-errors "" }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.1 assoc_laguerre
#include <math.h>
void
test01()
{
float xf = 0.5F;
double xd = 0.5;
long double xl = 0.5L;
unsigned int n = 2, m = 1;
assoc_laguerre(n, m, xf);
assoc_laguerref(n, m, xf);
assoc_laguerre(n, m, xd);
assoc_laguerre(n, m, xl);
assoc_laguerrel(n, m, xl);
return;
}

View File

@ -0,0 +1,58 @@
// { dg-require-c-std "" }
// { dg-add-options ieee }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.2 assoc_legendre
#include <cmath>
#include <testsuite_hooks.h>
void
test01()
{
float xf = std::numeric_limits<float>::quiet_NaN();
double xd = std::numeric_limits<double>::quiet_NaN();
long double xl = std::numeric_limits<long double>::quiet_NaN();
unsigned int l = 2, m = 1;
float a = std::assoc_legendre(l, m, xf);
float b = std::assoc_legendref(l, m, xf);
double c = std::assoc_legendre(l, m, xd);
long double d = std::assoc_legendre(l, m, xl);
long double e = std::assoc_legendrel(l, m, xl);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
int
main()
{
test01();
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,41 @@
// { dg-do compile }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.2 assoc_legendre
#include <cmath>
void
test01()
{
float xf = 0.5F;
double xd = 0.5;
long double xl = 0.5L;
unsigned int l = 2, m = 1;
std::assoc_legendre(l, m, xf);
std::assoc_legendref(l, m, xf);
std::assoc_legendre(l, m, xd);
std::assoc_legendre(l, m, xl);
std::assoc_legendrel(l, m, xl);
return;
}

View File

@ -0,0 +1,42 @@
// { dg-do compile { xfail *-*-* } }
// { dg-excess-errors "" }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.2 assoc_legendre
#include <math.h>
void
test01()
{
float xf = 0.5F;
double xd = 0.5;
long double xl = 0.5L;
unsigned int l = 2, m = 1;
assoc_legendre(l, m, xf);
assoc_legendref(l, m, xf);
assoc_legendre(l, m, xd);
assoc_legendre(l, m, xl);
assoc_legendrel(l, m, xl);
return;
}

View File

@ -0,0 +1,88 @@
// { dg-require-c-std "" }
// { dg-add-options ieee }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.3 beta
#include <cmath>
#include <testsuite_hooks.h>
void
test01()
{
float xf = std::numeric_limits<float>::quiet_NaN();
double xd = std::numeric_limits<double>::quiet_NaN();
long double xl = std::numeric_limits<long double>::quiet_NaN();
float yf = 0.0F;
double yd = 0.0;
long double yl = 0.0L;
float a = std::beta(xf, yf);
float b = std::betaf(xf, yf);
double c = std::beta(xd, yd);
long double d = std::beta(xl, yl);
long double e = std::betal(xl, yl);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
void
test02()
{
float xf = 1.0F;
double xd = 1.0;
long double xl = 1.0L;
float yf = std::numeric_limits<float>::quiet_NaN();
double yd = std::numeric_limits<double>::quiet_NaN();
long double yl = std::numeric_limits<long double>::quiet_NaN();
float a = std::beta(xf, yf);
float b = std::betaf(xf, yf);
double c = std::beta(xd, yd);
long double d = std::beta(xl, yl);
long double e = std::betal(xl, yl);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
int
main()
{
test01();
test02();
return 0;
}

View File

@ -0,0 +1,271 @@
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
//
// Copyright (C) 2016 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/>.
// beta
// Compare against values generated by the GNU Scientific Library.
// The GSL can be found on the web: http://www.gnu.org/software/gsl/
#include <limits>
#include <cmath>
#if defined(__TEST_DEBUG)
# include <iostream>
# define VERIFY(A) \
if (!(A)) \
{ \
std::cout << "line " << __LINE__ \
<< " max_abs_frac = " << max_abs_frac \
<< std::endl; \
}
#else
# include <testsuite_hooks.h>
#endif
#include <specfun_testcase.h>
// Test data for x=10.000000000000000.
// max(|f - f_GSL|): 2.1175823681357508e-21
// max(|f - f_GSL| / |f_GSL|): 9.9466182377295583e-14
const testcase_beta<double>
data001[10] =
{
{ 1.0825088224469029e-06, 10.000000000000000, 10.000000000000000 },
{ 4.9925087406346778e-09, 10.000000000000000, 20.000000000000000 },
{ 1.5729567312509485e-10, 10.000000000000000, 30.000000000000000 },
{ 1.2168673582561288e-11, 10.000000000000000, 40.000000000000000 },
{ 1.5916380099863291e-12, 10.000000000000000, 50.000000000000000 },
{ 2.9408957938463963e-13, 10.000000000000000, 60.000000000000000 },
{ 6.9411637980691676e-14, 10.000000000000000, 70.000000000000000 },
{ 1.9665612972502651e-14, 10.000000000000000, 80.000000000000000 },
{ 6.4187824828154399e-15, 10.000000000000000, 90.000000000000000 },
{ 2.3455339739604842e-15, 10.000000000000000, 100.00000000000000 },
};
const double toler001 = 5.0000000000000029e-12;
// Test data for x=20.000000000000000.
// max(|f - f_GSL|): 1.9025154088719637e-23
// max(|f - f_GSL| / |f_GSL|): 3.8107402664859521e-15
const testcase_beta<double>
data002[10] =
{
{ 4.9925087406346778e-09, 20.000000000000000, 10.000000000000000 },
{ 7.2544445519248436e-13, 20.000000000000000, 20.000000000000000 },
{ 1.7681885473062028e-15, 20.000000000000000, 30.000000000000000 },
{ 1.7891885039182335e-17, 20.000000000000000, 40.000000000000000 },
{ 4.3240677875623635e-19, 20.000000000000000, 50.000000000000000 },
{ 1.8857342309689050e-20, 20.000000000000000, 60.000000000000000 },
{ 1.2609804003539998e-21, 20.000000000000000, 70.000000000000000 },
{ 1.1660809542079041e-22, 20.000000000000000, 80.000000000000000 },
{ 1.3907944279729071e-23, 20.000000000000000, 90.000000000000000 },
{ 2.0365059099917614e-24, 20.000000000000000, 100.00000000000000 },
};
const double toler002 = 2.5000000000000020e-13;
// Test data for x=30.000000000000000.
// max(|f - f_GSL|): 9.0472879497987402e-25
// max(|f - f_GSL| / |f_GSL|): 5.7517716603708290e-15
const testcase_beta<double>
data003[10] =
{
{ 1.5729567312509485e-10, 30.000000000000000, 10.000000000000000 },
{ 1.7681885473062028e-15, 30.000000000000000, 20.000000000000000 },
{ 5.6370779640482451e-19, 30.000000000000000, 30.000000000000000 },
{ 1.0539424603796547e-21, 30.000000000000000, 40.000000000000000 },
{ 6.0118197777273836e-24, 30.000000000000000, 50.000000000000000 },
{ 7.4279528553260165e-26, 30.000000000000000, 60.000000000000000 },
{ 1.6212207780604767e-27, 30.000000000000000, 70.000000000000000 },
{ 5.4783729715317616e-29, 30.000000000000000, 80.000000000000000 },
{ 2.6183005659681346e-30, 30.000000000000000, 90.000000000000000 },
{ 1.6587948222122229e-31, 30.000000000000000, 100.00000000000000 },
};
const double toler003 = 5.0000000000000039e-13;
// Test data for x=40.000000000000000.
// max(|f - f_GSL|): 2.6495628995839168e-25
// max(|f - f_GSL| / |f_GSL|): 2.1773637706750213e-14
const testcase_beta<double>
data004[10] =
{
{ 1.2168673582561288e-11, 40.000000000000000, 10.000000000000000 },
{ 1.7891885039182335e-17, 40.000000000000000, 20.000000000000000 },
{ 1.0539424603796547e-21, 40.000000000000000, 30.000000000000000 },
{ 4.6508509140090659e-25, 40.000000000000000, 40.000000000000000 },
{ 7.5161712118557719e-28, 40.000000000000000, 50.000000000000000 },
{ 3.0311331979886071e-30, 40.000000000000000, 60.000000000000000 },
{ 2.4175035070466313e-32, 40.000000000000000, 70.000000000000000 },
{ 3.2734839142758369e-34, 40.000000000000000, 80.000000000000000 },
{ 6.7690629601315579e-36, 40.000000000000000, 90.000000000000000 },
{ 1.9797337118812366e-37, 40.000000000000000, 100.00000000000000 },
};
const double toler004 = 2.5000000000000015e-12;
// Test data for x=50.000000000000000.
// max(|f - f_GSL|): 2.4603755039546938e-32
// max(|f - f_GSL| / |f_GSL|): 0.0000000000000000
const testcase_beta<double>
data005[10] =
{
{ 1.5916380099863291e-12, 50.000000000000000, 10.000000000000000 },
{ 4.3240677875623635e-19, 50.000000000000000, 20.000000000000000 },
{ 6.0118197777273836e-24, 50.000000000000000, 30.000000000000000 },
{ 7.5161712118557719e-28, 50.000000000000000, 40.000000000000000 },
{ 3.9646612085674138e-31, 50.000000000000000, 50.000000000000000 },
{ 5.8425643906418403e-34, 50.000000000000000, 60.000000000000000 },
{ 1.8672362180783552e-36, 50.000000000000000, 70.000000000000000 },
{ 1.0939382296458962e-38, 50.000000000000000, 80.000000000000000 },
{ 1.0442781609881063e-40, 50.000000000000000, 90.000000000000000 },
{ 1.4904121110954370e-42, 50.000000000000000, 100.00000000000000 },
};
const double toler005 = 2.5000000000000020e-13;
// Test data for x=60.000000000000000.
// max(|f - f_GSL|): 2.1911400503418824e-26
// max(|f - f_GSL| / |f_GSL|): 7.4505871813842522e-14
const testcase_beta<double>
data006[10] =
{
{ 2.9408957938463963e-13, 60.000000000000000, 10.000000000000000 },
{ 1.8857342309689050e-20, 60.000000000000000, 20.000000000000000 },
{ 7.4279528553260165e-26, 60.000000000000000, 30.000000000000000 },
{ 3.0311331979886071e-30, 60.000000000000000, 40.000000000000000 },
{ 5.8425643906418403e-34, 60.000000000000000, 50.000000000000000 },
{ 3.4501231469782229e-37, 60.000000000000000, 60.000000000000000 },
{ 4.7706855386086599e-40, 60.000000000000000, 70.000000000000000 },
{ 1.2902663809722593e-42, 60.000000000000000, 80.000000000000000 },
{ 6.0105571058570508e-45, 60.000000000000000, 90.000000000000000 },
{ 4.3922898898347209e-47, 60.000000000000000, 100.00000000000000 },
};
const double toler006 = 5.0000000000000029e-12;
// Test data for x=70.000000000000000.
// max(|f - f_GSL|): 6.9041106424942953e-27
// max(|f - f_GSL| / |f_GSL|): 9.9466182377295583e-14
const testcase_beta<double>
data007[10] =
{
{ 6.9411637980691676e-14, 70.000000000000000, 10.000000000000000 },
{ 1.2609804003539998e-21, 70.000000000000000, 20.000000000000000 },
{ 1.6212207780604767e-27, 70.000000000000000, 30.000000000000000 },
{ 2.4175035070466313e-32, 70.000000000000000, 40.000000000000000 },
{ 1.8672362180783552e-36, 70.000000000000000, 50.000000000000000 },
{ 4.7706855386086599e-40, 70.000000000000000, 60.000000000000000 },
{ 3.0453137143486369e-43, 70.000000000000000, 70.000000000000000 },
{ 4.0192274082013779e-46, 70.000000000000000, 80.000000000000000 },
{ 9.5865870063501807e-49, 70.000000000000000, 90.000000000000000 },
{ 3.7409127305819802e-51, 70.000000000000000, 100.00000000000000 },
};
const double toler007 = 5.0000000000000029e-12;
// Test data for x=80.000000000000000.
// max(|f - f_GSL|): 1.6786960063103131e-27
// max(|f - f_GSL| / |f_GSL|): 8.5361997546557118e-14
const testcase_beta<double>
data008[10] =
{
{ 1.9665612972502651e-14, 80.000000000000000, 10.000000000000000 },
{ 1.1660809542079041e-22, 80.000000000000000, 20.000000000000000 },
{ 5.4783729715317616e-29, 80.000000000000000, 30.000000000000000 },
{ 3.2734839142758369e-34, 80.000000000000000, 40.000000000000000 },
{ 1.0939382296458962e-38, 80.000000000000000, 50.000000000000000 },
{ 1.2902663809722593e-42, 80.000000000000000, 60.000000000000000 },
{ 4.0192274082013779e-46, 80.000000000000000, 70.000000000000000 },
{ 2.7160590828669411e-49, 80.000000000000000, 80.000000000000000 },
{ 3.4593773902125368e-52, 80.000000000000000, 90.000000000000000 },
{ 7.4807039968503468e-55, 80.000000000000000, 100.00000000000000 },
};
const double toler008 = 5.0000000000000029e-12;
// Test data for x=90.000000000000000.
// max(|f - f_GSL|): 2.7373473411169110e-28
// max(|f - f_GSL| / |f_GSL|): 4.2645896608047095e-14
const testcase_beta<double>
data009[10] =
{
{ 6.4187824828154399e-15, 90.000000000000000, 10.000000000000000 },
{ 1.3907944279729071e-23, 90.000000000000000, 20.000000000000000 },
{ 2.6183005659681346e-30, 90.000000000000000, 30.000000000000000 },
{ 6.7690629601315579e-36, 90.000000000000000, 40.000000000000000 },
{ 1.0442781609881063e-40, 90.000000000000000, 50.000000000000000 },
{ 6.0105571058570508e-45, 90.000000000000000, 60.000000000000000 },
{ 9.5865870063501807e-49, 90.000000000000000, 70.000000000000000 },
{ 3.4593773902125368e-52, 90.000000000000000, 80.000000000000000 },
{ 2.4416737907558032e-55, 90.000000000000000, 90.000000000000000 },
{ 3.0238531916564246e-58, 90.000000000000000, 100.00000000000000 },
};
const double toler009 = 2.5000000000000015e-12;
// Test data for x=100.00000000000000.
// max(|f - f_GSL|): 1.6960509462251754e-29
// max(|f - f_GSL| / |f_GSL|): 7.2309800883478868e-15
const testcase_beta<double>
data010[10] =
{
{ 2.3455339739604842e-15, 100.00000000000000, 10.000000000000000 },
{ 2.0365059099917614e-24, 100.00000000000000, 20.000000000000000 },
{ 1.6587948222122229e-31, 100.00000000000000, 30.000000000000000 },
{ 1.9797337118812366e-37, 100.00000000000000, 40.000000000000000 },
{ 1.4904121110954370e-42, 100.00000000000000, 50.000000000000000 },
{ 4.3922898898347209e-47, 100.00000000000000, 60.000000000000000 },
{ 3.7409127305819802e-51, 100.00000000000000, 70.000000000000000 },
{ 7.4807039968503468e-55, 100.00000000000000, 80.000000000000000 },
{ 3.0238531916564246e-58, 100.00000000000000, 90.000000000000000 },
{ 2.2087606931991853e-61, 100.00000000000000, 100.00000000000000 },
};
const double toler010 = 5.0000000000000039e-13;
template<typename Tp, unsigned int Num>
void
test(const testcase_beta<Tp> (&data)[Num], Tp toler)
{
bool test __attribute__((unused)) = true;
const Tp eps = std::numeric_limits<Tp>::epsilon();
Tp max_abs_diff = -Tp(1);
Tp max_abs_frac = -Tp(1);
unsigned int num_datum = Num;
for (unsigned int i = 0; i < num_datum; ++i)
{
const Tp f = std::beta(data[i].x, data[i].y);
const Tp f0 = data[i].f0;
const Tp diff = f - f0;
if (std::abs(diff) > max_abs_diff)
max_abs_diff = std::abs(diff);
if (std::abs(f0) > Tp(10) * eps
&& std::abs(f) > Tp(10) * eps)
{
const Tp frac = diff / f0;
if (std::abs(frac) > max_abs_frac)
max_abs_frac = std::abs(frac);
}
}
VERIFY(max_abs_frac < toler);
}
int
main()
{
test(data001, toler001);
test(data002, toler002);
test(data003, toler003);
test(data004, toler004);
test(data005, toler005);
test(data006, toler006);
test(data007, toler007);
test(data008, toler008);
test(data009, toler009);
test(data010, toler010);
return 0;
}

View File

@ -0,0 +1,40 @@
// { dg-do compile }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.3 beta
#include <cmath>
void
test01()
{
float xf = 0.5F, yf = 0.5F;
double xd = 0.5, yd = 0.5;
long double xl = 0.5L, yl = 0.5L;
std::beta(xf, yf);
std::betaf(xf, yf);
std::beta(xd, yd);
std::beta(xl, yl);
std::betal(xl, yl);
return;
}

View File

@ -0,0 +1,41 @@
// { dg-do compile { xfail *-*-* } }
// { dg-excess-errors "" }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.3 beta
#include <math.h>
void
test01()
{
float xf = 0.5F, yf = 0.5F;
double xd = 0.5, yd = 0.5;
long double xl = 0.5L, yl = 0.5L;
beta(xf, yf);
betaf(xf, yf);
beta(xd, yd);
beta(xl, yl);
betal(xl, yl);
return;
}

View File

@ -0,0 +1,56 @@
// { dg-require-c-std "" }
// { dg-add-options ieee }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.4 comp_ellint_1
#include <cmath>
#include <testsuite_hooks.h>
void
test01()
{
float kf = std::numeric_limits<float>::quiet_NaN();
double kd = std::numeric_limits<double>::quiet_NaN();
long double kl = std::numeric_limits<long double>::quiet_NaN();
float a = std::comp_ellint_1(kf);
float b = std::comp_ellint_1f(kf);
double c = std::comp_ellint_1(kd);
long double d = std::comp_ellint_1(kl);
long double e = std::comp_ellint_1l(kl);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
int
main()
{
test01();
return 0;
}

View File

@ -0,0 +1,100 @@
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
//
// Copyright (C) 2016 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/>.
// comp_ellint_1
// Compare against values generated by the GNU Scientific Library.
// The GSL can be found on the web: http://www.gnu.org/software/gsl/
#include <limits>
#include <cmath>
#if defined(__TEST_DEBUG)
# include <iostream>
# define VERIFY(A) \
if (!(A)) \
{ \
std::cout << "line " << __LINE__ \
<< " max_abs_frac = " << max_abs_frac \
<< std::endl; \
}
#else
# include <testsuite_hooks.h>
#endif
#include <specfun_testcase.h>
// Test data.
// max(|f - f_GSL|): 6.6613381477509392e-16
// max(|f - f_GSL| / |f_GSL|): 4.0617918857203532e-16
const testcase_comp_ellint_1<double>
data001[19] =
{
{ 2.2805491384227703, -0.90000000000000002 },
{ 1.9953027776647296, -0.80000000000000004 },
{ 1.8456939983747236, -0.69999999999999996 },
{ 1.7507538029157526, -0.59999999999999998 },
{ 1.6857503548125963, -0.50000000000000000 },
{ 1.6399998658645112, -0.40000000000000002 },
{ 1.6080486199305128, -0.30000000000000004 },
{ 1.5868678474541660, -0.19999999999999996 },
{ 1.5747455615173562, -0.099999999999999978 },
{ 1.5707963267948966, 0.0000000000000000 },
{ 1.5747455615173562, 0.10000000000000009 },
{ 1.5868678474541660, 0.19999999999999996 },
{ 1.6080486199305128, 0.30000000000000004 },
{ 1.6399998658645112, 0.39999999999999991 },
{ 1.6857503548125963, 0.50000000000000000 },
{ 1.7507538029157526, 0.60000000000000009 },
{ 1.8456939983747236, 0.69999999999999996 },
{ 1.9953027776647296, 0.80000000000000004 },
{ 2.2805491384227703, 0.89999999999999991 },
};
const double toler001 = 2.5000000000000020e-13;
template<typename Tp, unsigned int Num>
void
test(const testcase_comp_ellint_1<Tp> (&data)[Num], Tp toler)
{
bool test __attribute__((unused)) = true;
const Tp eps = std::numeric_limits<Tp>::epsilon();
Tp max_abs_diff = -Tp(1);
Tp max_abs_frac = -Tp(1);
unsigned int num_datum = Num;
for (unsigned int i = 0; i < num_datum; ++i)
{
const Tp f = std::comp_ellint_1(data[i].k);
const Tp f0 = data[i].f0;
const Tp diff = f - f0;
if (std::abs(diff) > max_abs_diff)
max_abs_diff = std::abs(diff);
if (std::abs(f0) > Tp(10) * eps
&& std::abs(f) > Tp(10) * eps)
{
const Tp frac = diff / f0;
if (std::abs(frac) > max_abs_frac)
max_abs_frac = std::abs(frac);
}
}
VERIFY(max_abs_frac < toler);
}
int
main()
{
test(data001, toler001);
return 0;
}

View File

@ -0,0 +1,40 @@
// { dg-do compile }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.4 comp_ellint_1
#include <cmath>
void
test01()
{
float kf = 0.5F;
double kd = 0.5;
long double kl = 0.5L;
std::comp_ellint_1(kf);
std::comp_ellint_1f(kf);
std::comp_ellint_1(kd);
std::comp_ellint_1(kl);
std::comp_ellint_1l(kl);
return;
}

View File

@ -0,0 +1,41 @@
// { dg-do compile { xfail *-*-* } }
// { dg-excess-errors "" }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.4 comp_ellint_1
#include <math.h>
void
test01()
{
float kf = 0.5F;
double kd = 0.5;
long double kl = 0.5L;
comp_ellint_1(kf);
comp_ellint_1f(kf);
comp_ellint_1(kd);
comp_ellint_1(kl);
comp_ellint_1l(kl);
return;
}

View File

@ -0,0 +1,56 @@
// { dg-require-c-std "" }
// { dg-add-options ieee }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.5 comp_ellint_2
#include <cmath>
#include <testsuite_hooks.h>
void
test01()
{
float kf = std::numeric_limits<float>::quiet_NaN();
double kd = std::numeric_limits<double>::quiet_NaN();
long double kl = std::numeric_limits<long double>::quiet_NaN();
float a = std::comp_ellint_2(kf);
float b = std::comp_ellint_2f(kf);
double c = std::comp_ellint_2(kd);
long double d = std::comp_ellint_2(kl);
long double e = std::comp_ellint_2l(kl);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
int
main()
{
test01();
return 0;
}

View File

@ -0,0 +1,100 @@
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
//
// Copyright (C) 2016 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/>.
// comp_ellint_2
// Compare against values generated by the GNU Scientific Library.
// The GSL can be found on the web: http://www.gnu.org/software/gsl/
#include <limits>
#include <cmath>
#if defined(__TEST_DEBUG)
# include <iostream>
# define VERIFY(A) \
if (!(A)) \
{ \
std::cout << "line " << __LINE__ \
<< " max_abs_frac = " << max_abs_frac \
<< std::endl; \
}
#else
# include <testsuite_hooks.h>
#endif
#include <specfun_testcase.h>
// Test data.
// max(|f - f_GSL|): 6.6613381477509392e-16
// max(|f - f_GSL| / |f_GSL|): 4.4233707954398090e-16
const testcase_comp_ellint_2<double>
data001[19] =
{
{ 1.1716970527816140, -0.90000000000000002 },
{ 1.2763499431699064, -0.80000000000000004 },
{ 1.3556611355719554, -0.69999999999999996 },
{ 1.4180833944487241, -0.59999999999999998 },
{ 1.4674622093394274, -0.50000000000000000 },
{ 1.5059416123600402, -0.40000000000000002 },
{ 1.5348334649232491, -0.30000000000000004 },
{ 1.5549685462425291, -0.19999999999999996 },
{ 1.5668619420216685, -0.099999999999999978 },
{ 1.5707963267948966, 0.0000000000000000 },
{ 1.5668619420216685, 0.10000000000000009 },
{ 1.5549685462425291, 0.19999999999999996 },
{ 1.5348334649232491, 0.30000000000000004 },
{ 1.5059416123600404, 0.39999999999999991 },
{ 1.4674622093394274, 0.50000000000000000 },
{ 1.4180833944487241, 0.60000000000000009 },
{ 1.3556611355719554, 0.69999999999999996 },
{ 1.2763499431699064, 0.80000000000000004 },
{ 1.1716970527816144, 0.89999999999999991 },
};
const double toler001 = 2.5000000000000020e-13;
template<typename Tp, unsigned int Num>
void
test(const testcase_comp_ellint_2<Tp> (&data)[Num], Tp toler)
{
bool test __attribute__((unused)) = true;
const Tp eps = std::numeric_limits<Tp>::epsilon();
Tp max_abs_diff = -Tp(1);
Tp max_abs_frac = -Tp(1);
unsigned int num_datum = Num;
for (unsigned int i = 0; i < num_datum; ++i)
{
const Tp f = std::comp_ellint_2(data[i].k);
const Tp f0 = data[i].f0;
const Tp diff = f - f0;
if (std::abs(diff) > max_abs_diff)
max_abs_diff = std::abs(diff);
if (std::abs(f0) > Tp(10) * eps
&& std::abs(f) > Tp(10) * eps)
{
const Tp frac = diff / f0;
if (std::abs(frac) > max_abs_frac)
max_abs_frac = std::abs(frac);
}
}
VERIFY(max_abs_frac < toler);
}
int
main()
{
test(data001, toler001);
return 0;
}

View File

@ -0,0 +1,40 @@
// { dg-do compile }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.5 comp_ellint_2
#include <cmath>
void
test01()
{
float kf = 0.5F;
double kd = 0.5;
long double kl = 0.5L;
std::comp_ellint_2(kf);
std::comp_ellint_2f(kf);
std::comp_ellint_2(kd);
std::comp_ellint_2(kl);
std::comp_ellint_2l(kl);
return;
}

View File

@ -0,0 +1,41 @@
// { dg-do compile { xfail *-*-* } }
// { dg-excess-errors "" }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.5 comp_ellint_2
#include <math.h>
void
test01()
{
float kf = 0.5F;
double kd = 0.5;
long double kl = 0.5L;
comp_ellint_2(kf);
comp_ellint_2f(kf);
comp_ellint_2(kd);
comp_ellint_2(kl);
comp_ellint_2l(kl);
return;
}

View File

@ -0,0 +1,88 @@
// { dg-require-c-std "" }
// { dg-add-options ieee }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.6 comp_ellint_3
#include <cmath>
#include <testsuite_hooks.h>
void
test01()
{
float kf = std::numeric_limits<float>::quiet_NaN();
double kd = std::numeric_limits<double>::quiet_NaN();
long double kl = std::numeric_limits<long double>::quiet_NaN();
float nuf = 0.0F;
double nud = 0.0;
long double nul = 0.0L;
float a = std::comp_ellint_3(kf, nuf);
float b = std::comp_ellint_3f(kf, nuf);
double c = std::comp_ellint_3(kd, nud);
long double d = std::comp_ellint_3(kl, nul);
long double e = std::comp_ellint_3l(kl, nul);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
void
test02()
{
float kf = 1.0F;
double kd = 1.0;
long double kl = 1.0L;
float nuf = std::numeric_limits<float>::quiet_NaN();
double nud = std::numeric_limits<double>::quiet_NaN();
long double nul = std::numeric_limits<long double>::quiet_NaN();
float a = std::comp_ellint_3(kf, nuf);
float b = std::comp_ellint_3f(kf, nuf);
double c = std::comp_ellint_3(kd, nud);
long double d = std::comp_ellint_3(kl, nul);
long double e = std::comp_ellint_3l(kl, nul);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
int
main()
{
test01();
test02();
return 0;
}

View File

@ -0,0 +1,451 @@
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
//
// Copyright (C) 2016 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/>.
// comp_ellint_3
// Compare against values generated by the GNU Scientific Library.
// The GSL can be found on the web: http://www.gnu.org/software/gsl/
#include <limits>
#include <cmath>
#if defined(__TEST_DEBUG)
# include <iostream>
# define VERIFY(A) \
if (!(A)) \
{ \
std::cout << "line " << __LINE__ \
<< " max_abs_frac = " << max_abs_frac \
<< std::endl; \
}
#else
# include <testsuite_hooks.h>
#endif
#include <specfun_testcase.h>
// Test data for k=-0.90000000000000002.
// max(|f - f_GSL|): 4.4408920985006262e-16
// max(|f - f_GSL| / |f_GSL|): 2.6751587294384150e-16
const testcase_comp_ellint_3<double>
data001[10] =
{
{ 2.2805491384227703, -0.90000000000000002, 0.0000000000000000 },
{ 2.1537868513875287, -0.90000000000000002, 0.10000000000000001 },
{ 2.0443194576468890, -0.90000000000000002, 0.20000000000000001 },
{ 1.9486280260314426, -0.90000000000000002, 0.29999999999999999 },
{ 1.8641114227238349, -0.90000000000000002, 0.40000000000000002 },
{ 1.7888013241937861, -0.90000000000000002, 0.50000000000000000 },
{ 1.7211781128919523, -0.90000000000000002, 0.59999999999999998 },
{ 1.6600480747670940, -0.90000000000000002, 0.69999999999999996 },
{ 1.6044591960982202, -0.90000000000000002, 0.80000000000000004 },
{ 1.5536420236310946, -0.90000000000000002, 0.90000000000000002 },
};
const double toler001 = 2.5000000000000020e-13;
// Test data for k=-0.80000000000000004.
// max(|f - f_GSL|): 2.2204460492503131e-16
// max(|f - f_GSL| / |f_GSL|): 1.5960830388244336e-16
const testcase_comp_ellint_3<double>
data002[10] =
{
{ 1.9953027776647296, -0.80000000000000004, 0.0000000000000000 },
{ 1.8910755418379521, -0.80000000000000004, 0.10000000000000001 },
{ 1.8007226661734588, -0.80000000000000004, 0.20000000000000001 },
{ 1.7214611048717301, -0.80000000000000004, 0.29999999999999999 },
{ 1.6512267838651289, -0.80000000000000004, 0.40000000000000002 },
{ 1.5884528947755532, -0.80000000000000004, 0.50000000000000000 },
{ 1.5319262547427865, -0.80000000000000004, 0.59999999999999998 },
{ 1.4806912324625332, -0.80000000000000004, 0.69999999999999996 },
{ 1.4339837018309471, -0.80000000000000004, 0.80000000000000004 },
{ 1.3911845406776222, -0.80000000000000004, 0.90000000000000002 },
};
const double toler002 = 2.5000000000000020e-13;
// Test data for k=-0.69999999999999996.
// max(|f - f_GSL|): 4.4408920985006262e-16
// max(|f - f_GSL| / |f_GSL|): 3.3074070916136724e-16
const testcase_comp_ellint_3<double>
data003[10] =
{
{ 1.8456939983747236, -0.69999999999999996, 0.0000000000000000 },
{ 1.7528050171757608, -0.69999999999999996, 0.10000000000000001 },
{ 1.6721098780092145, -0.69999999999999996, 0.20000000000000001 },
{ 1.6011813647733213, -0.69999999999999996, 0.29999999999999999 },
{ 1.5382162002954762, -0.69999999999999996, 0.40000000000000002 },
{ 1.4818433192178544, -0.69999999999999996, 0.50000000000000000 },
{ 1.4309994736080540, -0.69999999999999996, 0.59999999999999998 },
{ 1.3848459188329196, -0.69999999999999996, 0.69999999999999996 },
{ 1.3427110650397531, -0.69999999999999996, 0.80000000000000004 },
{ 1.3040500499695913, -0.69999999999999996, 0.90000000000000002 },
};
const double toler003 = 2.5000000000000020e-13;
// Test data for k=-0.59999999999999998.
// max(|f - f_GSL|): 6.6613381477509392e-16
// max(|f - f_GSL| / |f_GSL|): 4.1891472451898755e-16
const testcase_comp_ellint_3<double>
data004[10] =
{
{ 1.7507538029157526, -0.59999999999999998, 0.0000000000000000 },
{ 1.6648615773343014, -0.59999999999999998, 0.10000000000000001 },
{ 1.5901418016279374, -0.59999999999999998, 0.20000000000000001 },
{ 1.5243814243493585, -0.59999999999999998, 0.29999999999999999 },
{ 1.4659345278069984, -0.59999999999999998, 0.40000000000000002 },
{ 1.4135484285693078, -0.59999999999999998, 0.50000000000000000 },
{ 1.3662507535812816, -0.59999999999999998, 0.59999999999999998 },
{ 1.3232737468822813, -0.59999999999999998, 0.69999999999999996 },
{ 1.2840021261752192, -0.59999999999999998, 0.80000000000000004 },
{ 1.2479362973851875, -0.59999999999999998, 0.90000000000000002 },
};
const double toler004 = 2.5000000000000020e-13;
// Test data for k=-0.50000000000000000.
// max(|f - f_GSL|): 2.2204460492503131e-16
// max(|f - f_GSL| / |f_GSL|): 1.7857620325589816e-16
const testcase_comp_ellint_3<double>
data005[10] =
{
{ 1.6857503548125963, -0.50000000000000000, 0.0000000000000000 },
{ 1.6045524936084892, -0.50000000000000000, 0.10000000000000001 },
{ 1.5338490483665983, -0.50000000000000000, 0.20000000000000001 },
{ 1.4715681939859637, -0.50000000000000000, 0.29999999999999999 },
{ 1.4161679518465340, -0.50000000000000000, 0.40000000000000002 },
{ 1.3664739530045971, -0.50000000000000000, 0.50000000000000000 },
{ 1.3215740290190876, -0.50000000000000000, 0.59999999999999998 },
{ 1.2807475181182502, -0.50000000000000000, 0.69999999999999996 },
{ 1.2434165408189539, -0.50000000000000000, 0.80000000000000004 },
{ 1.2091116095504744, -0.50000000000000000, 0.90000000000000002 },
};
const double toler005 = 2.5000000000000020e-13;
// Test data for k=-0.40000000000000002.
// max(|f - f_GSL|): 8.8817841970012523e-16
// max(|f - f_GSL| / |f_GSL|): 6.1925080711125793e-16
const testcase_comp_ellint_3<double>
data006[10] =
{
{ 1.6399998658645112, -0.40000000000000002, 0.0000000000000000 },
{ 1.5620566886683604, -0.40000000000000002, 0.10000000000000001 },
{ 1.4941414344266770, -0.40000000000000002, 0.20000000000000001 },
{ 1.4342789859950078, -0.40000000000000002, 0.29999999999999999 },
{ 1.3809986210732901, -0.40000000000000002, 0.40000000000000002 },
{ 1.3331797176377398, -0.40000000000000002, 0.50000000000000000 },
{ 1.2899514672527024, -0.40000000000000002, 0.59999999999999998 },
{ 1.2506255923253344, -0.40000000000000002, 0.69999999999999996 },
{ 1.2146499565727209, -0.40000000000000002, 0.80000000000000004 },
{ 1.1815758115929846, -0.40000000000000002, 0.90000000000000002 },
};
const double toler006 = 2.5000000000000020e-13;
// Test data for k=-0.30000000000000004.
// max(|f - f_GSL|): 4.4408920985006262e-16
// max(|f - f_GSL| / |f_GSL|): 3.8209844149902043e-16
const testcase_comp_ellint_3<double>
data007[10] =
{
{ 1.6080486199305128, -0.30000000000000004, 0.0000000000000000 },
{ 1.5323534693557528, -0.30000000000000004, 0.10000000000000001 },
{ 1.4663658145259877, -0.30000000000000004, 0.20000000000000001 },
{ 1.4081767433479091, -0.30000000000000004, 0.29999999999999999 },
{ 1.3563643538969763, -0.30000000000000004, 0.40000000000000002 },
{ 1.3098448759814962, -0.30000000000000004, 0.50000000000000000 },
{ 1.2677758800420669, -0.30000000000000004, 0.59999999999999998 },
{ 1.2294913236274982, -0.30000000000000004, 0.69999999999999996 },
{ 1.1944567571590048, -0.30000000000000004, 0.80000000000000004 },
{ 1.1622376896064914, -0.30000000000000004, 0.90000000000000002 },
};
const double toler007 = 2.5000000000000020e-13;
// Test data for k=-0.19999999999999996.
// max(|f - f_GSL|): 4.4408920985006262e-16
// max(|f - f_GSL| / |f_GSL|): 3.8637687241174905e-16
const testcase_comp_ellint_3<double>
data008[10] =
{
{ 1.5868678474541660, -0.19999999999999996, 0.0000000000000000 },
{ 1.5126513474261087, -0.19999999999999996, 0.10000000000000001 },
{ 1.4479323932249564, -0.19999999999999996, 0.20000000000000001 },
{ 1.3908453514752477, -0.19999999999999996, 0.29999999999999999 },
{ 1.3400002519661005, -0.19999999999999996, 0.40000000000000002 },
{ 1.2943374404397372, -0.19999999999999996, 0.50000000000000000 },
{ 1.2530330675914556, -0.19999999999999996, 0.59999999999999998 },
{ 1.2154356555075863, -0.19999999999999996, 0.69999999999999996 },
{ 1.1810223448909909, -0.19999999999999996, 0.80000000000000004 },
{ 1.1493679916141861, -0.19999999999999996, 0.90000000000000002 },
};
const double toler008 = 2.5000000000000020e-13;
// Test data for k=-0.099999999999999978.
// max(|f - f_GSL|): 4.4408920985006262e-16
// max(|f - f_GSL| / |f_GSL|): 3.8887517676790089e-16
const testcase_comp_ellint_3<double>
data009[10] =
{
{ 1.5747455615173562, -0.099999999999999978, 0.0000000000000000 },
{ 1.5013711111199950, -0.099999999999999978, 0.10000000000000001 },
{ 1.4373749386463430, -0.099999999999999978, 0.20000000000000001 },
{ 1.3809159606704959, -0.099999999999999978, 0.29999999999999999 },
{ 1.3306223265207477, -0.099999999999999978, 0.40000000000000002 },
{ 1.2854480708580160, -0.099999999999999978, 0.50000000000000000 },
{ 1.2445798942989255, -0.099999999999999978, 0.59999999999999998 },
{ 1.2073745911083185, -0.099999999999999978, 0.69999999999999996 },
{ 1.1733158866987732, -0.099999999999999978, 0.80000000000000004 },
{ 1.1419839485283374, -0.099999999999999978, 0.90000000000000002 },
};
const double toler009 = 2.5000000000000020e-13;
// Test data for k=0.0000000000000000.
// max(|f - f_GSL|): 2.2204460492503131e-16
// max(|f - f_GSL| / |f_GSL|): 1.6725702444488137e-16
const testcase_comp_ellint_3<double>
data010[10] =
{
{ 1.5707963267948966, 0.0000000000000000, 0.0000000000000000 },
{ 1.4976955329233277, 0.0000000000000000, 0.10000000000000001 },
{ 1.4339343023863691, 0.0000000000000000, 0.20000000000000001 },
{ 1.3776795151134889, 0.0000000000000000, 0.29999999999999999 },
{ 1.3275651989026320, 0.0000000000000000, 0.40000000000000002 },
{ 1.2825498301618641, 0.0000000000000000, 0.50000000000000000 },
{ 1.2418235332245127, 0.0000000000000000, 0.59999999999999998 },
{ 1.2047457872617382, 0.0000000000000000, 0.69999999999999996 },
{ 1.1708024551734544, 0.0000000000000000, 0.80000000000000004 },
{ 1.1395754288497419, 0.0000000000000000, 0.90000000000000002 },
};
const double toler010 = 2.5000000000000020e-13;
// Test data for k=0.10000000000000009.
// max(|f - f_GSL|): 4.4408920985006262e-16
// max(|f - f_GSL| / |f_GSL|): 3.8887517676790089e-16
const testcase_comp_ellint_3<double>
data011[10] =
{
{ 1.5747455615173562, 0.10000000000000009, 0.0000000000000000 },
{ 1.5013711111199950, 0.10000000000000009, 0.10000000000000001 },
{ 1.4373749386463430, 0.10000000000000009, 0.20000000000000001 },
{ 1.3809159606704959, 0.10000000000000009, 0.29999999999999999 },
{ 1.3306223265207477, 0.10000000000000009, 0.40000000000000002 },
{ 1.2854480708580160, 0.10000000000000009, 0.50000000000000000 },
{ 1.2445798942989255, 0.10000000000000009, 0.59999999999999998 },
{ 1.2073745911083185, 0.10000000000000009, 0.69999999999999996 },
{ 1.1733158866987732, 0.10000000000000009, 0.80000000000000004 },
{ 1.1419839485283374, 0.10000000000000009, 0.90000000000000002 },
};
const double toler011 = 2.5000000000000020e-13;
// Test data for k=0.19999999999999996.
// max(|f - f_GSL|): 4.4408920985006262e-16
// max(|f - f_GSL| / |f_GSL|): 3.8637687241174905e-16
const testcase_comp_ellint_3<double>
data012[10] =
{
{ 1.5868678474541660, 0.19999999999999996, 0.0000000000000000 },
{ 1.5126513474261087, 0.19999999999999996, 0.10000000000000001 },
{ 1.4479323932249564, 0.19999999999999996, 0.20000000000000001 },
{ 1.3908453514752477, 0.19999999999999996, 0.29999999999999999 },
{ 1.3400002519661005, 0.19999999999999996, 0.40000000000000002 },
{ 1.2943374404397372, 0.19999999999999996, 0.50000000000000000 },
{ 1.2530330675914556, 0.19999999999999996, 0.59999999999999998 },
{ 1.2154356555075863, 0.19999999999999996, 0.69999999999999996 },
{ 1.1810223448909909, 0.19999999999999996, 0.80000000000000004 },
{ 1.1493679916141861, 0.19999999999999996, 0.90000000000000002 },
};
const double toler012 = 2.5000000000000020e-13;
// Test data for k=0.30000000000000004.
// max(|f - f_GSL|): 4.4408920985006262e-16
// max(|f - f_GSL| / |f_GSL|): 3.8209844149902043e-16
const testcase_comp_ellint_3<double>
data013[10] =
{
{ 1.6080486199305128, 0.30000000000000004, 0.0000000000000000 },
{ 1.5323534693557528, 0.30000000000000004, 0.10000000000000001 },
{ 1.4663658145259877, 0.30000000000000004, 0.20000000000000001 },
{ 1.4081767433479091, 0.30000000000000004, 0.29999999999999999 },
{ 1.3563643538969763, 0.30000000000000004, 0.40000000000000002 },
{ 1.3098448759814962, 0.30000000000000004, 0.50000000000000000 },
{ 1.2677758800420669, 0.30000000000000004, 0.59999999999999998 },
{ 1.2294913236274982, 0.30000000000000004, 0.69999999999999996 },
{ 1.1944567571590048, 0.30000000000000004, 0.80000000000000004 },
{ 1.1622376896064914, 0.30000000000000004, 0.90000000000000002 },
};
const double toler013 = 2.5000000000000020e-13;
// Test data for k=0.39999999999999991.
// max(|f - f_GSL|): 8.8817841970012523e-16
// max(|f - f_GSL| / |f_GSL|): 6.1925080711125793e-16
const testcase_comp_ellint_3<double>
data014[10] =
{
{ 1.6399998658645112, 0.39999999999999991, 0.0000000000000000 },
{ 1.5620566886683604, 0.39999999999999991, 0.10000000000000001 },
{ 1.4941414344266770, 0.39999999999999991, 0.20000000000000001 },
{ 1.4342789859950078, 0.39999999999999991, 0.29999999999999999 },
{ 1.3809986210732901, 0.39999999999999991, 0.40000000000000002 },
{ 1.3331797176377398, 0.39999999999999991, 0.50000000000000000 },
{ 1.2899514672527024, 0.39999999999999991, 0.59999999999999998 },
{ 1.2506255923253344, 0.39999999999999991, 0.69999999999999996 },
{ 1.2146499565727209, 0.39999999999999991, 0.80000000000000004 },
{ 1.1815758115929846, 0.39999999999999991, 0.90000000000000002 },
};
const double toler014 = 2.5000000000000020e-13;
// Test data for k=0.50000000000000000.
// max(|f - f_GSL|): 2.2204460492503131e-16
// max(|f - f_GSL| / |f_GSL|): 1.7857620325589816e-16
const testcase_comp_ellint_3<double>
data015[10] =
{
{ 1.6857503548125963, 0.50000000000000000, 0.0000000000000000 },
{ 1.6045524936084892, 0.50000000000000000, 0.10000000000000001 },
{ 1.5338490483665983, 0.50000000000000000, 0.20000000000000001 },
{ 1.4715681939859637, 0.50000000000000000, 0.29999999999999999 },
{ 1.4161679518465340, 0.50000000000000000, 0.40000000000000002 },
{ 1.3664739530045971, 0.50000000000000000, 0.50000000000000000 },
{ 1.3215740290190876, 0.50000000000000000, 0.59999999999999998 },
{ 1.2807475181182502, 0.50000000000000000, 0.69999999999999996 },
{ 1.2434165408189539, 0.50000000000000000, 0.80000000000000004 },
{ 1.2091116095504744, 0.50000000000000000, 0.90000000000000002 },
};
const double toler015 = 2.5000000000000020e-13;
// Test data for k=0.60000000000000009.
// max(|f - f_GSL|): 6.6613381477509392e-16
// max(|f - f_GSL| / |f_GSL|): 4.7124937590522226e-16
const testcase_comp_ellint_3<double>
data016[10] =
{
{ 1.7507538029157526, 0.60000000000000009, 0.0000000000000000 },
{ 1.6648615773343014, 0.60000000000000009, 0.10000000000000001 },
{ 1.5901418016279374, 0.60000000000000009, 0.20000000000000001 },
{ 1.5243814243493585, 0.60000000000000009, 0.29999999999999999 },
{ 1.4659345278069984, 0.60000000000000009, 0.40000000000000002 },
{ 1.4135484285693078, 0.60000000000000009, 0.50000000000000000 },
{ 1.3662507535812816, 0.60000000000000009, 0.59999999999999998 },
{ 1.3232737468822813, 0.60000000000000009, 0.69999999999999996 },
{ 1.2840021261752192, 0.60000000000000009, 0.80000000000000004 },
{ 1.2479362973851873, 0.60000000000000009, 0.90000000000000002 },
};
const double toler016 = 2.5000000000000020e-13;
// Test data for k=0.69999999999999996.
// max(|f - f_GSL|): 4.4408920985006262e-16
// max(|f - f_GSL| / |f_GSL|): 3.3074070916136724e-16
const testcase_comp_ellint_3<double>
data017[10] =
{
{ 1.8456939983747236, 0.69999999999999996, 0.0000000000000000 },
{ 1.7528050171757608, 0.69999999999999996, 0.10000000000000001 },
{ 1.6721098780092145, 0.69999999999999996, 0.20000000000000001 },
{ 1.6011813647733213, 0.69999999999999996, 0.29999999999999999 },
{ 1.5382162002954762, 0.69999999999999996, 0.40000000000000002 },
{ 1.4818433192178544, 0.69999999999999996, 0.50000000000000000 },
{ 1.4309994736080540, 0.69999999999999996, 0.59999999999999998 },
{ 1.3848459188329196, 0.69999999999999996, 0.69999999999999996 },
{ 1.3427110650397531, 0.69999999999999996, 0.80000000000000004 },
{ 1.3040500499695913, 0.69999999999999996, 0.90000000000000002 },
};
const double toler017 = 2.5000000000000020e-13;
// Test data for k=0.80000000000000004.
// max(|f - f_GSL|): 2.2204460492503131e-16
// max(|f - f_GSL| / |f_GSL|): 1.5960830388244336e-16
const testcase_comp_ellint_3<double>
data018[10] =
{
{ 1.9953027776647296, 0.80000000000000004, 0.0000000000000000 },
{ 1.8910755418379521, 0.80000000000000004, 0.10000000000000001 },
{ 1.8007226661734588, 0.80000000000000004, 0.20000000000000001 },
{ 1.7214611048717301, 0.80000000000000004, 0.29999999999999999 },
{ 1.6512267838651289, 0.80000000000000004, 0.40000000000000002 },
{ 1.5884528947755532, 0.80000000000000004, 0.50000000000000000 },
{ 1.5319262547427865, 0.80000000000000004, 0.59999999999999998 },
{ 1.4806912324625332, 0.80000000000000004, 0.69999999999999996 },
{ 1.4339837018309471, 0.80000000000000004, 0.80000000000000004 },
{ 1.3911845406776222, 0.80000000000000004, 0.90000000000000002 },
};
const double toler018 = 2.5000000000000020e-13;
// Test data for k=0.89999999999999991.
// max(|f - f_GSL|): 4.4408920985006262e-16
// max(|f - f_GSL| / |f_GSL|): 2.6751587294384150e-16
const testcase_comp_ellint_3<double>
data019[10] =
{
{ 2.2805491384227703, 0.89999999999999991, 0.0000000000000000 },
{ 2.1537868513875287, 0.89999999999999991, 0.10000000000000001 },
{ 2.0443194576468895, 0.89999999999999991, 0.20000000000000001 },
{ 1.9486280260314426, 0.89999999999999991, 0.29999999999999999 },
{ 1.8641114227238351, 0.89999999999999991, 0.40000000000000002 },
{ 1.7888013241937863, 0.89999999999999991, 0.50000000000000000 },
{ 1.7211781128919525, 0.89999999999999991, 0.59999999999999998 },
{ 1.6600480747670940, 0.89999999999999991, 0.69999999999999996 },
{ 1.6044591960982202, 0.89999999999999991, 0.80000000000000004 },
{ 1.5536420236310948, 0.89999999999999991, 0.90000000000000002 },
};
const double toler019 = 2.5000000000000020e-13;
template<typename Tp, unsigned int Num>
void
test(const testcase_comp_ellint_3<Tp> (&data)[Num], Tp toler)
{
bool test __attribute__((unused)) = true;
const Tp eps = std::numeric_limits<Tp>::epsilon();
Tp max_abs_diff = -Tp(1);
Tp max_abs_frac = -Tp(1);
unsigned int num_datum = Num;
for (unsigned int i = 0; i < num_datum; ++i)
{
const Tp f = std::comp_ellint_3(data[i].k, data[i].nu);
const Tp f0 = data[i].f0;
const Tp diff = f - f0;
if (std::abs(diff) > max_abs_diff)
max_abs_diff = std::abs(diff);
if (std::abs(f0) > Tp(10) * eps
&& std::abs(f) > Tp(10) * eps)
{
const Tp frac = diff / f0;
if (std::abs(frac) > max_abs_frac)
max_abs_frac = std::abs(frac);
}
}
VERIFY(max_abs_frac < toler);
}
int
main()
{
test(data001, toler001);
test(data002, toler002);
test(data003, toler003);
test(data004, toler004);
test(data005, toler005);
test(data006, toler006);
test(data007, toler007);
test(data008, toler008);
test(data009, toler009);
test(data010, toler010);
test(data011, toler011);
test(data012, toler012);
test(data013, toler013);
test(data014, toler014);
test(data015, toler015);
test(data016, toler016);
test(data017, toler017);
test(data018, toler018);
test(data019, toler019);
return 0;
}

View File

@ -0,0 +1,40 @@
// { dg-do compile }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.6 comp_ellint_3
#include <cmath>
void
test01()
{
float kf = 0.5F, nuf = 0.5F;
double kd = 0.5, nud = 0.5;
long double kl = 0.5L, nul = 0.5L;
std::comp_ellint_3(kf, nuf);
std::comp_ellint_3f(kf, nuf);
std::comp_ellint_3(kd, nud);
std::comp_ellint_3(kl, nul);
std::comp_ellint_3l(kl, nul);
return;
}

View File

@ -0,0 +1,41 @@
// { dg-do compile { xfail *-*-* } }
// { dg-excess-errors "" }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.6 comp_ellint_3
#include <math.h>
void
test01()
{
float kf = 0.5F, nuf = 0.5F;
double kd = 0.5, nud = 0.5;
long double kl = 0.5L, nul = 0.5L;
comp_ellint_3(kf, nuf);
comp_ellint_3f(kf, nuf);
comp_ellint_3(kd, nud);
comp_ellint_3(kl, nul);
comp_ellint_3l(kl, nul);
return;
}

View File

@ -0,0 +1,88 @@
// { dg-require-c-std "" }
// { dg-add-options ieee }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.7 cyl_bessel_i
#include <cmath>
#include <testsuite_hooks.h>
void
test01()
{
float xf = std::numeric_limits<float>::quiet_NaN();
double xd = std::numeric_limits<double>::quiet_NaN();
long double xl = std::numeric_limits<long double>::quiet_NaN();
float nuf = 0.0F;
double nud = 0.0;
long double nul = 0.0L;
float a = std::cyl_bessel_i(nuf, xf);
float b = std::cyl_bessel_if(nuf, xf);
double c = std::cyl_bessel_i(nud, xd);
long double d = std::cyl_bessel_i(nul, xl);
long double e = std::cyl_bessel_il(nul, xl);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
void
test02()
{
float xf = 1.0F;
double xd = 1.0;
long double xl = 1.0L;
float nuf = std::numeric_limits<float>::quiet_NaN();
double nud = std::numeric_limits<double>::quiet_NaN();
long double nul = std::numeric_limits<long double>::quiet_NaN();
float a = std::cyl_bessel_i(nuf, xf);
float b = std::cyl_bessel_if(nuf, xf);
double c = std::cyl_bessel_i(nud, xd);
long double d = std::cyl_bessel_i(nul, xl);
long double e = std::cyl_bessel_il(nul, xl);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
int
main()
{
test01();
test02();
return 0;
}

View File

@ -0,0 +1,692 @@
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
//
// Copyright (C) 2016 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/>.
// cyl_bessel_i
// Compare against values generated by the GNU Scientific Library.
// The GSL can be found on the web: http://www.gnu.org/software/gsl/
#include <limits>
#include <cmath>
#if defined(__TEST_DEBUG)
# include <iostream>
# define VERIFY(A) \
if (!(A)) \
{ \
std::cout << "line " << __LINE__ \
<< " max_abs_frac = " << max_abs_frac \
<< std::endl; \
}
#else
# include <testsuite_hooks.h>
#endif
#include <specfun_testcase.h>
// Test data for nu=0.0000000000000000.
// max(|f - f_GSL|): 2.8421709430404007e-14
// max(|f - f_GSL| / |f_GSL|): 1.3916073135966565e-15
const testcase_cyl_bessel_i<double>
data001[21] =
{
{ 1.0000000000000000, 0.0000000000000000, 0.0000000000000000 },
{ 1.0156861412236078, 0.0000000000000000, 0.25000000000000000 },
{ 1.0634833707413236, 0.0000000000000000, 0.50000000000000000 },
{ 1.1456467780440014, 0.0000000000000000, 0.75000000000000000 },
{ 1.2660658777520082, 0.0000000000000000, 1.0000000000000000 },
{ 1.4304687177218294, 0.0000000000000000, 1.2500000000000000 },
{ 1.6467231897728904, 0.0000000000000000, 1.5000000000000000 },
{ 1.9252521538585023, 0.0000000000000000, 1.7500000000000000 },
{ 2.2795853023360668, 0.0000000000000000, 2.0000000000000000 },
{ 2.7270783071907951, 0.0000000000000000, 2.2500000000000000 },
{ 3.2898391440501231, 0.0000000000000000, 2.5000000000000000 },
{ 3.9959131072376550, 0.0000000000000000, 2.7500000000000000 },
{ 4.8807925858650245, 0.0000000000000000, 3.0000000000000000 },
{ 5.9893359979395138, 0.0000000000000000, 3.2500000000000000 },
{ 7.3782034322254750, 0.0000000000000000, 3.5000000000000000 },
{ 9.1189458608445655, 0.0000000000000000, 3.7500000000000000 },
{ 11.301921952136325, 0.0000000000000000, 4.0000000000000000 },
{ 14.041263683000595, 0.0000000000000000, 4.2500000000000000 },
{ 17.481171855609272, 0.0000000000000000, 4.5000000000000000 },
{ 21.803898740902120, 0.0000000000000000, 4.7500000000000000 },
{ 27.239871823604439, 0.0000000000000000, 5.0000000000000000 },
};
const double toler001 = 2.5000000000000020e-13;
// Test data for nu=0.33333333333333331.
// max(|f - f_GSL|): 1.0658141036401503e-14
// max(|f - f_GSL| / |f_GSL|): 1.1056193696204194e-15
const testcase_cyl_bessel_i<double>
data002[21] =
{
{ 0.0000000000000000, 0.33333333333333331, 0.0000000000000000 },
{ 0.56650686557808660, 0.33333333333333331, 0.25000000000000000 },
{ 0.73897315642511863, 0.33333333333333331, 0.50000000000000000 },
{ 0.89532320365836804, 0.33333333333333331, 0.75000000000000000 },
{ 1.0646313978895285, 0.33333333333333331, 1.0000000000000000 },
{ 1.2623776732605250, 0.33333333333333331, 1.2500000000000000 },
{ 1.5014290000224382, 0.33333333333333331, 1.5000000000000000 },
{ 1.7951195525946044, 0.33333333333333331, 1.7500000000000000 },
{ 2.1587825813728614, 0.33333333333333331, 2.0000000000000000 },
{ 2.6109134564811405, 0.33333333333333331, 2.2500000000000000 },
{ 3.1743242297241938, 0.33333333333333331, 2.5000000000000000 },
{ 3.8774551722182107, 0.33333333333333331, 2.7500000000000000 },
{ 4.7559569371646946, 0.33333333333333331, 3.0000000000000000 },
{ 5.8546499652731825, 0.33333333333333331, 3.2500000000000000 },
{ 7.2299798619171147, 0.33333333333333331, 3.5000000000000000 },
{ 8.9531114355506318, 0.33333333333333331, 3.7500000000000000 },
{ 11.113838389991479, 0.33333333333333331, 4.0000000000000000 },
{ 13.825531136529117, 0.33333333333333331, 4.2500000000000000 },
{ 17.231403968478318, 0.33333333333333331, 4.5000000000000000 },
{ 21.512458099556554, 0.33333333333333331, 4.7500000000000000 },
{ 26.897553069268362, 0.33333333333333331, 5.0000000000000000 },
};
const double toler002 = 2.5000000000000020e-13;
// Test data for nu=0.50000000000000000.
// max(|f - f_GSL|): 1.4210854715202004e-14
// max(|f - f_GSL| / |f_GSL|): 1.2805693909168510e-15
const testcase_cyl_bessel_i<double>
data003[21] =
{
{ 0.0000000000000000, 0.50000000000000000, 0.0000000000000000 },
{ 0.40311093489975897, 0.50000000000000000, 0.25000000000000000 },
{ 0.58799308679041573, 0.50000000000000000, 0.50000000000000000 },
{ 0.75761498638991298, 0.50000000000000000, 0.75000000000000000 },
{ 0.93767488824548695, 0.50000000000000000, 1.0000000000000000 },
{ 1.1432089853159872, 0.50000000000000000, 1.2500000000000000 },
{ 1.3871617204034761, 0.50000000000000000, 1.5000000000000000 },
{ 1.6830217804556815, 0.50000000000000000, 1.7500000000000000 },
{ 2.0462368630890526, 0.50000000000000000, 2.0000000000000000 },
{ 2.4953405089360041, 0.50000000000000000, 2.2500000000000000 },
{ 3.0530935381967175, 0.50000000000000000, 2.5000000000000000 },
{ 3.7477882494879449, 0.50000000000000000, 2.7500000000000000 },
{ 4.6148229034075969, 0.50000000000000000, 3.0000000000000000 },
{ 5.6986505325335495, 0.50000000000000000, 3.2500000000000000 },
{ 7.0552194086911877, 0.50000000000000000, 3.5000000000000000 },
{ 8.7550467841188944, 0.50000000000000000, 3.7500000000000000 },
{ 10.887101798588422, 0.50000000000000000, 4.0000000000000000 },
{ 13.563718712579764, 0.50000000000000000, 4.2500000000000000 },
{ 16.926820080158183, 0.50000000000000000, 4.5000000000000000 },
{ 21.155804306570005, 0.50000000000000000, 4.7500000000000000 },
{ 26.477547497559065, 0.50000000000000000, 5.0000000000000000 },
};
const double toler003 = 2.5000000000000020e-13;
// Test data for nu=0.66666666666666663.
// max(|f - f_GSL|): 1.2434497875801753e-14
// max(|f - f_GSL| / |f_GSL|): 1.3900778397944649e-15
const testcase_cyl_bessel_i<double>
data004[21] =
{
{ 0.0000000000000000, 0.66666666666666663, 0.0000000000000000 },
{ 0.27953690613200438, 0.66666666666666663, 0.25000000000000000 },
{ 0.45628323113556879, 0.66666666666666663, 0.50000000000000000 },
{ 0.62594569838182612, 0.66666666666666663, 0.75000000000000000 },
{ 0.80752128860612948, 0.66666666666666663, 1.0000000000000000 },
{ 1.0139484513577168, 0.66666666666666663, 1.2500000000000000 },
{ 1.2572918396962991, 0.66666666666666663, 1.5000000000000000 },
{ 1.5505806938325577, 0.66666666666666663, 1.7500000000000000 },
{ 1.9089492968236206, 0.66666666666666663, 2.0000000000000000 },
{ 2.3506463490300331, 0.66666666666666663, 2.2500000000000000 },
{ 2.8981161894224892, 0.66666666666666663, 2.5000000000000000 },
{ 3.5792654911068720, 0.66666666666666663, 2.7500000000000000 },
{ 4.4290087213549505, 0.66666666666666663, 3.0000000000000000 },
{ 5.4911895720097688, 0.66666666666666663, 3.2500000000000000 },
{ 6.8209918044137305, 0.66666666666666663, 3.5000000000000000 },
{ 8.4879784249619767, 0.66666666666666663, 3.7500000000000000 },
{ 10.579932774013002, 0.66666666666666663, 4.0000000000000000 },
{ 13.207720355482458, 0.66666666666666663, 4.2500000000000000 },
{ 16.511448404200543, 0.66666666666666663, 4.5000000000000000 },
{ 20.668274532832392, 0.66666666666666663, 4.7500000000000000 },
{ 25.902310583215122, 0.66666666666666663, 5.0000000000000000 },
};
const double toler004 = 2.5000000000000020e-13;
// Test data for nu=1.0000000000000000.
// max(|f - f_GSL|): 3.5527136788005009e-15
// max(|f - f_GSL| / |f_GSL|): 2.2031887547040326e-16
const testcase_cyl_bessel_i<double>
data005[21] =
{
{ 0.0000000000000000, 1.0000000000000000, 0.0000000000000000 },
{ 0.12597910894546793, 1.0000000000000000, 0.25000000000000000 },
{ 0.25789430539089631, 1.0000000000000000, 0.50000000000000000 },
{ 0.40199246158092228, 1.0000000000000000, 0.75000000000000000 },
{ 0.56515910399248503, 1.0000000000000000, 1.0000000000000000 },
{ 0.75528141834074725, 1.0000000000000000, 1.2500000000000000 },
{ 0.98166642857790720, 1.0000000000000000, 1.5000000000000000 },
{ 1.2555375122401731, 1.0000000000000000, 1.7500000000000000 },
{ 1.5906368546373291, 1.0000000000000000, 2.0000000000000000 },
{ 2.0039674569295931, 1.0000000000000000, 2.2500000000000000 },
{ 2.5167162452886984, 1.0000000000000000, 2.5000000000000000 },
{ 3.1554101386190028, 1.0000000000000000, 2.7500000000000000 },
{ 3.9533702174026097, 1.0000000000000000, 3.0000000000000000 },
{ 4.9525461659085490, 1.0000000000000000, 3.2500000000000000 },
{ 6.2058349222583642, 1.0000000000000000, 3.5000000000000000 },
{ 7.7800152298244161, 1.0000000000000000, 3.7500000000000000 },
{ 9.7594651537044488, 1.0000000000000000, 4.0000000000000000 },
{ 12.250874667409304, 1.0000000000000000, 4.2500000000000000 },
{ 15.389222753735924, 1.0000000000000000, 4.5000000000000000 },
{ 19.345361447520226, 1.0000000000000000, 4.7500000000000000 },
{ 24.335642142450524, 1.0000000000000000, 5.0000000000000000 },
};
const double toler005 = 2.5000000000000020e-13;
// Test data for nu=2.0000000000000000.
// max(|f - f_GSL|): 1.7763568394002505e-15
// max(|f - f_GSL| / |f_GSL|): 2.2089187702829171e-16
const testcase_cyl_bessel_i<double>
data006[21] =
{
{ 0.0000000000000000, 2.0000000000000000, 0.0000000000000000 },
{ 0.0078532696598645167, 2.0000000000000000, 0.25000000000000000 },
{ 0.031906149177738249, 2.0000000000000000, 0.50000000000000000 },
{ 0.073666880494875436, 2.0000000000000000, 0.75000000000000000 },
{ 0.13574766976703831, 2.0000000000000000, 1.0000000000000000 },
{ 0.22201844837663415, 2.0000000000000000, 1.2500000000000000 },
{ 0.33783461833568068, 2.0000000000000000, 1.5000000000000000 },
{ 0.49035213986973319, 2.0000000000000000, 1.7500000000000000 },
{ 0.68894844769873831, 2.0000000000000000, 2.0000000000000000 },
{ 0.94577390103115722, 2.0000000000000000, 2.2500000000000000 },
{ 1.2764661478191643, 2.0000000000000000, 2.5000000000000000 },
{ 1.7010693700601991, 2.0000000000000000, 2.7500000000000000 },
{ 2.2452124409299512, 2.0000000000000000, 3.0000000000000000 },
{ 2.9416152804573357, 2.0000000000000000, 3.2500000000000000 },
{ 3.8320120480778415, 2.0000000000000000, 3.5000000000000000 },
{ 4.9696044049382113, 2.0000000000000000, 3.7500000000000000 },
{ 6.4221893752841046, 2.0000000000000000, 4.0000000000000000 },
{ 8.2761461924550552, 2.0000000000000000, 4.2500000000000000 },
{ 10.641517298393307, 2.0000000000000000, 4.5000000000000000 },
{ 13.658483394577813, 2.0000000000000000, 4.7500000000000000 },
{ 17.505614966624233, 2.0000000000000000, 5.0000000000000000 },
};
const double toler006 = 2.5000000000000020e-13;
// Test data for nu=5.0000000000000000.
// max(|f - f_GSL|): 8.8817841970012523e-16
// max(|f - f_GSL| / |f_GSL|): 1.6610041744866592e-15
const testcase_cyl_bessel_i<double>
data007[21] =
{
{ 0.0000000000000000, 5.0000000000000000, 0.0000000000000000 },
{ 2.5497616449882785e-07, 5.0000000000000000, 0.25000000000000000 },
{ 8.2231713131092646e-06, 5.0000000000000000, 0.50000000000000000 },
{ 6.3261122739811725e-05, 5.0000000000000000, 0.75000000000000000 },
{ 0.00027146315595697195, 5.0000000000000000, 1.0000000000000000 },
{ 0.00084793613616686856, 5.0000000000000000, 1.2500000000000000 },
{ 0.0021705595690975554, 5.0000000000000000, 1.5000000000000000 },
{ 0.0048504513371845394, 5.0000000000000000, 1.7500000000000000 },
{ 0.0098256793231317023, 5.0000000000000000, 2.0000000000000000 },
{ 0.018486577941045829, 5.0000000000000000, 2.2500000000000000 },
{ 0.032843475172023219, 5.0000000000000000, 2.5000000000000000 },
{ 0.055750882754221943, 5.0000000000000000, 2.7500000000000000 },
{ 0.091206477661513338, 5.0000000000000000, 3.0000000000000000 },
{ 0.14474880546308083, 5.0000000000000000, 3.2500000000000000 },
{ 0.22398495470190780, 5.0000000000000000, 3.5000000000000000 },
{ 0.33928899170999866, 5.0000000000000000, 3.7500000000000000 },
{ 0.50472436311316626, 5.0000000000000000, 4.0000000000000000 },
{ 0.73925961816682961, 5.0000000000000000, 4.2500000000000000 },
{ 1.0683677743764699, 5.0000000000000000, 4.5000000000000000 },
{ 1.5261268693599621, 5.0000000000000000, 4.7500000000000000 },
{ 2.1579745473225476, 5.0000000000000000, 5.0000000000000000 },
};
const double toler007 = 2.5000000000000020e-13;
// Test data for nu=10.000000000000000.
// max(|f - f_GSL|): 9.5409791178724390e-18
// max(|f - f_GSL| / |f_GSL|): 3.9173270279899483e-15
const testcase_cyl_bessel_i<double>
data008[21] =
{
{ 0.0000000000000000, 10.000000000000000, 0.0000000000000000 },
{ 2.5701232848571186e-16, 10.000000000000000, 0.25000000000000000 },
{ 2.6430419258812784e-13, 10.000000000000000, 0.50000000000000000 },
{ 1.5349659676120412e-11, 10.000000000000000, 0.75000000000000000 },
{ 2.7529480398368732e-10, 10.000000000000000, 1.0000000000000000 },
{ 2.5967897782035928e-09, 10.000000000000000, 1.2500000000000000 },
{ 1.6330924437799743e-08, 10.000000000000000, 1.5000000000000000 },
{ 7.7706676834614093e-08, 10.000000000000000, 1.7500000000000000 },
{ 3.0169638793506839e-07, 10.000000000000000, 2.0000000000000000 },
{ 1.0034459057774481e-06, 10.000000000000000, 2.2500000000000000 },
{ 2.9557436109680578e-06, 10.000000000000000, 2.5000000000000000 },
{ 7.8955603774082724e-06, 10.000000000000000, 2.7500000000000000 },
{ 1.9464393470612970e-05, 10.000000000000000, 3.0000000000000000 },
{ 4.4875369479742435e-05, 10.000000000000000, 3.2500000000000000 },
{ 9.7760848514528916e-05, 10.000000000000000, 3.5000000000000000 },
{ 0.00020289011210063493, 10.000000000000000, 3.7500000000000000 },
{ 0.00040378896132693047, 10.000000000000000, 4.0000000000000000 },
{ 0.00077478519551669892, 10.000000000000000, 4.2500000000000000 },
{ 0.0014397060684919682, 10.000000000000000, 4.5000000000000000 },
{ 0.0026004486016189452, 10.000000000000000, 4.7500000000000000 },
{ 0.0045800444191760525, 10.000000000000000, 5.0000000000000000 },
};
const double toler008 = 2.5000000000000020e-13;
// Test data for nu=20.000000000000000.
// max(|f - f_GSL|): 2.9080568410067379e-26
// max(|f - f_GSL| / |f_GSL|): 2.1318627676504474e-15
const testcase_cyl_bessel_i<double>
data009[21] =
{
{ 0.0000000000000000, 20.000000000000000, 0.0000000000000000 },
{ 3.5677858077910353e-37, 20.000000000000000, 0.25000000000000000 },
{ 3.7494538480790194e-31, 20.000000000000000, 0.50000000000000000 },
{ 1.2514356342425337e-27, 20.000000000000000, 0.75000000000000000 },
{ 3.9668359858190197e-25, 20.000000000000000, 1.0000000000000000 },
{ 3.4637832909868234e-23, 20.000000000000000, 1.2500000000000000 },
{ 1.3388331839683472e-21, 20.000000000000000, 1.5000000000000000 },
{ 2.9502376732679751e-20, 20.000000000000000, 1.7500000000000000 },
{ 4.3105605761095479e-19, 20.000000000000000, 2.0000000000000000 },
{ 4.6032451406433059e-18, 20.000000000000000, 2.2500000000000000 },
{ 3.8400317244170310e-17, 20.000000000000000, 2.5000000000000000 },
{ 2.6239115263043263e-16, 20.000000000000000, 2.7500000000000000 },
{ 1.5209660019426689e-15, 20.000000000000000, 3.0000000000000000 },
{ 7.6806450728249953e-15, 20.000000000000000, 3.2500000000000000 },
{ 3.4495528847222945e-14, 20.000000000000000, 3.5000000000000000 },
{ 1.4006589294850672e-13, 20.000000000000000, 3.7500000000000000 },
{ 5.2100734221993044e-13, 20.000000000000000, 4.0000000000000000 },
{ 1.7946903269488168e-12, 20.000000000000000, 4.2500000000000000 },
{ 5.7763830562279683e-12, 20.000000000000000, 4.5000000000000000 },
{ 1.7502433074548735e-11, 20.000000000000000, 4.7500000000000000 },
{ 5.0242393579718066e-11, 20.000000000000000, 5.0000000000000000 },
};
const double toler009 = 2.5000000000000020e-13;
// cyl_bessel_i
// Test data for nu=0.0000000000000000.
// max(|f - f_GSL|): 2.5687255815171641e+28
// max(|f - f_GSL| / |f_GSL|): 2.3922901025046178e-14
const testcase_cyl_bessel_i<double>
data010[21] =
{
{ 1.0000000000000000, 0.0000000000000000, 0.0000000000000000 },
{ 27.239871823604439, 0.0000000000000000, 5.0000000000000000 },
{ 2815.7166284662558, 0.0000000000000000, 10.000000000000000 },
{ 339649.37329791381, 0.0000000000000000, 15.000000000000000 },
{ 43558282.559553474, 0.0000000000000000, 20.000000000000000 },
{ 5774560606.4663124, 0.0000000000000000, 25.000000000000000 },
{ 781672297823.97925, 0.0000000000000000, 30.000000000000000 },
{ 107338818494514.42, 0.0000000000000000, 35.000000000000000 },
{ 14894774793419918., 0.0000000000000000, 40.000000000000000 },
{ 2.0834140751773164e+18, 0.0000000000000000, 45.000000000000000 },
{ 2.9325537838493457e+20, 0.0000000000000000, 50.000000000000000 },
{ 4.1487895607332160e+22, 0.0000000000000000, 55.000000000000000 },
{ 5.8940770556098216e+24, 0.0000000000000000, 60.000000000000000 },
{ 8.4030398456255596e+26, 0.0000000000000000, 65.000000000000000 },
{ 1.2015889579125424e+29, 0.0000000000000000, 70.000000000000000 },
{ 1.7226390780357976e+31, 0.0000000000000000, 75.000000000000000 },
{ 2.4751784043341661e+33, 0.0000000000000000, 80.000000000000000 },
{ 3.5634776304081403e+35, 0.0000000000000000, 85.000000000000000 },
{ 5.1392383455086475e+37, 0.0000000000000000, 90.000000000000000 },
{ 7.4233258618752072e+39, 0.0000000000000000, 95.000000000000000 },
{ 1.0737517071310986e+42, 0.0000000000000000, 100.00000000000000 },
};
const double toler010 = 2.5000000000000015e-12;
// Test data for nu=0.33333333333333331.
// max(|f - f_GSL|): 1.0831975343747077e+28
// max(|f - f_GSL| / |f_GSL|): 1.2017640663876795e-14
const testcase_cyl_bessel_i<double>
data011[21] =
{
{ 0.0000000000000000, 0.33333333333333331, 0.0000000000000000 },
{ 26.897553069268362, 0.33333333333333331, 5.0000000000000000 },
{ 2799.2396097056790, 0.33333333333333331, 10.000000000000000 },
{ 338348.63146593666, 0.33333333333333331, 15.000000000000000 },
{ 43434263.927938424, 0.33333333333333331, 20.000000000000000 },
{ 5761474759.6213636, 0.33333333333333331, 25.000000000000000 },
{ 780201111830.30237, 0.33333333333333331, 30.000000000000000 },
{ 107166066959051.91, 0.33333333333333331, 35.000000000000000 },
{ 14873836574083764., 0.33333333333333331, 40.000000000000000 },
{ 2.0808143020217085e+18, 0.33333333333333331, 45.000000000000000 },
{ 2.9292639365644226e+20, 0.33333333333333331, 50.000000000000000 },
{ 4.1445621624120489e+22, 0.33333333333333331, 55.000000000000000 },
{ 5.8885758374365916e+24, 0.33333333333333331, 60.000000000000000 },
{ 8.3958047021083955e+26, 0.33333333333333331, 65.000000000000000 },
{ 1.2006287819446431e+29, 0.33333333333333331, 70.000000000000000 },
{ 1.7213548977150022e+31, 0.33333333333333331, 75.000000000000000 },
{ 2.4734492458444449e+33, 0.33333333333333331, 80.000000000000000 },
{ 3.5611354547857122e+35, 0.33333333333333331, 85.000000000000000 },
{ 5.1360491295551848e+37, 0.33333333333333331, 90.000000000000000 },
{ 7.4189629097600431e+39, 0.33333333333333331, 95.000000000000000 },
{ 1.0731523308358370e+42, 0.33333333333333331, 100.00000000000000 },
};
const double toler011 = 1.0000000000000008e-12;
// Test data for nu=0.50000000000000000.
// max(|f - f_GSL|): 6.9634127209802640e+27
// max(|f - f_GSL| / |f_GSL|): 1.1904152155149629e-14
const testcase_cyl_bessel_i<double>
data012[21] =
{
{ 0.0000000000000000, 0.50000000000000000, 0.0000000000000000 },
{ 26.477547497559065, 0.50000000000000000, 5.0000000000000000 },
{ 2778.7846038745711, 0.50000000000000000, 10.000000000000000 },
{ 336729.88718706399, 0.50000000000000000, 15.000000000000000 },
{ 43279746.272428922, 0.50000000000000000, 20.000000000000000 },
{ 5745159748.3464680, 0.50000000000000000, 25.000000000000000 },
{ 778366068840.44580, 0.50000000000000000, 30.000000000000000 },
{ 106950522408567.66, 0.50000000000000000, 35.000000000000000 },
{ 14847705549021962., 0.50000000000000000, 40.000000000000000 },
{ 2.0775691824625661e+18, 0.50000000000000000, 45.000000000000000 },
{ 2.9251568529912984e+20, 0.50000000000000000, 50.000000000000000 },
{ 4.1392840094781220e+22, 0.50000000000000000, 55.000000000000000 },
{ 5.8817065760751945e+24, 0.50000000000000000, 60.000000000000000 },
{ 8.3867695787277258e+26, 0.50000000000000000, 65.000000000000000 },
{ 1.1994296461653203e+29, 0.50000000000000000, 70.000000000000000 },
{ 1.7197510246063334e+31, 0.50000000000000000, 75.000000000000000 },
{ 2.4712895036230794e+33, 0.50000000000000000, 80.000000000000000 },
{ 3.5582099086757769e+35, 0.50000000000000000, 85.000000000000000 },
{ 5.1320654031231128e+37, 0.50000000000000000, 90.000000000000000 },
{ 7.4135128383495239e+39, 0.50000000000000000, 95.000000000000000 },
{ 1.0724035825423179e+42, 0.50000000000000000, 100.00000000000000 },
};
const double toler012 = 1.0000000000000008e-12;
// Test data for nu=0.66666666666666663.
// max(|f - f_GSL|): 4.4875326424095035e+27
// max(|f - f_GSL| / |f_GSL|): 8.8432218147527708e-15
const testcase_cyl_bessel_i<double>
data013[21] =
{
{ 0.0000000000000000, 0.66666666666666663, 0.0000000000000000 },
{ 25.902310583215122, 0.66666666666666663, 5.0000000000000000 },
{ 2750.4090423459315, 0.66666666666666663, 10.000000000000000 },
{ 334476.98138574377, 0.66666666666666663, 15.000000000000000 },
{ 43064361.686912313, 0.66666666666666663, 20.000000000000000 },
{ 5722397441.9603882, 0.66666666666666663, 25.000000000000000 },
{ 775804343498.02661, 0.66666666666666663, 30.000000000000000 },
{ 106649495512800.88, 0.66666666666666663, 35.000000000000000 },
{ 14811199896983756., 0.66666666666666663, 40.000000000000000 },
{ 2.0730345814356961e+18, 0.66666666666666663, 45.000000000000000 },
{ 2.9194166755257467e+20, 0.66666666666666663, 50.000000000000000 },
{ 4.1319059569935374e+22, 0.66666666666666663, 55.000000000000000 },
{ 5.8721031476386222e+24, 0.66666666666666663, 60.000000000000000 },
{ 8.3741368248217844e+26, 0.66666666666666663, 65.000000000000000 },
{ 1.1977528777008688e+29, 0.66666666666666663, 70.000000000000000 },
{ 1.7175081240014333e+31, 0.66666666666666663, 75.000000000000000 },
{ 2.4682690458513916e+33, 0.66666666666666663, 80.000000000000000 },
{ 3.5541181975850724e+35, 0.66666666666666663, 85.000000000000000 },
{ 5.1264933963228892e+37, 0.66666666666666663, 90.000000000000000 },
{ 7.4058894880134064e+39, 0.66666666666666663, 95.000000000000000 },
{ 1.0713562154788124e+42, 0.66666666666666663, 100.00000000000000 },
};
const double toler013 = 5.0000000000000039e-13;
// Test data for nu=1.0000000000000000.
// max(|f - f_GSL|): 5.7254726816948838e+27
// max(|f - f_GSL| / |f_GSL|): 7.0819761463168391e-15
const testcase_cyl_bessel_i<double>
data014[21] =
{
{ 0.0000000000000000, 1.0000000000000000, 0.0000000000000000 },
{ 24.335642142450524, 1.0000000000000000, 5.0000000000000000 },
{ 2670.9883037012560, 1.0000000000000000, 10.000000000000000 },
{ 328124.92197020649, 1.0000000000000000, 15.000000000000000 },
{ 42454973.385127783, 1.0000000000000000, 20.000000000000000 },
{ 5657865129.8787022, 1.0000000000000000, 25.000000000000000 },
{ 768532038938.95667, 1.0000000000000000, 30.000000000000000 },
{ 105794126051896.17, 1.0000000000000000, 35.000000000000000 },
{ 14707396163259354., 1.0000000000000000, 40.000000000000000 },
{ 2.0601334620815780e+18, 1.0000000000000000, 45.000000000000000 },
{ 2.9030785901035638e+20, 1.0000000000000000, 50.000000000000000 },
{ 4.1108986452992812e+22, 1.0000000000000000, 55.000000000000000 },
{ 5.8447515883904527e+24, 1.0000000000000000, 60.000000000000000 },
{ 8.3381485471501302e+26, 1.0000000000000000, 65.000000000000000 },
{ 1.1929750788892366e+29, 1.0000000000000000, 70.000000000000000 },
{ 1.7111160152965382e+31, 1.0000000000000000, 75.000000000000000 },
{ 2.4596595795675343e+33, 1.0000000000000000, 80.000000000000000 },
{ 3.5424536064404024e+35, 1.0000000000000000, 85.000000000000000 },
{ 5.1106068152566129e+37, 1.0000000000000000, 90.000000000000000 },
{ 7.3841518091360182e+39, 1.0000000000000000, 95.000000000000000 },
{ 1.0683693903381569e+42, 1.0000000000000000, 100.00000000000000 },
};
const double toler014 = 5.0000000000000039e-13;
// Test data for nu=2.0000000000000000.
// max(|f - f_GSL|): 6.3444427013375739e+27
// max(|f - f_GSL| / |f_GSL|): 6.0286366727804324e-15
const testcase_cyl_bessel_i<double>
data015[21] =
{
{ 0.0000000000000000, 2.0000000000000000, 0.0000000000000000 },
{ 17.505614966624233, 2.0000000000000000, 5.0000000000000000 },
{ 2281.5189677260046, 2.0000000000000000, 10.000000000000000 },
{ 295899.38370188628, 2.0000000000000000, 15.000000000000000 },
{ 39312785.221040756, 2.0000000000000000, 20.000000000000000 },
{ 5321931396.0760155, 2.0000000000000000, 25.000000000000000 },
{ 730436828561.38013, 2.0000000000000000, 30.000000000000000 },
{ 101293439862977.19, 2.0000000000000000, 35.000000000000000 },
{ 14159404985256922., 2.0000000000000000, 40.000000000000000 },
{ 1.9918525879736883e+18, 2.0000000000000000, 45.000000000000000 },
{ 2.8164306402451938e+20, 2.0000000000000000, 50.000000000000000 },
{ 3.9993023372677540e+22, 2.0000000000000000, 55.000000000000000 },
{ 5.6992520026634433e+24, 2.0000000000000000, 60.000000000000000 },
{ 8.1464814287900378e+26, 2.0000000000000000, 65.000000000000000 },
{ 1.1675039556585663e+29, 2.0000000000000000, 70.000000000000000 },
{ 1.6770093176278926e+31, 2.0000000000000000, 75.000000000000000 },
{ 2.4136869148449879e+33, 2.0000000000000000, 80.000000000000000 },
{ 3.4801257808448186e+35, 2.0000000000000000, 85.000000000000000 },
{ 5.0256693051696307e+37, 2.0000000000000000, 90.000000000000000 },
{ 7.2678700343145818e+39, 2.0000000000000000, 95.000000000000000 },
{ 1.0523843193243042e+42, 2.0000000000000000, 100.00000000000000 },
};
const double toler015 = 5.0000000000000039e-13;
// Test data for nu=5.0000000000000000.
// max(|f - f_GSL|): 7.7371252455336267e+26
// max(|f - f_GSL| / |f_GSL|): 1.6729319922562276e-15
const testcase_cyl_bessel_i<double>
data016[21] =
{
{ 0.0000000000000000, 5.0000000000000000, 0.0000000000000000 },
{ 2.1579745473225476, 5.0000000000000000, 5.0000000000000000 },
{ 777.18828640326012, 5.0000000000000000, 10.000000000000000 },
{ 144572.01120063409, 5.0000000000000000, 15.000000000000000 },
{ 23018392.213413671, 5.0000000000000000, 20.000000000000000 },
{ 3472466208.7419176, 5.0000000000000000, 25.000000000000000 },
{ 512151465476.93494, 5.0000000000000000, 30.000000000000000 },
{ 74756743552251.547, 5.0000000000000000, 35.000000000000000 },
{ 10858318337624280., 5.0000000000000000, 40.000000000000000 },
{ 1.5736087399245911e+18, 5.0000000000000000, 45.000000000000000 },
{ 2.2785483079112825e+20, 5.0000000000000000, 50.000000000000000 },
{ 3.2989391052963687e+22, 5.0000000000000000, 55.000000000000000 },
{ 4.7777652072561732e+24, 5.0000000000000000, 60.000000000000000 },
{ 6.9232165147172657e+26, 5.0000000000000000, 65.000000000000000 },
{ 1.0038643002095155e+29, 5.0000000000000000, 70.000000000000000 },
{ 1.4566328222327073e+31, 5.0000000000000000, 75.000000000000000 },
{ 2.1151488565944835e+33, 5.0000000000000000, 80.000000000000000 },
{ 3.0735883450768239e+35, 5.0000000000000000, 85.000000000000000 },
{ 4.4694790189230327e+37, 5.0000000000000000, 90.000000000000000 },
{ 6.5037505570430995e+39, 5.0000000000000000, 95.000000000000000 },
{ 9.4700938730355882e+41, 5.0000000000000000, 100.00000000000000 },
};
const double toler016 = 2.5000000000000020e-13;
// Test data for nu=10.000000000000000.
// max(|f - f_GSL|): 2.3211375736600880e+26
// max(|f - f_GSL| / |f_GSL|): 3.0834307473515225e-15
const testcase_cyl_bessel_i<double>
data017[21] =
{
{ 0.0000000000000000, 10.000000000000000, 0.0000000000000000 },
{ 0.0045800444191760525, 10.000000000000000, 5.0000000000000000 },
{ 21.891706163723381, 10.000000000000000, 10.000000000000000 },
{ 12267.475049806462, 10.000000000000000, 15.000000000000000 },
{ 3540200.2090195213, 10.000000000000000, 20.000000000000000 },
{ 771298871.17072666, 10.000000000000000, 25.000000000000000 },
{ 145831809975.96710, 10.000000000000000, 30.000000000000000 },
{ 25449470018534.777, 10.000000000000000, 35.000000000000000 },
{ 4228469210516757.5, 10.000000000000000, 40.000000000000000 },
{ 6.8049404557505165e+17, 10.000000000000000, 45.000000000000000 },
{ 1.0715971594776370e+20, 10.000000000000000, 50.000000000000000 },
{ 1.6618215752886714e+22, 10.000000000000000, 55.000000000000000 },
{ 2.5486246072566784e+24, 10.000000000000000, 60.000000000000000 },
{ 3.8764628702155481e+26, 10.000000000000000, 65.000000000000000 },
{ 5.8592538145409686e+28, 10.000000000000000, 70.000000000000000 },
{ 8.8135370711317444e+30, 10.000000000000000, 75.000000000000000 },
{ 1.3207418268325279e+33, 10.000000000000000, 80.000000000000000 },
{ 1.9732791360862190e+35, 10.000000000000000, 85.000000000000000 },
{ 2.9411893748384672e+37, 10.000000000000000, 90.000000000000000 },
{ 4.3754494922439984e+39, 10.000000000000000, 95.000000000000000 },
{ 6.4989755247201446e+41, 10.000000000000000, 100.00000000000000 },
};
const double toler017 = 2.5000000000000020e-13;
// Test data for nu=20.000000000000000.
// max(|f - f_GSL|): 1.9342813113834067e+25
// max(|f - f_GSL| / |f_GSL|): 4.7061265485304859e-15
const testcase_cyl_bessel_i<double>
data018[21] =
{
{ 0.0000000000000000, 20.000000000000000, 0.0000000000000000 },
{ 5.0242393579718066e-11, 20.000000000000000, 5.0000000000000000 },
{ 0.00012507997356449481, 20.000000000000000, 10.000000000000000 },
{ 1.6470152535015836, 20.000000000000000, 15.000000000000000 },
{ 3188.7503288536154, 20.000000000000000, 20.000000000000000 },
{ 2449840.5422952301, 20.000000000000000, 25.000000000000000 },
{ 1126985104.4483771, 20.000000000000000, 30.000000000000000 },
{ 379617876611.88580, 20.000000000000000, 35.000000000000000 },
{ 104459633129479.89, 20.000000000000000, 40.000000000000000 },
{ 25039579987216524., 20.000000000000000, 45.000000000000000 },
{ 5.4420084027529984e+18, 20.000000000000000, 50.000000000000000 },
{ 1.1007498584335495e+21, 20.000000000000000, 55.000000000000000 },
{ 2.1091734863057236e+23, 20.000000000000000, 60.000000000000000 },
{ 3.8763618091286899e+25, 20.000000000000000, 65.000000000000000 },
{ 6.8946130527930870e+27, 20.000000000000000, 70.000000000000000 },
{ 1.1946319948836447e+30, 20.000000000000000, 75.000000000000000 },
{ 2.0265314377577587e+32, 20.000000000000000, 80.000000000000000 },
{ 3.3784665214179985e+34, 20.000000000000000, 85.000000000000000 },
{ 5.5516089411796646e+36, 20.000000000000000, 90.000000000000000 },
{ 9.0129310795305151e+38, 20.000000000000000, 95.000000000000000 },
{ 1.4483461256427176e+41, 20.000000000000000, 100.00000000000000 },
};
const double toler018 = 2.5000000000000020e-13;
// Test data for nu=50.000000000000000.
// max(|f - f_GSL|): 4.5452777397620335e+22
// max(|f - f_GSL| / |f_GSL|): 6.0191728870880627e-14
const testcase_cyl_bessel_i<double>
data019[21] =
{
{ 0.0000000000000000, 50.000000000000000, 0.0000000000000000 },
{ 2.9314696468108517e-45, 50.000000000000000, 5.0000000000000000 },
{ 4.7568945607268442e-30, 50.000000000000000, 10.000000000000000 },
{ 5.5468372730667069e-21, 50.000000000000000, 15.000000000000000 },
{ 2.2551205757604056e-14, 50.000000000000000, 20.000000000000000 },
{ 4.5344251866130257e-09, 50.000000000000000, 25.000000000000000 },
{ 0.00014590106916468940, 50.000000000000000, 30.000000000000000 },
{ 1.3965549457254882, 50.000000000000000, 35.000000000000000 },
{ 5726.8656631289896, 50.000000000000000, 40.000000000000000 },
{ 12672593.113027781, 50.000000000000000, 45.000000000000000 },
{ 17650802430.016712, 50.000000000000000, 50.000000000000000 },
{ 17220231607789.926, 50.000000000000000, 55.000000000000000 },
{ 12704607933652176., 50.000000000000000, 60.000000000000000 },
{ 7.4989491942193725e+18, 50.000000000000000, 65.000000000000000 },
{ 3.6944034898904922e+21, 50.000000000000000, 70.000000000000000 },
{ 1.5691634774370186e+24, 50.000000000000000, 75.000000000000000 },
{ 5.8927749458163587e+26, 50.000000000000000, 80.000000000000000 },
{ 1.9958849054749339e+29, 50.000000000000000, 85.000000000000000 },
{ 6.1946050361781500e+31, 50.000000000000000, 90.000000000000000 },
{ 1.7845429728697119e+34, 50.000000000000000, 95.000000000000000 },
{ 4.8219580855940819e+36, 50.000000000000000, 100.00000000000000 },
};
const double toler019 = 5.0000000000000029e-12;
// Test data for nu=100.00000000000000.
// max(|f - f_GSL|): 186646528.00000000
// max(|f - f_GSL| / |f_GSL|): 2.8278213985558577e-13
const testcase_cyl_bessel_i<double>
data020[21] =
{
{ 0.0000000000000000, 100.00000000000000, 0.0000000000000000 },
{ 7.0935514885313123e-119, 100.00000000000000, 5.0000000000000000 },
{ 1.0823442017492018e-88, 100.00000000000000, 10.000000000000000 },
{ 5.9887888536468904e-71, 100.00000000000000, 15.000000000000000 },
{ 2.8703193216428771e-58, 100.00000000000000, 20.000000000000000 },
{ 2.4426896913122370e-48, 100.00000000000000, 25.000000000000000 },
{ 3.9476420053334271e-40, 100.00000000000000, 30.000000000000000 },
{ 4.2836596180818780e-33, 100.00000000000000, 35.000000000000000 },
{ 6.6249380222596129e-27, 100.00000000000000, 40.000000000000000 },
{ 2.3702587262788900e-21, 100.00000000000000, 45.000000000000000 },
{ 2.7278879470966917e-16, 100.00000000000000, 50.000000000000000 },
{ 1.2763258878228082e-11, 100.00000000000000, 55.000000000000000 },
{ 2.8832770906491972e-07, 100.00000000000000, 60.000000000000000 },
{ 0.0035805902717061227, 100.00000000000000, 65.000000000000000 },
{ 27.017219102595387, 100.00000000000000, 70.000000000000000 },
{ 134001.44891209516, 100.00000000000000, 75.000000000000000 },
{ 465194832.85060996, 100.00000000000000, 80.000000000000000 },
{ 1189280653119.4814, 100.00000000000000, 85.000000000000000 },
{ 2334119331258728.0, 100.00000000000000, 90.000000000000000 },
{ 3.6399223078502436e+18, 100.00000000000000, 95.000000000000000 },
{ 4.6415349416162005e+21, 100.00000000000000, 100.00000000000000 },
};
const double toler020 = 2.5000000000000014e-11;
template<typename Tp, unsigned int Num>
void
test(const testcase_cyl_bessel_i<Tp> (&data)[Num], Tp toler)
{
bool test __attribute__((unused)) = true;
const Tp eps = std::numeric_limits<Tp>::epsilon();
Tp max_abs_diff = -Tp(1);
Tp max_abs_frac = -Tp(1);
unsigned int num_datum = Num;
for (unsigned int i = 0; i < num_datum; ++i)
{
const Tp f = std::cyl_bessel_i(data[i].nu, data[i].x);
const Tp f0 = data[i].f0;
const Tp diff = f - f0;
if (std::abs(diff) > max_abs_diff)
max_abs_diff = std::abs(diff);
if (std::abs(f0) > Tp(10) * eps
&& std::abs(f) > Tp(10) * eps)
{
const Tp frac = diff / f0;
if (std::abs(frac) > max_abs_frac)
max_abs_frac = std::abs(frac);
}
}
VERIFY(max_abs_frac < toler);
}
int
main()
{
test(data001, toler001);
test(data002, toler002);
test(data003, toler003);
test(data004, toler004);
test(data005, toler005);
test(data006, toler006);
test(data007, toler007);
test(data008, toler008);
test(data009, toler009);
test(data010, toler010);
test(data011, toler011);
test(data012, toler012);
test(data013, toler013);
test(data014, toler014);
test(data015, toler015);
test(data016, toler016);
test(data017, toler017);
test(data018, toler018);
test(data019, toler019);
test(data020, toler020);
return 0;
}

View File

@ -0,0 +1,41 @@
// { dg-do compile }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.7 cyl_bessel_i
#include <cmath>
void
test01()
{
float nuf = 1.0F / 3.0F, xf = 0.5F;
double nud = 1.0 / 3.0, xd = 0.5;
long double nul = 1.0L / 3.0L, xl = 0.5L;
std::cyl_bessel_i(nuf, xf);
std::cyl_bessel_if(nuf, xf);
std::cyl_bessel_i(nud, xd);
std::cyl_bessel_i(nul, xl);
std::cyl_bessel_il(nul, xl);
return;
}

View File

@ -0,0 +1,41 @@
// { dg-do compile { xfail *-*-* } }
// { dg-excess-errors "" }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.7 cyl_bessel_i
#include <math.h>
void
test01()
{
float nuf = 1.0F / 3.0F, xf = 0.5F;
double nud = 1.0 / 3.0, xd = 0.5;
long double nul = 1.0L / 3.0L, xl = 0.5L;
cyl_bessel_i(nuf, xf);
cyl_bessel_if(nuf, xf);
cyl_bessel_i(nud, xd);
cyl_bessel_i(nul, xl);
cyl_bessel_il(nul, xl);
return;
}

View File

@ -0,0 +1,45 @@
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2015 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++/56216 - Crash of Bessel functions at x==0!
#include <testsuite_hooks.h>
#include <cmath>
void
test01()
{
double j0 = std::cyl_bessel_j(0.0, 0.0);
double i0 = std::cyl_bessel_i(0.0, 0.0);
double j1 = std::cyl_bessel_j(1.0, 0.0);
double i1 = std::cyl_bessel_i(1.0, 0.0);
bool test [[gnu::unused]] = true;
VERIFY(j0 == 1.0);
VERIFY(i0 == 1.0);
VERIFY(j1 == 0.0);
VERIFY(i1 == 0.0);
}
int
main()
{
test01();
return 0;
}

View File

@ -0,0 +1,88 @@
// { dg-require-c-std "" }
// { dg-add-options ieee }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.8 cyl_bessel_j
#include <cmath>
#include <testsuite_hooks.h>
void
test01()
{
float xf = std::numeric_limits<float>::quiet_NaN();
double xd = std::numeric_limits<double>::quiet_NaN();
long double xl = std::numeric_limits<long double>::quiet_NaN();
float nuf = 0.0F;
double nud = 0.0;
long double nul = 0.0L;
float a = std::cyl_bessel_j(nuf, xf);
float b = std::cyl_bessel_jf(nuf, xf);
double c = std::cyl_bessel_j(nud, xd);
long double d = std::cyl_bessel_j(nul, xl);
long double e = std::cyl_bessel_jl(nul, xl);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
void
test02()
{
float xf = 1.0F;
double xd = 1.0;
long double xl = 1.0L;
float nuf = std::numeric_limits<float>::quiet_NaN();
double nud = std::numeric_limits<double>::quiet_NaN();
long double nul = std::numeric_limits<long double>::quiet_NaN();
float a = std::cyl_bessel_j(nuf, xf);
float b = std::cyl_bessel_jf(nuf, xf);
double c = std::cyl_bessel_j(nud, xd);
long double d = std::cyl_bessel_j(nul, xl);
long double e = std::cyl_bessel_jl(nul, xl);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
int
main()
{
test01();
test02();
return 0;
}

View File

@ -0,0 +1,692 @@
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
//
// Copyright (C) 2016 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/>.
// cyl_bessel_j
// Compare against values generated by the GNU Scientific Library.
// The GSL can be found on the web: http://www.gnu.org/software/gsl/
#include <limits>
#include <cmath>
#if defined(__TEST_DEBUG)
# include <iostream>
# define VERIFY(A) \
if (!(A)) \
{ \
std::cout << "line " << __LINE__ \
<< " max_abs_frac = " << max_abs_frac \
<< std::endl; \
}
#else
# include <testsuite_hooks.h>
#endif
#include <specfun_testcase.h>
// Test data for nu=0.0000000000000000.
// max(|f - f_GSL|): 1.6653345369377348e-16
// max(|f - f_GSL| / |f_GSL|): 6.5276306654894409e-16
const testcase_cyl_bessel_j<double>
data001[21] =
{
{ 1.0000000000000000, 0.0000000000000000, 0.0000000000000000 },
{ 0.98443592929585266, 0.0000000000000000, 0.25000000000000000 },
{ 0.93846980724081297, 0.0000000000000000, 0.50000000000000000 },
{ 0.86424227516664853, 0.0000000000000000, 0.75000000000000000 },
{ 0.76519768655796661, 0.0000000000000000, 1.0000000000000000 },
{ 0.64590608527128535, 0.0000000000000000, 1.2500000000000000 },
{ 0.51182767173591814, 0.0000000000000000, 1.5000000000000000 },
{ 0.36903253018515075, 0.0000000000000000, 1.7500000000000000 },
{ 0.22389077914123562, 0.0000000000000000, 2.0000000000000000 },
{ 0.082749851288734022, 0.0000000000000000, 2.2500000000000000 },
{ -0.048383776468197998, 0.0000000000000000, 2.5000000000000000 },
{ -0.16414142780851368, 0.0000000000000000, 2.7500000000000000 },
{ -0.26005195490193334, 0.0000000000000000, 3.0000000000000000 },
{ -0.33275080217061132, 0.0000000000000000, 3.2500000000000000 },
{ -0.38012773998726335, 0.0000000000000000, 3.5000000000000000 },
{ -0.40140605493617426, 0.0000000000000000, 3.7500000000000000 },
{ -0.39714980986384740, 0.0000000000000000, 4.0000000000000000 },
{ -0.36919977029989554, 0.0000000000000000, 4.2500000000000000 },
{ -0.32054250898512149, 0.0000000000000000, 4.5000000000000000 },
{ -0.25512082749137405, 0.0000000000000000, 4.7500000000000000 },
{ -0.17759677131433835, 0.0000000000000000, 5.0000000000000000 },
};
const double toler001 = 2.5000000000000020e-13;
// Test data for nu=0.33333333333333331.
// max(|f - f_GSL|): 7.7715611723760958e-16
// max(|f - f_GSL| / |f_GSL|): 1.2121143083098064e-15
const testcase_cyl_bessel_j<double>
data002[21] =
{
{ 0.0000000000000000, 0.33333333333333331, 0.0000000000000000 },
{ 0.55338359549647709, 0.33333333333333331, 0.25000000000000000 },
{ 0.67283082949794537, 0.33333333333333331, 0.50000000000000000 },
{ 0.72490863199379008, 0.33333333333333331, 0.75000000000000000 },
{ 0.73087640216944760, 0.33333333333333331, 1.0000000000000000 },
{ 0.69953374433894455, 0.33333333333333331, 1.2500000000000000 },
{ 0.63713263706489176, 0.33333333333333331, 1.5000000000000000 },
{ 0.54956352730788460, 0.33333333333333331, 1.7500000000000000 },
{ 0.44293981814857586, 0.33333333333333331, 2.0000000000000000 },
{ 0.32366988946292502, 0.33333333333333331, 2.2500000000000000 },
{ 0.19832093341860796, 0.33333333333333331, 2.5000000000000000 },
{ 0.073389637874297489, 0.33333333333333331, 2.7500000000000000 },
{ -0.044963820940233351, 0.33333333333333331, 3.0000000000000000 },
{ -0.15118395956666372, 0.33333333333333331, 3.2500000000000000 },
{ -0.24056593952693625, 0.33333333333333331, 3.5000000000000000 },
{ -0.30946094681921288, 0.33333333333333331, 3.7500000000000000 },
{ -0.35542737345457609, 0.33333333333333331, 4.0000000000000000 },
{ -0.37731852825457068, 0.33333333333333331, 4.2500000000000000 },
{ -0.37530189159358079, 0.33333333333333331, 4.5000000000000000 },
{ -0.35080916720916927, 0.33333333333333331, 4.7500000000000000 },
{ -0.30642046380026405, 0.33333333333333331, 5.0000000000000000 },
};
const double toler002 = 2.5000000000000020e-13;
// Test data for nu=0.50000000000000000.
// max(|f - f_GSL|): 7.7715611723760958e-16
// max(|f - f_GSL| / |f_GSL|): 1.1959227189513475e-15
const testcase_cyl_bessel_j<double>
data003[21] =
{
{ 0.0000000000000000, 0.50000000000000000, 0.0000000000000000 },
{ 0.39479959874136972, 0.50000000000000000, 0.25000000000000000 },
{ 0.54097378993452760, 0.50000000000000000, 0.50000000000000000 },
{ 0.62800587637588623, 0.50000000000000000, 0.75000000000000000 },
{ 0.67139670714180244, 0.50000000000000000, 1.0000000000000000 },
{ 0.67724253810014312, 0.50000000000000000, 1.2500000000000000 },
{ 0.64983807475374655, 0.50000000000000000, 1.5000000000000000 },
{ 0.59348525447147382, 0.50000000000000000, 1.7500000000000000 },
{ 0.51301613656182721, 0.50000000000000000, 2.0000000000000000 },
{ 0.41387506064759982, 0.50000000000000000, 2.2500000000000000 },
{ 0.30200490606236535, 0.50000000000000000, 2.5000000000000000 },
{ 0.18363332138431521, 0.50000000000000000, 2.7500000000000000 },
{ 0.065008182877375753, 0.50000000000000000, 3.0000000000000000 },
{ -0.047885729975898544, 0.50000000000000000, 3.2500000000000000 },
{ -0.14960456964952620, 0.50000000000000000, 3.5000000000000000 },
{ -0.23549801845815513, 0.50000000000000000, 3.7500000000000000 },
{ -0.30192051329163944, 0.50000000000000000, 4.0000000000000000 },
{ -0.34638850218952444, 0.50000000000000000, 4.2500000000000000 },
{ -0.36767487332724025, 0.50000000000000000, 4.5000000000000000 },
{ -0.36583563802350400, 0.50000000000000000, 4.7500000000000000 },
{ -0.34216798479816180, 0.50000000000000000, 5.0000000000000000 },
};
const double toler003 = 2.5000000000000020e-13;
// Test data for nu=0.66666666666666663.
// max(|f - f_GSL|): 7.7715611723760958e-16
// max(|f - f_GSL| / |f_GSL|): 1.4163878424300161e-15
const testcase_cyl_bessel_j<double>
data004[21] =
{
{ 0.0000000000000000, 0.66666666666666663, 0.0000000000000000 },
{ 0.27434438998865135, 0.66666666666666663, 0.25000000000000000 },
{ 0.42331075068448321, 0.66666666666666663, 0.50000000000000000 },
{ 0.52870551548162792, 0.66666666666666663, 0.75000000000000000 },
{ 0.59794997367362801, 0.66666666666666663, 1.0000000000000000 },
{ 0.63338726889075891, 0.66666666666666663, 1.2500000000000000 },
{ 0.63673234502877385, 0.66666666666666663, 1.5000000000000000 },
{ 0.61022230460131899, 0.66666666666666663, 1.7500000000000000 },
{ 0.55696967691913712, 0.66666666666666663, 2.0000000000000000 },
{ 0.48101276749106114, 0.66666666666666663, 2.2500000000000000 },
{ 0.38721242477084306, 0.66666666666666663, 2.5000000000000000 },
{ 0.28105724771080542, 0.66666666666666663, 2.7500000000000000 },
{ 0.16841218049067044, 0.66666666666666663, 3.0000000000000000 },
{ 0.055235893475364915, 0.66666666666666663, 3.2500000000000000 },
{ -0.052711584404031925, 0.66666666666666663, 3.5000000000000000 },
{ -0.15015178042293029, 0.66666666666666663, 3.7500000000000000 },
{ -0.23254408502670390, 0.66666666666666663, 4.0000000000000000 },
{ -0.29630067002972543, 0.66666666666666663, 4.2500000000000000 },
{ -0.33894810189777724, 0.66666666666666663, 4.5000000000000000 },
{ -0.35922706960321099, 0.66666666666666663, 4.7500000000000000 },
{ -0.35712533549168868, 0.66666666666666663, 5.0000000000000000 },
};
const double toler004 = 2.5000000000000020e-13;
// Test data for nu=1.0000000000000000.
// max(|f - f_GSL|): 2.2204460492503131e-16
// max(|f - f_GSL| / |f_GSL|): 6.7783500059747526e-16
const testcase_cyl_bessel_j<double>
data005[21] =
{
{ 0.0000000000000000, 1.0000000000000000, 0.0000000000000000 },
{ 0.12402597732272694, 1.0000000000000000, 0.25000000000000000 },
{ 0.24226845767487390, 1.0000000000000000, 0.50000000000000000 },
{ 0.34924360217486222, 1.0000000000000000, 0.75000000000000000 },
{ 0.44005058574493355, 1.0000000000000000, 1.0000000000000000 },
{ 0.51062326031988059, 1.0000000000000000, 1.2500000000000000 },
{ 0.55793650791009952, 1.0000000000000000, 1.5000000000000000 },
{ 0.58015619763899240, 1.0000000000000000, 1.7500000000000000 },
{ 0.57672480775687363, 1.0000000000000000, 2.0000000000000000 },
{ 0.54837835664696011, 1.0000000000000000, 2.2500000000000000 },
{ 0.49709410246427416, 1.0000000000000000, 2.5000000000000000 },
{ 0.42597230295790256, 1.0000000000000000, 2.7500000000000000 },
{ 0.33905895852593648, 1.0000000000000000, 3.0000000000000000 },
{ 0.24111968801520400, 1.0000000000000000, 3.2500000000000000 },
{ 0.13737752736232706, 1.0000000000000000, 3.5000000000000000 },
{ 0.033229349129679724, 1.0000000000000000, 3.7500000000000000 },
{ -0.066043328023549230, 1.0000000000000000, 4.0000000000000000 },
{ -0.15555319297834286, 1.0000000000000000, 4.2500000000000000 },
{ -0.23106043192337070, 1.0000000000000000, 4.5000000000000000 },
{ -0.28918679864711044, 1.0000000000000000, 4.7500000000000000 },
{ -0.32757913759146529, 1.0000000000000000, 5.0000000000000000 },
};
const double toler005 = 2.5000000000000020e-13;
// Test data for nu=2.0000000000000000.
// max(|f - f_GSL|): 5.5511151231257827e-17
// max(|f - f_GSL| / |f_GSL|): 2.4155555971238584e-16
const testcase_cyl_bessel_j<double>
data006[21] =
{
{ 0.0000000000000000, 2.0000000000000000, 0.0000000000000000 },
{ 0.0077718892859626760, 2.0000000000000000, 0.25000000000000000 },
{ 0.030604023458682638, 2.0000000000000000, 0.50000000000000000 },
{ 0.067073997299650551, 2.0000000000000000, 0.75000000000000000 },
{ 0.11490348493190047, 2.0000000000000000, 1.0000000000000000 },
{ 0.17109113124052350, 2.0000000000000000, 1.2500000000000000 },
{ 0.23208767214421472, 2.0000000000000000, 1.5000000000000000 },
{ 0.29400312425941216, 2.0000000000000000, 1.7500000000000000 },
{ 0.35283402861563773, 2.0000000000000000, 2.0000000000000000 },
{ 0.40469757684189717, 2.0000000000000000, 2.2500000000000000 },
{ 0.44605905843961718, 2.0000000000000000, 2.5000000000000000 },
{ 0.47393946632335160, 2.0000000000000000, 2.7500000000000000 },
{ 0.48609126058589119, 2.0000000000000000, 3.0000000000000000 },
{ 0.48113214864150627, 2.0000000000000000, 3.2500000000000000 },
{ 0.45862918419430765, 2.0000000000000000, 3.5000000000000000 },
{ 0.41912837447200352, 2.0000000000000000, 3.7500000000000000 },
{ 0.36412814585207293, 2.0000000000000000, 4.0000000000000000 },
{ 0.29599826772185189, 2.0000000000000000, 4.2500000000000000 },
{ 0.21784898368584549, 2.0000000000000000, 4.5000000000000000 },
{ 0.13335796490311685, 2.0000000000000000, 4.7500000000000000 },
{ 0.046565116277751971, 2.0000000000000000, 5.0000000000000000 },
};
const double toler006 = 2.5000000000000020e-13;
// Test data for nu=5.0000000000000000.
// max(|f - f_GSL|): 1.3877787807814457e-16
// max(|f - f_GSL| / |f_GSL|): 1.4609680807504906e-15
const testcase_cyl_bessel_j<double>
data007[21] =
{
{ 0.0000000000000000, 5.0000000000000000, 0.0000000000000000 },
{ 2.5365161587472413e-07, 5.0000000000000000, 0.25000000000000000 },
{ 8.0536272413574753e-06, 5.0000000000000000, 0.50000000000000000 },
{ 6.0364166510576438e-05, 5.0000000000000000, 0.75000000000000000 },
{ 0.00024975773021123450, 5.0000000000000000, 1.0000000000000000 },
{ 0.00074440885254749821, 5.0000000000000000, 1.2500000000000000 },
{ 0.0017994217673606111, 5.0000000000000000, 1.5000000000000000 },
{ 0.0037577257273157133, 5.0000000000000000, 1.7500000000000000 },
{ 0.0070396297558716842, 5.0000000000000000, 2.0000000000000000 },
{ 0.012121078633445751, 5.0000000000000000, 2.2500000000000000 },
{ 0.019501625134503223, 5.0000000000000000, 2.5000000000000000 },
{ 0.029664058320006174, 5.0000000000000000, 2.7500000000000000 },
{ 0.043028434877047578, 5.0000000000000000, 3.0000000000000000 },
{ 0.059903888098560426, 5.0000000000000000, 3.2500000000000000 },
{ 0.080441986647991792, 5.0000000000000000, 3.5000000000000000 },
{ 0.10459554742314070, 5.0000000000000000, 3.7500000000000000 },
{ 0.13208665604709827, 5.0000000000000000, 4.0000000000000000 },
{ 0.16238721643623680, 5.0000000000000000, 4.2500000000000000 },
{ 0.19471465863871368, 5.0000000000000000, 4.5000000000000000 },
{ 0.22804452118769436, 5.0000000000000000, 4.7500000000000000 },
{ 0.26114054612017007, 5.0000000000000000, 5.0000000000000000 },
};
const double toler007 = 2.5000000000000020e-13;
// Test data for nu=10.000000000000000.
// max(|f - f_GSL|): 3.2526065174565133e-18
// max(|f - f_GSL| / |f_GSL|): 3.9336732209858561e-15
const testcase_cyl_bessel_j<double>
data008[21] =
{
{ 0.0000000000000000, 10.000000000000000, 0.0000000000000000 },
{ 2.5628321598050096e-16, 10.000000000000000, 0.25000000000000000 },
{ 2.6131773608228023e-13, 10.000000000000000, 0.50000000000000000 },
{ 1.4962171311759677e-11, 10.000000000000000, 0.75000000000000000 },
{ 2.6306151236874524e-10, 10.000000000000000, 1.0000000000000000 },
{ 2.4187548221114514e-09, 10.000000000000000, 1.2500000000000000 },
{ 1.4743269078039996e-08, 10.000000000000000, 1.5000000000000000 },
{ 6.7608502849897560e-08, 10.000000000000000, 1.7500000000000000 },
{ 2.5153862827167358e-07, 10.000000000000000, 2.0000000000000000 },
{ 7.9717051583730038e-07, 10.000000000000000, 2.2500000000000000 },
{ 2.2247284173983839e-06, 10.000000000000000, 2.5000000000000000 },
{ 5.5985475639210430e-06, 10.000000000000000, 2.7500000000000000 },
{ 1.2928351645715880e-05, 10.000000000000000, 3.0000000000000000 },
{ 2.7761691354244538e-05, 10.000000000000000, 3.2500000000000000 },
{ 5.6009495875078844e-05, 10.000000000000000, 3.5000000000000000 },
{ 0.00010703761729231951, 10.000000000000000, 3.7500000000000000 },
{ 0.00019504055466003446, 10.000000000000000, 4.0000000000000000 },
{ 0.00034068888474064193, 10.000000000000000, 4.2500000000000000 },
{ 0.00057300977667164505, 10.000000000000000, 4.5000000000000000 },
{ 0.00093142172588886810, 10.000000000000000, 4.7500000000000000 },
{ 0.0014678026473104744, 10.000000000000000, 5.0000000000000000 },
};
const double toler008 = 2.5000000000000020e-13;
// Test data for nu=20.000000000000000.
// max(|f - f_GSL|): 1.9387045606711586e-26
// max(|f - f_GSL| / |f_GSL|): 2.1275572270326799e-15
const testcase_cyl_bessel_j<double>
data009[21] =
{
{ 0.0000000000000000, 20.000000000000000, 0.0000000000000000 },
{ 3.5624805510586969e-37, 20.000000000000000, 0.25000000000000000 },
{ 3.7272019617047132e-31, 20.000000000000000, 0.50000000000000000 },
{ 1.2347870693633488e-27, 20.000000000000000, 0.75000000000000000 },
{ 3.8735030085246562e-25, 20.000000000000000, 1.0000000000000000 },
{ 3.3372897667043766e-23, 20.000000000000000, 1.2500000000000000 },
{ 1.2689972189332558e-21, 20.000000000000000, 1.5000000000000000 },
{ 2.7427715944032989e-20, 20.000000000000000, 1.7500000000000000 },
{ 3.9189728050907524e-19, 20.000000000000000, 2.0000000000000000 },
{ 4.0805232551365158e-18, 20.000000000000000, 2.2500000000000000 },
{ 3.3090793836587786e-17, 20.000000000000000, 2.5000000000000000 },
{ 2.1915404680645990e-16, 20.000000000000000, 2.7500000000000000 },
{ 1.2275946737992981e-15, 20.000000000000000, 3.0000000000000000 },
{ 5.9727663938305382e-15, 20.000000000000000, 3.2500000000000000 },
{ 2.5768553102807590e-14, 20.000000000000000, 3.5000000000000000 },
{ 1.0021112208287217e-13, 20.000000000000000, 3.7500000000000000 },
{ 3.5595116285938516e-13, 20.000000000000000, 4.0000000000000000 },
{ 1.1673622958555074e-12, 20.000000000000000, 4.2500000000000000 },
{ 3.5665470983611762e-12, 20.000000000000000, 4.5000000000000000 },
{ 1.0227564044880958e-11, 20.000000000000000, 4.7500000000000000 },
{ 2.7703300521289426e-11, 20.000000000000000, 5.0000000000000000 },
};
const double toler009 = 2.5000000000000020e-13;
// cyl_bessel_j
// Test data for nu=0.0000000000000000.
// max(|f - f_GSL|): 7.6709472107694410e-15
// max(|f - f_GSL| / |f_GSL|): 4.1048891312746575e-13
const testcase_cyl_bessel_j<double>
data010[21] =
{
{ 1.0000000000000000, 0.0000000000000000, 0.0000000000000000 },
{ -0.17759677131433835, 0.0000000000000000, 5.0000000000000000 },
{ -0.24593576445134835, 0.0000000000000000, 10.000000000000000 },
{ -0.014224472826780771, 0.0000000000000000, 15.000000000000000 },
{ 0.16702466434058319, 0.0000000000000000, 20.000000000000000 },
{ 0.096266783275958154, 0.0000000000000000, 25.000000000000000 },
{ -0.086367983581040142, 0.0000000000000000, 30.000000000000000 },
{ -0.12684568275631256, 0.0000000000000000, 35.000000000000000 },
{ 0.0073668905842374085, 0.0000000000000000, 40.000000000000000 },
{ 0.11581867067325631, 0.0000000000000000, 45.000000000000000 },
{ 0.055812327669251746, 0.0000000000000000, 50.000000000000000 },
{ -0.074548302648236808, 0.0000000000000000, 55.000000000000000 },
{ -0.091471804089061859, 0.0000000000000000, 60.000000000000000 },
{ 0.018687343227677979, 0.0000000000000000, 65.000000000000000 },
{ 0.094908726483013545, 0.0000000000000000, 70.000000000000000 },
{ 0.034643913805097008, 0.0000000000000000, 75.000000000000000 },
{ -0.069742165512210033, 0.0000000000000000, 80.000000000000000 },
{ -0.070940394796273273, 0.0000000000000000, 85.000000000000000 },
{ 0.026630016699969526, 0.0000000000000000, 90.000000000000000 },
{ 0.081811967783384135, 0.0000000000000000, 95.000000000000000 },
{ 0.019985850304223170, 0.0000000000000000, 100.00000000000000 },
};
const double toler010 = 2.5000000000000014e-11;
// Test data for nu=0.33333333333333331.
// max(|f - f_GSL|): 7.9311557321659620e-15
// max(|f - f_GSL| / |f_GSL|): 4.2444155318123211e-12
const testcase_cyl_bessel_j<double>
data011[21] =
{
{ 0.0000000000000000, 0.33333333333333331, 0.0000000000000000 },
{ -0.30642046380026405, 0.33333333333333331, 5.0000000000000000 },
{ -0.18614516704869571, 0.33333333333333331, 10.000000000000000 },
{ 0.089740004221152650, 0.33333333333333331, 15.000000000000000 },
{ 0.17606058001293901, 0.33333333333333331, 20.000000000000000 },
{ 0.020097162141383233, 0.33333333333333331, 25.000000000000000 },
{ -0.13334053387426159, 0.33333333333333331, 30.000000000000000 },
{ -0.087118009397765497, 0.33333333333333331, 35.000000000000000 },
{ 0.069202942818858179, 0.33333333333333331, 40.000000000000000 },
{ 0.11387616964518317, 0.33333333333333331, 45.000000000000000 },
{ -0.00057226680771808045, 0.33333333333333331, 50.000000000000000 },
{ -0.10331600929280822, 0.33333333333333331, 55.000000000000000 },
{ -0.055618147270528003, 0.33333333333333331, 60.000000000000000 },
{ 0.064711954014113948, 0.33333333333333331, 65.000000000000000 },
{ 0.086879926462481605, 0.33333333333333331, 70.000000000000000 },
{ -0.012614484229891068, 0.33333333333333331, 75.000000000000000 },
{ -0.088199784400034537, 0.33333333333333331, 80.000000000000000 },
{ -0.036703611076564523, 0.33333333333333331, 85.000000000000000 },
{ 0.062916286828779547, 0.33333333333333331, 90.000000000000000 },
{ 0.069465244416806030, 0.33333333333333331, 95.000000000000000 },
{ -0.021271244853702364, 0.33333333333333331, 100.00000000000000 },
};
const double toler011 = 2.5000000000000017e-10;
// Test data for nu=0.50000000000000000.
// max(|f - f_GSL|): 7.4246164771807344e-15
// max(|f - f_GSL| / |f_GSL|): 3.6725252809051799e-13
const testcase_cyl_bessel_j<double>
data012[21] =
{
{ 0.0000000000000000, 0.50000000000000000, 0.0000000000000000 },
{ -0.34216798479816180, 0.50000000000000000, 5.0000000000000000 },
{ -0.13726373575505049, 0.50000000000000000, 10.000000000000000 },
{ 0.13396768882243937, 0.50000000000000000, 15.000000000000000 },
{ 0.16288076385502984, 0.50000000000000000, 20.000000000000000 },
{ -0.021120283599650493, 0.50000000000000000, 25.000000000000000 },
{ -0.14392965337039987, 0.50000000000000000, 30.000000000000000 },
{ -0.057747757589458777, 0.50000000000000000, 35.000000000000000 },
{ 0.094000962389533649, 0.50000000000000000, 40.000000000000000 },
{ 0.10120783324271411, 0.50000000000000000, 45.000000000000000 },
{ -0.029605831888924641, 0.50000000000000000, 50.000000000000000 },
{ -0.10756039213265806, 0.50000000000000000, 55.000000000000000 },
{ -0.031397461182520438, 0.50000000000000000, 60.000000000000000 },
{ 0.081827430775628554, 0.50000000000000000, 65.000000000000000 },
{ 0.073802429539054554, 0.50000000000000000, 70.000000000000000 },
{ -0.035727009681702615, 0.50000000000000000, 75.000000000000000 },
{ -0.088661035811765460, 0.50000000000000000, 80.000000000000000 },
{ -0.015238065106312516, 0.50000000000000000, 85.000000000000000 },
{ 0.075189068550269425, 0.50000000000000000, 90.000000000000000 },
{ 0.055932643481494133, 0.50000000000000000, 95.000000000000000 },
{ -0.040402132716252127, 0.50000000000000000, 100.00000000000000 },
};
const double toler012 = 2.5000000000000014e-11;
// Test data for nu=0.66666666666666663.
// max(|f - f_GSL|): 6.3629657098829284e-15
// max(|f - f_GSL| / |f_GSL|): 1.2254869540384518e-12
const testcase_cyl_bessel_j<double>
data013[21] =
{
{ 0.0000000000000000, 0.66666666666666663, 0.0000000000000000 },
{ -0.35712533549168868, 0.66666666666666663, 5.0000000000000000 },
{ -0.080149603304315808, 0.66666666666666663, 10.000000000000000 },
{ 0.16918875175798079, 0.66666666666666663, 15.000000000000000 },
{ 0.13904826122116531, 0.66666666666666663, 20.000000000000000 },
{ -0.060770629698497600, 0.66666666666666663, 25.000000000000000 },
{ -0.14489851974205062, 0.66666666666666663, 30.000000000000000 },
{ -0.024604880159644394, 0.66666666666666663, 35.000000000000000 },
{ 0.11243936464912010, 0.66666666666666663, 40.000000000000000 },
{ 0.081776275512525309, 0.66666666666666663, 45.000000000000000 },
{ -0.056589908749367777, 0.66666666666666663, 50.000000000000000 },
{ -0.10455814523765931, 0.66666666666666663, 55.000000000000000 },
{ -0.0051030148548608456, 0.66666666666666663, 60.000000000000000 },
{ 0.093398227061639236, 0.66666666666666663, 65.000000000000000 },
{ 0.055763883611864913, 0.66666666666666663, 70.000000000000000 },
{ -0.056395322915757364, 0.66666666666666663, 75.000000000000000 },
{ -0.083131347805783087, 0.66666666666666663, 80.000000000000000 },
{ 0.0072315397874096648, 0.66666666666666663, 85.000000000000000 },
{ 0.082362798520905250, 0.66666666666666663, 90.000000000000000 },
{ 0.038630504403446168, 0.66666666666666663, 95.000000000000000 },
{ -0.056778819380529734, 0.66666666666666663, 100.00000000000000 },
};
const double toler013 = 1.0000000000000006e-10;
// Test data for nu=1.0000000000000000.
// max(|f - f_GSL|): 7.1435912740724916e-15
// max(|f - f_GSL| / |f_GSL|): 1.7857949645087573e-12
const testcase_cyl_bessel_j<double>
data014[21] =
{
{ 0.0000000000000000, 1.0000000000000000, 0.0000000000000000 },
{ -0.32757913759146529, 1.0000000000000000, 5.0000000000000000 },
{ 0.043472746168861459, 1.0000000000000000, 10.000000000000000 },
{ 0.20510403861352280, 1.0000000000000000, 15.000000000000000 },
{ 0.066833124175850078, 1.0000000000000000, 20.000000000000000 },
{ -0.12535024958028990, 1.0000000000000000, 25.000000000000000 },
{ -0.11875106261662294, 1.0000000000000000, 30.000000000000000 },
{ 0.043990942179625646, 1.0000000000000000, 35.000000000000000 },
{ 0.12603831803758500, 1.0000000000000000, 40.000000000000000 },
{ 0.028348854376424561, 1.0000000000000000, 45.000000000000000 },
{ -0.097511828125175129, 1.0000000000000000, 50.000000000000000 },
{ -0.078250038308684711, 1.0000000000000000, 55.000000000000000 },
{ 0.046598383758166370, 1.0000000000000000, 60.000000000000000 },
{ 0.097330172226126929, 1.0000000000000000, 65.000000000000000 },
{ 0.0099877887848385128, 1.0000000000000000, 70.000000000000000 },
{ -0.085139995044829081, 1.0000000000000000, 75.000000000000000 },
{ -0.056057296675712555, 1.0000000000000000, 80.000000000000000 },
{ 0.049151460334891130, 1.0000000000000000, 85.000000000000000 },
{ 0.079925646708868092, 1.0000000000000000, 90.000000000000000 },
{ -0.0023925612997269283, 1.0000000000000000, 95.000000000000000 },
{ -0.077145352014112129, 1.0000000000000000, 100.00000000000000 },
};
const double toler014 = 1.0000000000000006e-10;
// Test data for nu=2.0000000000000000.
// max(|f - f_GSL|): 7.6050277186823223e-15
// max(|f - f_GSL| / |f_GSL|): 2.0010877493528614e-12
const testcase_cyl_bessel_j<double>
data015[21] =
{
{ 0.0000000000000000, 2.0000000000000000, 0.0000000000000000 },
{ 0.046565116277751971, 2.0000000000000000, 5.0000000000000000 },
{ 0.25463031368512068, 2.0000000000000000, 10.000000000000000 },
{ 0.041571677975250486, 2.0000000000000000, 15.000000000000000 },
{ -0.16034135192299820, 2.0000000000000000, 20.000000000000000 },
{ -0.10629480324238134, 2.0000000000000000, 25.000000000000000 },
{ 0.078451246073265299, 2.0000000000000000, 30.000000000000000 },
{ 0.12935945088086259, 2.0000000000000000, 35.000000000000000 },
{ -0.0010649746823579794, 2.0000000000000000, 40.000000000000000 },
{ -0.11455872158985966, 2.0000000000000000, 45.000000000000000 },
{ -0.059712800794258863, 2.0000000000000000, 50.000000000000000 },
{ 0.071702846709739240, 2.0000000000000000, 55.000000000000000 },
{ 0.093025083547667420, 2.0000000000000000, 60.000000000000000 },
{ -0.015692568697643128, 2.0000000000000000, 65.000000000000000 },
{ -0.094623361089161029, 2.0000000000000000, 70.000000000000000 },
{ -0.036914313672959179, 2.0000000000000000, 75.000000000000000 },
{ 0.068340733095317172, 2.0000000000000000, 80.000000000000000 },
{ 0.072096899745329540, 2.0000000000000000, 85.000000000000000 },
{ -0.024853891217550248, 2.0000000000000000, 90.000000000000000 },
{ -0.081862337494957332, 2.0000000000000000, 95.000000000000000 },
{ -0.021528757344505364, 2.0000000000000000, 100.00000000000000 },
};
const double toler015 = 2.5000000000000017e-10;
// Test data for nu=5.0000000000000000.
// max(|f - f_GSL|): 6.8521577301083880e-15
// max(|f - f_GSL| / |f_GSL|): 5.6813560677959848e-13
const testcase_cyl_bessel_j<double>
data016[21] =
{
{ 0.0000000000000000, 5.0000000000000000, 0.0000000000000000 },
{ 0.26114054612017007, 5.0000000000000000, 5.0000000000000000 },
{ -0.23406152818679371, 5.0000000000000000, 10.000000000000000 },
{ 0.13045613456502966, 5.0000000000000000, 15.000000000000000 },
{ 0.15116976798239498, 5.0000000000000000, 20.000000000000000 },
{ -0.066007995398422933, 5.0000000000000000, 25.000000000000000 },
{ -0.14324029551207709, 5.0000000000000000, 30.000000000000000 },
{ -0.0015053072953907251, 5.0000000000000000, 35.000000000000000 },
{ 0.12257346597711777, 5.0000000000000000, 40.000000000000000 },
{ 0.057984499200954109, 5.0000000000000000, 45.000000000000000 },
{ -0.081400247696569616, 5.0000000000000000, 50.000000000000000 },
{ -0.092569895786432765, 5.0000000000000000, 55.000000000000000 },
{ 0.027454744228344204, 5.0000000000000000, 60.000000000000000 },
{ 0.099110527701539025, 5.0000000000000000, 65.000000000000000 },
{ 0.026058129823895364, 5.0000000000000000, 70.000000000000000 },
{ -0.078523977013751398, 5.0000000000000000, 75.000000000000000 },
{ -0.065862349140031584, 5.0000000000000000, 80.000000000000000 },
{ 0.038669072284680979, 5.0000000000000000, 85.000000000000000 },
{ 0.082759319528415157, 5.0000000000000000, 90.000000000000000 },
{ 0.0079423372702472871, 5.0000000000000000, 95.000000000000000 },
{ -0.074195736964513898, 5.0000000000000000, 100.00000000000000 },
};
const double toler016 = 5.0000000000000028e-11;
// Test data for nu=10.000000000000000.
// max(|f - f_GSL|): 7.2303274478713320e-15
// max(|f - f_GSL| / |f_GSL|): 3.6974790630140835e-13
const testcase_cyl_bessel_j<double>
data017[21] =
{
{ 0.0000000000000000, 10.000000000000000, 0.0000000000000000 },
{ 0.0014678026473104744, 10.000000000000000, 5.0000000000000000 },
{ 0.20748610663335865, 10.000000000000000, 10.000000000000000 },
{ -0.090071811047659087, 10.000000000000000, 15.000000000000000 },
{ 0.18648255802394512, 10.000000000000000, 20.000000000000000 },
{ -0.075179843948523312, 10.000000000000000, 25.000000000000000 },
{ -0.12987689399858882, 10.000000000000000, 30.000000000000000 },
{ 0.063546391343962866, 10.000000000000000, 35.000000000000000 },
{ 0.11938336278226094, 10.000000000000000, 40.000000000000000 },
{ -0.026971402475010831, 10.000000000000000, 45.000000000000000 },
{ -0.11384784914946940, 10.000000000000000, 50.000000000000000 },
{ -0.015773790303746080, 10.000000000000000, 55.000000000000000 },
{ 0.097177143328071064, 10.000000000000000, 60.000000000000000 },
{ 0.054617389951112129, 10.000000000000000, 65.000000000000000 },
{ -0.065870338561952013, 10.000000000000000, 70.000000000000000 },
{ -0.080417867891894437, 10.000000000000000, 75.000000000000000 },
{ 0.024043850978184747, 10.000000000000000, 80.000000000000000 },
{ 0.086824832700067869, 10.000000000000000, 85.000000000000000 },
{ 0.019554748856312299, 10.000000000000000, 90.000000000000000 },
{ -0.072341598669443757, 10.000000000000000, 95.000000000000000 },
{ -0.054732176935472096, 10.000000000000000, 100.00000000000000 },
};
const double toler017 = 2.5000000000000014e-11;
// Test data for nu=20.000000000000000.
// max(|f - f_GSL|): 7.7177847446208148e-15
// max(|f - f_GSL| / |f_GSL|): 1.1191513260854523e-12
const testcase_cyl_bessel_j<double>
data018[21] =
{
{ 0.0000000000000000, 20.000000000000000, 0.0000000000000000 },
{ 2.7703300521289426e-11, 20.000000000000000, 5.0000000000000000 },
{ 1.1513369247813403e-05, 20.000000000000000, 10.000000000000000 },
{ 0.0073602340792234934, 20.000000000000000, 15.000000000000000 },
{ 0.16474777377532665, 20.000000000000000, 20.000000000000000 },
{ 0.051994049228303307, 20.000000000000000, 25.000000000000000 },
{ 0.0048310199934040923, 20.000000000000000, 30.000000000000000 },
{ -0.10927417397178038, 20.000000000000000, 35.000000000000000 },
{ 0.12779393355084889, 20.000000000000000, 40.000000000000000 },
{ 0.0047633437900313621, 20.000000000000000, 45.000000000000000 },
{ -0.11670435275957974, 20.000000000000000, 50.000000000000000 },
{ 0.025389204574566639, 20.000000000000000, 55.000000000000000 },
{ 0.10266020557876326, 20.000000000000000, 60.000000000000000 },
{ -0.023138582263434154, 20.000000000000000, 65.000000000000000 },
{ -0.096058573489952365, 20.000000000000000, 70.000000000000000 },
{ 0.0068961047221522270, 20.000000000000000, 75.000000000000000 },
{ 0.090565405489918357, 20.000000000000000, 80.000000000000000 },
{ 0.015985497599497172, 20.000000000000000, 85.000000000000000 },
{ -0.080345344044422534, 20.000000000000000, 90.000000000000000 },
{ -0.040253075701614051, 20.000000000000000, 95.000000000000000 },
{ 0.062217458498338672, 20.000000000000000, 100.00000000000000 },
};
const double toler018 = 1.0000000000000006e-10;
// Test data for nu=50.000000000000000.
// max(|f - f_GSL|): 6.6543992538470320e-15
// max(|f - f_GSL| / |f_GSL|): 1.6466369526724007e-13
const testcase_cyl_bessel_j<double>
data019[21] =
{
{ 0.0000000000000000, 50.000000000000000, 0.0000000000000000 },
{ 2.2942476159525415e-45, 50.000000000000000, 5.0000000000000000 },
{ 1.7845136078715964e-30, 50.000000000000000, 10.000000000000000 },
{ 6.1060519495338733e-22, 50.000000000000000, 15.000000000000000 },
{ 4.4510392847006872e-16, 50.000000000000000, 20.000000000000000 },
{ 9.7561594280229808e-12, 50.000000000000000, 25.000000000000000 },
{ 2.0581656631564172e-08, 50.000000000000000, 30.000000000000000 },
{ 7.6069951699272960e-06, 50.000000000000000, 35.000000000000000 },
{ 0.00068185243531768309, 50.000000000000000, 40.000000000000000 },
{ 0.017284343240791214, 50.000000000000000, 45.000000000000000 },
{ 0.12140902189761507, 50.000000000000000, 50.000000000000000 },
{ 0.13594720957176012, 50.000000000000000, 55.000000000000000 },
{ -0.13798273148535209, 50.000000000000000, 60.000000000000000 },
{ 0.12116217746619409, 50.000000000000000, 65.000000000000000 },
{ -0.11394866738787145, 50.000000000000000, 70.000000000000000 },
{ 0.094076799581573348, 50.000000000000000, 75.000000000000000 },
{ -0.039457764590251347, 50.000000000000000, 80.000000000000000 },
{ -0.040412060734136383, 50.000000000000000, 85.000000000000000 },
{ 0.090802099838032266, 50.000000000000000, 90.000000000000000 },
{ -0.055979156267280165, 50.000000000000000, 95.000000000000000 },
{ -0.038698339728525440, 50.000000000000000, 100.00000000000000 },
};
const double toler019 = 1.0000000000000006e-11;
// Test data for nu=100.00000000000000.
// max(|f - f_GSL|): 4.8138576458356397e-17
// max(|f - f_GSL| / |f_GSL|): 1.0835289187603112e-13
const testcase_cyl_bessel_j<double>
data020[21] =
{
{ 0.0000000000000000, 100.00000000000000, 0.0000000000000000 },
{ 6.2677893955418763e-119, 100.00000000000000, 5.0000000000000000 },
{ 6.5973160641553816e-89, 100.00000000000000, 10.000000000000000 },
{ 1.9660095611249536e-71, 100.00000000000000, 15.000000000000000 },
{ 3.9617550943362524e-59, 100.00000000000000, 20.000000000000000 },
{ 1.1064482655301687e-49, 100.00000000000000, 25.000000000000000 },
{ 4.5788015281752354e-42, 100.00000000000000, 30.000000000000000 },
{ 9.9210206714732606e-36, 100.00000000000000, 35.000000000000000 },
{ 2.3866062996027414e-30, 100.00000000000000, 40.000000000000000 },
{ 1.0329791804565538e-25, 100.00000000000000, 45.000000000000000 },
{ 1.1159273690838340e-21, 100.00000000000000, 50.000000000000000 },
{ 3.7899753451900682e-18, 100.00000000000000, 55.000000000000000 },
{ 4.7832744078781205e-15, 100.00000000000000, 60.000000000000000 },
{ 2.5375564579490517e-12, 100.00000000000000, 65.000000000000000 },
{ 6.1982452141641260e-10, 100.00000000000000, 70.000000000000000 },
{ 7.4479005905904457e-08, 100.00000000000000, 75.000000000000000 },
{ 4.6065530648234948e-06, 100.00000000000000, 80.000000000000000 },
{ 0.00015043869999501765, 100.00000000000000, 85.000000000000000 },
{ 0.0026021305819963472, 100.00000000000000, 90.000000000000000 },
{ 0.023150768009428030, 100.00000000000000, 95.000000000000000 },
{ 0.096366673295861571, 100.00000000000000, 100.00000000000000 },
};
const double toler020 = 1.0000000000000006e-11;
template<typename Tp, unsigned int Num>
void
test(const testcase_cyl_bessel_j<Tp> (&data)[Num], Tp toler)
{
bool test __attribute__((unused)) = true;
const Tp eps = std::numeric_limits<Tp>::epsilon();
Tp max_abs_diff = -Tp(1);
Tp max_abs_frac = -Tp(1);
unsigned int num_datum = Num;
for (unsigned int i = 0; i < num_datum; ++i)
{
const Tp f = std::cyl_bessel_j(data[i].nu, data[i].x);
const Tp f0 = data[i].f0;
const Tp diff = f - f0;
if (std::abs(diff) > max_abs_diff)
max_abs_diff = std::abs(diff);
if (std::abs(f0) > Tp(10) * eps
&& std::abs(f) > Tp(10) * eps)
{
const Tp frac = diff / f0;
if (std::abs(frac) > max_abs_frac)
max_abs_frac = std::abs(frac);
}
}
VERIFY(max_abs_frac < toler);
}
int
main()
{
test(data001, toler001);
test(data002, toler002);
test(data003, toler003);
test(data004, toler004);
test(data005, toler005);
test(data006, toler006);
test(data007, toler007);
test(data008, toler008);
test(data009, toler009);
test(data010, toler010);
test(data011, toler011);
test(data012, toler012);
test(data013, toler013);
test(data014, toler014);
test(data015, toler015);
test(data016, toler016);
test(data017, toler017);
test(data018, toler018);
test(data019, toler019);
test(data020, toler020);
return 0;
}

View File

@ -0,0 +1,40 @@
// { dg-do compile }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.8 cyl_bessel_j
#include <cmath>
void
test01()
{
float nuf = 1.0F / 3.0F, xf = 0.5F;
double nud = 1.0 / 3.0, xd = 0.5;
long double nul = 1.0L / 3.0L, xl = 0.5L;
std::cyl_bessel_j(nuf, xf);
std::cyl_bessel_jf(nuf, xf);
std::cyl_bessel_j(nud, xd);
std::cyl_bessel_j(nul, xl);
std::cyl_bessel_jl(nul, xl);
return;
}

View File

@ -0,0 +1,41 @@
// { dg-do compile { xfail *-*-* } }
// { dg-excess-errors "" }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.8 cyl_bessel_j
#include <math.h>
void
test01()
{
float nuf = 1.0F / 3.0F, xf = 0.5F;
double nud = 1.0 / 3.0, xd = 0.5;
long double nul = 1.0L / 3.0L, xl = 0.5L;
cyl_bessel_j(nuf, xf);
cyl_bessel_jf(nuf, xf);
cyl_bessel_j(nud, xd);
cyl_bessel_j(nul, xl);
cyl_bessel_jl(nul, xl);
return;
}

View File

@ -0,0 +1,88 @@
// { dg-require-c-std "" }
// { dg-add-options ieee }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.9 cyl_bessel_k
#include <cmath>
#include <testsuite_hooks.h>
void
test01()
{
float xf = std::numeric_limits<float>::quiet_NaN();
double xd = std::numeric_limits<double>::quiet_NaN();
long double xl = std::numeric_limits<long double>::quiet_NaN();
float nuf = 0.0F;
double nud = 0.0;
long double nul = 0.0L;
float a = std::cyl_bessel_k(nuf, xf);
float b = std::cyl_bessel_kf(nuf, xf);
double c = std::cyl_bessel_k(nud, xd);
long double d = std::cyl_bessel_k(nul, xl);
long double e = std::cyl_bessel_kl(nul, xl);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
void
test02()
{
float xf = 1.0F;
double xd = 1.0;
long double xl = 1.0L;
float nuf = std::numeric_limits<float>::quiet_NaN();
double nud = std::numeric_limits<double>::quiet_NaN();
long double nul = std::numeric_limits<long double>::quiet_NaN();
float a = std::cyl_bessel_k(nuf, xf);
float b = std::cyl_bessel_kf(nuf, xf);
double c = std::cyl_bessel_k(nud, xd);
long double d = std::cyl_bessel_k(nul, xl);
long double e = std::cyl_bessel_kl(nul, xl);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
int
main()
{
test01();
test02();
return 0;
}

View File

@ -0,0 +1,732 @@
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
//
// Copyright (C) 2016 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/>.
// cyl_bessel_k
// Compare against values generated by the GNU Scientific Library.
// The GSL can be found on the web: http://www.gnu.org/software/gsl/
#include <limits>
#include <cmath>
#if defined(__TEST_DEBUG)
# include <iostream>
# define VERIFY(A) \
if (!(A)) \
{ \
std::cout << "line " << __LINE__ \
<< " max_abs_frac = " << max_abs_frac \
<< std::endl; \
}
#else
# include <testsuite_hooks.h>
#endif
#include <specfun_testcase.h>
// Test data for nu=0.0000000000000000.
// max(|f - f_GSL|): 2.2204460492503131e-16
// max(|f - f_GSL| / |f_GSL|): 1.7863051312335036e-16
const testcase_cyl_bessel_k<double>
data001[20] =
{
{ 1.5415067512483025, 0.0000000000000000, 0.25000000000000000 },
{ 0.92441907122766565, 0.0000000000000000, 0.50000000000000000 },
{ 0.61058242211646430, 0.0000000000000000, 0.75000000000000000 },
{ 0.42102443824070829, 0.0000000000000000, 1.0000000000000000 },
{ 0.29760308908410588, 0.0000000000000000, 1.2500000000000000 },
{ 0.21380556264752565, 0.0000000000000000, 1.5000000000000000 },
{ 0.15537981238660362, 0.0000000000000000, 1.7500000000000000 },
{ 0.11389387274953360, 0.0000000000000000, 2.0000000000000000 },
{ 0.084043111974658191, 0.0000000000000000, 2.2500000000000000 },
{ 0.062347553200366168, 0.0000000000000000, 2.5000000000000000 },
{ 0.046454901308760774, 0.0000000000000000, 2.7500000000000000 },
{ 0.034739504386279256, 0.0000000000000000, 3.0000000000000000 },
{ 0.026058755255154966, 0.0000000000000000, 3.2500000000000000 },
{ 0.019598897170368501, 0.0000000000000000, 3.5000000000000000 },
{ 0.014774250877128706, 0.0000000000000000, 3.7500000000000000 },
{ 0.011159676085853026, 0.0000000000000000, 4.0000000000000000 },
{ 0.0084443877245429649, 0.0000000000000000, 4.2500000000000000 },
{ 0.0063998572432339747, 0.0000000000000000, 4.5000000000000000 },
{ 0.0048572045578879524, 0.0000000000000000, 4.7500000000000000 },
{ 0.0036910983340425947, 0.0000000000000000, 5.0000000000000000 },
};
const double toler001 = 2.5000000000000020e-13;
// Test data for nu=0.33333333333333331.
// max(|f - f_GSL|): 1.3322676295501878e-15
// max(|f - f_GSL| / |f_GSL|): 4.3522010494015439e-15
const testcase_cyl_bessel_k<double>
data002[20] =
{
{ 1.7144912564234518, 0.33333333333333331, 0.25000000000000000 },
{ 0.98903107424672421, 0.33333333333333331, 0.50000000000000000 },
{ 0.64216899667282989, 0.33333333333333331, 0.75000000000000000 },
{ 0.43843063344153432, 0.33333333333333331, 1.0000000000000000 },
{ 0.30788192414945043, 0.33333333333333331, 1.2500000000000000 },
{ 0.22015769026776688, 0.33333333333333331, 1.5000000000000000 },
{ 0.15943413057311245, 0.33333333333333331, 1.7500000000000000 },
{ 0.11654496129616534, 0.33333333333333331, 2.0000000000000000 },
{ 0.085809609306439674, 0.33333333333333331, 2.2500000000000000 },
{ 0.063542537454733386, 0.33333333333333331, 2.5000000000000000 },
{ 0.047273354184795509, 0.33333333333333331, 2.7500000000000000 },
{ 0.035305904902162587, 0.33333333333333331, 3.0000000000000000 },
{ 0.026454186892773169, 0.33333333333333331, 3.2500000000000000 },
{ 0.019877061407943805, 0.33333333333333331, 3.5000000000000000 },
{ 0.014971213514760214, 0.33333333333333331, 3.7500000000000000 },
{ 0.011299947573672165, 0.33333333333333331, 4.0000000000000000 },
{ 0.0085447959546110473, 0.33333333333333331, 4.2500000000000000 },
{ 0.0064720581217078237, 0.33333333333333331, 4.5000000000000000 },
{ 0.0049093342803275264, 0.33333333333333331, 4.7500000000000000 },
{ 0.0037288750960535887, 0.33333333333333331, 5.0000000000000000 },
};
const double toler002 = 2.5000000000000020e-13;
// Test data for nu=0.50000000000000000.
// max(|f - f_GSL|): 1.3322676295501878e-15
// max(|f - f_GSL| / |f_GSL|): 1.5172850443872369e-15
const testcase_cyl_bessel_k<double>
data003[20] =
{
{ 1.9521640631515476, 0.50000000000000000, 0.25000000000000000 },
{ 1.0750476034999195, 0.50000000000000000, 0.50000000000000000 },
{ 0.68361006034952421, 0.50000000000000000, 0.75000000000000000 },
{ 0.46106850444789454, 0.50000000000000000, 1.0000000000000000 },
{ 0.32117137397144746, 0.50000000000000000, 1.2500000000000000 },
{ 0.22833505222826550, 0.50000000000000000, 1.5000000000000000 },
{ 0.16463628997380864, 0.50000000000000000, 1.7500000000000000 },
{ 0.11993777196806145, 0.50000000000000000, 2.0000000000000000 },
{ 0.088065558803650454, 0.50000000000000000, 2.2500000000000000 },
{ 0.065065943154009986, 0.50000000000000000, 2.5000000000000000 },
{ 0.048315198301417825, 0.50000000000000000, 2.7500000000000000 },
{ 0.036025985131764589, 0.50000000000000000, 3.0000000000000000 },
{ 0.026956356532443351, 0.50000000000000000, 3.2500000000000000 },
{ 0.020229969578139294, 0.50000000000000000, 3.5000000000000000 },
{ 0.015220888252975564, 0.50000000000000000, 3.7500000000000000 },
{ 0.011477624576608052, 0.50000000000000000, 4.0000000000000000 },
{ 0.0086718932956978342, 0.50000000000000000, 4.2500000000000000 },
{ 0.0065633945646345407, 0.50000000000000000, 4.5000000000000000 },
{ 0.0049752435421262292, 0.50000000000000000, 4.7500000000000000 },
{ 0.0037766133746428825, 0.50000000000000000, 5.0000000000000000 },
};
const double toler003 = 2.5000000000000020e-13;
// Test data for nu=0.66666666666666663.
// max(|f - f_GSL|): 4.4408920985006262e-16
// max(|f - f_GSL| / |f_GSL|): 8.1483075013172610e-16
const testcase_cyl_bessel_k<double>
data004[20] =
{
{ 2.3289060745544101, 0.66666666666666663, 0.25000000000000000 },
{ 1.2059304647203353, 0.66666666666666663, 0.50000000000000000 },
{ 0.74547232976647215, 0.66666666666666663, 0.75000000000000000 },
{ 0.49447506210420827, 0.66666666666666663, 1.0000000000000000 },
{ 0.34062994813514252, 0.66666666666666663, 1.2500000000000000 },
{ 0.24024045240315581, 0.66666666666666663, 1.5000000000000000 },
{ 0.17217716908452310, 0.66666666666666663, 1.7500000000000000 },
{ 0.12483892748812841, 0.66666666666666663, 2.0000000000000000 },
{ 0.091315296079621050, 0.66666666666666663, 2.2500000000000000 },
{ 0.067255322171623361, 0.66666666666666663, 2.5000000000000000 },
{ 0.049809546542402224, 0.66666666666666663, 2.7500000000000000 },
{ 0.037057074495188531, 0.66666666666666663, 3.0000000000000000 },
{ 0.027674365504886729, 0.66666666666666663, 3.2500000000000000 },
{ 0.020733915836010912, 0.66666666666666663, 3.5000000000000000 },
{ 0.015577015510251332, 0.66666666666666663, 3.7500000000000000 },
{ 0.011730801456525336, 0.66666666666666663, 4.0000000000000000 },
{ 0.0088528343204658851, 0.66666666666666663, 4.2500000000000000 },
{ 0.0066933190915775560, 0.66666666666666663, 4.5000000000000000 },
{ 0.0050689292106255480, 0.66666666666666663, 4.7500000000000000 },
{ 0.0038444246344968226, 0.66666666666666663, 5.0000000000000000 },
};
const double toler004 = 2.5000000000000020e-13;
// Test data for nu=1.0000000000000000.
// max(|f - f_GSL|): 5.5511151231257827e-17
// max(|f - f_GSL| / |f_GSL|): 2.7422040631145076e-16
const testcase_cyl_bessel_k<double>
data005[20] =
{
{ 3.7470259744407115, 1.0000000000000000, 0.25000000000000000 },
{ 1.6564411200033007, 1.0000000000000000, 0.50000000000000000 },
{ 0.94958046696214016, 1.0000000000000000, 0.75000000000000000 },
{ 0.60190723019723458, 1.0000000000000000, 1.0000000000000000 },
{ 0.40212407978419540, 1.0000000000000000, 1.2500000000000000 },
{ 0.27738780045684375, 1.0000000000000000, 1.5000000000000000 },
{ 0.19547745347439310, 1.0000000000000000, 1.7500000000000000 },
{ 0.13986588181652262, 1.0000000000000000, 2.0000000000000000 },
{ 0.10121630256832535, 1.0000000000000000, 2.2500000000000000 },
{ 0.073890816347747038, 1.0000000000000000, 2.5000000000000000 },
{ 0.054318522758919859, 1.0000000000000000, 2.7500000000000000 },
{ 0.040156431128194198, 1.0000000000000000, 3.0000000000000000 },
{ 0.029825529796040143, 1.0000000000000000, 3.2500000000000000 },
{ 0.022239392925923845, 1.0000000000000000, 3.5000000000000000 },
{ 0.016638191754688912, 1.0000000000000000, 3.7500000000000000 },
{ 0.012483498887268435, 1.0000000000000000, 4.0000000000000000 },
{ 0.0093896806560432589, 1.0000000000000000, 4.2500000000000000 },
{ 0.0070780949089680901, 1.0000000000000000, 4.5000000000000000 },
{ 0.0053459218178228390, 1.0000000000000000, 4.7500000000000000 },
{ 0.0040446134454521655, 1.0000000000000000, 5.0000000000000000 },
};
const double toler005 = 2.5000000000000020e-13;
// Test data for nu=2.0000000000000000.
// max(|f - f_GSL|): 3.5527136788005009e-15
// max(|f - f_GSL| / |f_GSL|): 1.9937716861613039e-16
const testcase_cyl_bessel_k<double>
data006[20] =
{
{ 31.517714546773998, 2.0000000000000000, 0.25000000000000000 },
{ 7.5501835512408695, 2.0000000000000000, 0.50000000000000000 },
{ 3.1427970006821715, 2.0000000000000000, 0.75000000000000000 },
{ 1.6248388986351774, 2.0000000000000000, 1.0000000000000000 },
{ 0.94100161673881855, 2.0000000000000000, 1.2500000000000000 },
{ 0.58365596325665070, 2.0000000000000000, 1.5000000000000000 },
{ 0.37878261635733856, 2.0000000000000000, 1.7500000000000000 },
{ 0.25375975456605621, 2.0000000000000000, 2.0000000000000000 },
{ 0.17401315870205850, 2.0000000000000000, 2.2500000000000000 },
{ 0.12146020627856381, 2.0000000000000000, 2.5000000000000000 },
{ 0.085959281497066137, 2.0000000000000000, 2.7500000000000000 },
{ 0.061510458471742059, 2.0000000000000000, 3.0000000000000000 },
{ 0.044412927437333515, 2.0000000000000000, 3.2500000000000000 },
{ 0.032307121699467839, 2.0000000000000000, 3.5000000000000000 },
{ 0.023647953146296127, 2.0000000000000000, 3.7500000000000000 },
{ 0.017401425529487244, 2.0000000000000000, 4.0000000000000000 },
{ 0.012863060974445674, 2.0000000000000000, 4.2500000000000000 },
{ 0.0095456772027753475, 2.0000000000000000, 4.5000000000000000 },
{ 0.0071081190074975690, 2.0000000000000000, 4.7500000000000000 },
{ 0.0053089437122234608, 2.0000000000000000, 5.0000000000000000 },
};
const double toler006 = 2.5000000000000020e-13;
// Test data for nu=5.0000000000000000.
// max(|f - f_GSL|): 5.8207660913467407e-11
// max(|f - f_GSL| / |f_GSL|): 2.4867363835720159e-16
const testcase_cyl_bessel_k<double>
data007[20] =
{
{ 391683.98962334893, 5.0000000000000000, 0.25000000000000000 },
{ 12097.979476096394, 5.0000000000000000, 0.50000000000000000 },
{ 1562.5870339691098, 5.0000000000000000, 0.75000000000000000 },
{ 360.96058960124066, 5.0000000000000000, 1.0000000000000000 },
{ 114.29321426334016, 5.0000000000000000, 1.2500000000000000 },
{ 44.067781159301056, 5.0000000000000000, 1.5000000000000000 },
{ 19.426568687730292, 5.0000000000000000, 1.7500000000000000 },
{ 9.4310491005964820, 5.0000000000000000, 2.0000000000000000 },
{ 4.9221270549918685, 5.0000000000000000, 2.2500000000000000 },
{ 2.7168842907865423, 5.0000000000000000, 2.5000000000000000 },
{ 1.5677685890536335, 5.0000000000000000, 2.7500000000000000 },
{ 0.93777360238680818, 5.0000000000000000, 3.0000000000000000 },
{ 0.57775534736785106, 5.0000000000000000, 3.2500000000000000 },
{ 0.36482440208451983, 5.0000000000000000, 3.5000000000000000 },
{ 0.23520290620082257, 5.0000000000000000, 3.7500000000000000 },
{ 0.15434254872599723, 5.0000000000000000, 4.0000000000000000 },
{ 0.10283347176876455, 5.0000000000000000, 4.2500000000000000 },
{ 0.069423643150881773, 5.0000000000000000, 4.5000000000000000 },
{ 0.047410616917942211, 5.0000000000000000, 4.7500000000000000 },
{ 0.032706273712031865, 5.0000000000000000, 5.0000000000000000 },
};
const double toler007 = 2.5000000000000020e-13;
// Test data for nu=10.000000000000000.
// max(|f - f_GSL|): 6.1035156250000000e-05
// max(|f - f_GSL| / |f_GSL|): 7.7998476565326393e-16
const testcase_cyl_bessel_k<double>
data008[20] =
{
{ 194481817927839.88, 10.000000000000000, 0.25000000000000000 },
{ 188937569319.90030, 10.000000000000000, 0.50000000000000000 },
{ 3248187687.8018155, 10.000000000000000, 0.75000000000000000 },
{ 180713289.90102941, 10.000000000000000, 1.0000000000000000 },
{ 19104425.945252180, 10.000000000000000, 1.2500000000000000 },
{ 3027483.5236822353, 10.000000000000000, 1.5000000000000000 },
{ 633724.71555087867, 10.000000000000000, 1.7500000000000000 },
{ 162482.40397955943, 10.000000000000000, 2.0000000000000000 },
{ 48602.446087749791, 10.000000000000000, 2.2500000000000000 },
{ 16406.916416341937, 10.000000000000000, 2.5000000000000000 },
{ 6104.1720745909606, 10.000000000000000, 2.7500000000000000 },
{ 2459.6204220569480, 10.000000000000000, 3.0000000000000000 },
{ 1059.2358443703381, 10.000000000000000, 3.2500000000000000 },
{ 482.53582096664758, 10.000000000000000, 3.5000000000000000 },
{ 230.64249314993776, 10.000000000000000, 3.7500000000000000 },
{ 114.91408364049620, 10.000000000000000, 4.0000000000000000 },
{ 59.361613632706479, 10.000000000000000, 4.2500000000000000 },
{ 31.652958759229868, 10.000000000000000, 4.5000000000000000 },
{ 17.357723966417399, 10.000000000000000, 4.7500000000000000 },
{ 9.7585628291778121, 10.000000000000000, 5.0000000000000000 },
};
const double toler008 = 2.5000000000000020e-13;
// Test data for nu=20.000000000000000.
// max(|f - f_GSL|): 2.7670116110564327e+19
// max(|f - f_GSL| / |f_GSL|): 1.2737005853777639e-15
const testcase_cyl_bessel_k<double>
data009[20] =
{
{ 7.0065983661641184e+34, 20.000000000000000, 0.25000000000000000 },
{ 6.6655498744171593e+28, 20.000000000000000, 0.50000000000000000 },
{ 1.9962989615380379e+25, 20.000000000000000, 0.75000000000000000 },
{ 6.2943693604245335e+22, 20.000000000000000, 1.0000000000000000 },
{ 7.2034511920074182e+20, 20.000000000000000, 1.2500000000000000 },
{ 1.8620549984645546e+19, 20.000000000000000, 1.5000000000000000 },
{ 8.4415605303952486e+17, 20.000000000000000, 1.7500000000000000 },
{ 57708568527002520., 20.000000000000000, 2.0000000000000000 },
{ 5396824209986879.0, 20.000000000000000, 2.2500000000000000 },
{ 645996884063683.62, 20.000000000000000, 2.5000000000000000 },
{ 94387401970996.328, 20.000000000000000, 2.7500000000000000 },
{ 16254643952204.371, 20.000000000000000, 3.0000000000000000 },
{ 3212694836166.4053, 20.000000000000000, 3.2500000000000000 },
{ 713857897923.74072, 20.000000000000000, 3.5000000000000000 },
{ 175423421958.35925, 20.000000000000000, 3.7500000000000000 },
{ 47050078926.298080, 20.000000000000000, 4.0000000000000000 },
{ 13625066095.067503, 20.000000000000000, 4.2500000000000000 },
{ 4222179870.6810656, 20.000000000000000, 4.5000000000000000 },
{ 1389634112.7516634, 20.000000000000000, 4.7500000000000000 },
{ 482700052.06214869, 20.000000000000000, 5.0000000000000000 },
};
const double toler009 = 2.5000000000000020e-13;
// Test data for nu=50.000000000000000.
// max(|f - f_GSL|): 3.9111090745622133e+92
// max(|f - f_GSL| / |f_GSL|): 3.7220730535457535e-15
const testcase_cyl_bessel_k<double>
data010[20] =
{
{ 4.3394604622138714e+107, 50.000000000000000, 0.25000000000000000 },
{ 3.8505298918269003e+92, 50.000000000000000, 0.50000000000000000 },
{ 6.0292756894842793e+83, 50.000000000000000, 0.75000000000000000 },
{ 3.4068968541616991e+77, 50.000000000000000, 1.0000000000000000 },
{ 4.8485527365039051e+72, 50.000000000000000, 1.2500000000000000 },
{ 5.3091717574907920e+68, 50.000000000000000, 1.5000000000000000 },
{ 2.3762245257445824e+65, 50.000000000000000, 1.7500000000000000 },
{ 2.9799817396049268e+62, 50.000000000000000, 2.0000000000000000 },
{ 8.2079431233488581e+59, 50.000000000000000, 2.2500000000000000 },
{ 4.2046528212987503e+57, 50.000000000000000, 2.5000000000000000 },
{ 3.5578676911884825e+55, 50.000000000000000, 2.7500000000000000 },
{ 4.5559542293221535e+53, 50.000000000000000, 3.0000000000000000 },
{ 8.2606735967628997e+51, 50.000000000000000, 3.2500000000000000 },
{ 2.0139406747903812e+50, 50.000000000000000, 3.5000000000000000 },
{ 6.3368727837484600e+48, 50.000000000000000, 3.7500000000000000 },
{ 2.4897317389325753e+47, 50.000000000000000, 4.0000000000000000 },
{ 1.1888958173039699e+46, 50.000000000000000, 4.2500000000000000 },
{ 6.7472593648148542e+44, 50.000000000000000, 4.5000000000000000 },
{ 4.4664266585930700e+43, 50.000000000000000, 4.7500000000000000 },
{ 3.3943222434301628e+42, 50.000000000000000, 5.0000000000000000 },
};
const double toler010 = 2.5000000000000020e-13;
// Test data for nu=100.00000000000000.
// max(|f - f_GSL|): 8.5970689361151757e+232
// max(|f - f_GSL| / |f_GSL|): 9.0457919481999128e-14
const testcase_cyl_bessel_k<double>
data011[20] =
{
{ 9.5039428115809898e+245, 100.00000000000000, 0.25000000000000000 },
{ 7.4937399313533112e+215, 100.00000000000000, 0.50000000000000000 },
{ 1.8417471020730701e+198, 100.00000000000000, 0.75000000000000000 },
{ 5.9003331836386410e+185, 100.00000000000000, 1.0000000000000000 },
{ 1.2002130935576950e+176, 100.00000000000000, 1.2500000000000000 },
{ 1.4467044226487075e+168, 100.00000000000000, 1.5000000000000000 },
{ 2.9161498411497642e+161, 100.00000000000000, 1.7500000000000000 },
{ 4.6194159776013925e+155, 100.00000000000000, 2.0000000000000000 },
{ 3.5332121583541727e+150, 100.00000000000000, 2.2500000000000000 },
{ 9.3566097231039940e+145, 100.00000000000000, 2.5000000000000000 },
{ 6.7672283615134532e+141, 100.00000000000000, 2.7500000000000000 },
{ 1.1219630864949494e+138, 100.00000000000000, 3.0000000000000000 },
{ 3.7329723699990903e+134, 100.00000000000000, 3.2500000000000000 },
{ 2.2476893883855163e+131, 100.00000000000000, 3.5000000000000000 },
{ 2.2564559319883196e+128, 100.00000000000000, 3.7500000000000000 },
{ 3.5353340499626455e+125, 100.00000000000000, 4.0000000000000000 },
{ 8.1898439213010234e+122, 100.00000000000000, 4.2500000000000000 },
{ 2.6823744110726800e+120, 100.00000000000000, 4.5000000000000000 },
{ 1.1963963615212274e+118, 100.00000000000000, 4.7500000000000000 },
{ 7.0398601930616815e+115, 100.00000000000000, 5.0000000000000000 },
};
const double toler011 = 5.0000000000000029e-12;
// cyl_bessel_k
// Test data for nu=0.0000000000000000.
// max(|f - f_GSL|): 4.3368086899420177e-19
// max(|f - f_GSL| / |f_GSL|): 1.8009631353873430e-16
const testcase_cyl_bessel_k<double>
data012[20] =
{
{ 0.0036910983340425947, 0.0000000000000000, 5.0000000000000000 },
{ 1.7780062316167650e-05, 0.0000000000000000, 10.000000000000000 },
{ 9.8195364823964333e-08, 0.0000000000000000, 15.000000000000000 },
{ 5.7412378153365238e-10, 0.0000000000000000, 20.000000000000000 },
{ 3.4641615622131151e-12, 0.0000000000000000, 25.000000000000000 },
{ 2.1324774964630566e-14, 0.0000000000000000, 30.000000000000000 },
{ 1.3310351491429464e-16, 0.0000000000000000, 35.000000000000000 },
{ 8.3928611000995700e-19, 0.0000000000000000, 40.000000000000000 },
{ 5.3334561226187247e-21, 0.0000000000000000, 45.000000000000000 },
{ 3.4101677497894956e-23, 0.0000000000000000, 50.000000000000000 },
{ 2.1913102183534147e-25, 0.0000000000000000, 55.000000000000000 },
{ 1.4138978405591074e-27, 0.0000000000000000, 60.000000000000000 },
{ 9.1544673210030045e-30, 0.0000000000000000, 65.000000000000000 },
{ 5.9446613372925013e-32, 0.0000000000000000, 70.000000000000000 },
{ 3.8701170455869113e-34, 0.0000000000000000, 75.000000000000000 },
{ 2.5251198425054723e-36, 0.0000000000000000, 80.000000000000000 },
{ 1.6507623579783908e-38, 0.0000000000000000, 85.000000000000000 },
{ 1.0810242556984256e-40, 0.0000000000000000, 90.000000000000000 },
{ 7.0901249699001278e-43, 0.0000000000000000, 95.000000000000000 },
{ 4.6566282291759032e-45, 0.0000000000000000, 100.00000000000000 },
};
const double toler012 = 2.5000000000000020e-13;
// Test data for nu=0.33333333333333331.
// max(|f - f_GSL|): 1.0339757656912846e-25
// max(|f - f_GSL| / |f_GSL|): 1.7960859646361972e-16
const testcase_cyl_bessel_k<double>
data013[20] =
{
{ 0.0037288750960535887, 0.33333333333333331, 5.0000000000000000 },
{ 1.7874608271055339e-05, 0.33333333333333331, 10.000000000000000 },
{ 9.8548341568798317e-08, 0.33333333333333331, 15.000000000000000 },
{ 5.7568278247790865e-10, 0.33333333333333331, 20.000000000000000 },
{ 3.4717201424907059e-12, 0.33333333333333331, 25.000000000000000 },
{ 2.1363664736611189e-14, 0.33333333333333331, 30.000000000000000 },
{ 1.3331202314165813e-16, 0.33333333333333331, 35.000000000000000 },
{ 8.4043837769480934e-19, 0.33333333333333331, 40.000000000000000 },
{ 5.3399731261024948e-21, 0.33333333333333331, 45.000000000000000 },
{ 3.4139217813583632e-23, 0.33333333333333331, 50.000000000000000 },
{ 2.1935050179185627e-25, 0.33333333333333331, 55.000000000000000 },
{ 1.4151968805623662e-27, 0.33333333333333331, 60.000000000000000 },
{ 9.1622357217019043e-30, 0.33333333333333331, 65.000000000000000 },
{ 5.9493479703461315e-32, 0.33333333333333331, 70.000000000000000 },
{ 3.8729660011055947e-34, 0.33333333333333331, 75.000000000000000 },
{ 2.5268631828013877e-36, 0.33333333333333331, 80.000000000000000 },
{ 1.6518353676138867e-38, 0.33333333333333331, 85.000000000000000 },
{ 1.0816880942511494e-40, 0.33333333333333331, 90.000000000000000 },
{ 7.0942508599231512e-43, 0.33333333333333331, 95.000000000000000 },
{ 4.6592031570213454e-45, 0.33333333333333331, 100.00000000000000 },
};
const double toler013 = 2.5000000000000020e-13;
// Test data for nu=0.50000000000000000.
// max(|f - f_GSL|): 1.5046327690525280e-36
// max(|f - f_GSL| / |f_GSL|): 0.0000000000000000
const testcase_cyl_bessel_k<double>
data014[20] =
{
{ 0.0037766133746428825, 0.50000000000000000, 5.0000000000000000 },
{ 1.7993478093705181e-05, 0.50000000000000000, 10.000000000000000 },
{ 9.8991312032877236e-08, 0.50000000000000000, 15.000000000000000 },
{ 5.7763739747074450e-10, 0.50000000000000000, 20.000000000000000 },
{ 3.4811912768406949e-12, 0.50000000000000000, 25.000000000000000 },
{ 2.1412375659560111e-14, 0.50000000000000000, 30.000000000000000 },
{ 1.3357311366035824e-16, 0.50000000000000000, 35.000000000000000 },
{ 8.4188091949489049e-19, 0.50000000000000000, 40.000000000000000 },
{ 5.3481305002517408e-21, 0.50000000000000000, 45.000000000000000 },
{ 3.4186200954570754e-23, 0.50000000000000000, 50.000000000000000 },
{ 2.1962515908772453e-25, 0.50000000000000000, 55.000000000000000 },
{ 1.4168223500353693e-27, 0.50000000000000000, 60.000000000000000 },
{ 9.1719554473256892e-30, 0.50000000000000000, 65.000000000000000 },
{ 5.9552114337788932e-32, 0.50000000000000000, 70.000000000000000 },
{ 3.8765301321409432e-34, 0.50000000000000000, 75.000000000000000 },
{ 2.5290440439442910e-36, 0.50000000000000000, 80.000000000000000 },
{ 1.6531776067605980e-38, 0.50000000000000000, 85.000000000000000 },
{ 1.0825184636529955e-40, 0.50000000000000000, 90.000000000000000 },
{ 7.0994115873258822e-43, 0.50000000000000000, 95.000000000000000 },
{ 4.6624238126346715e-45, 0.50000000000000000, 100.00000000000000 },
};
const double toler014 = 2.5000000000000020e-13;
// Test data for nu=0.66666666666666663.
// max(|f - f_GSL|): 4.3368086899420177e-19
// max(|f - f_GSL| / |f_GSL|): 3.5630695000470094e-16
const testcase_cyl_bessel_k<double>
data015[20] =
{
{ 0.0038444246344968226, 0.66666666666666663, 5.0000000000000000 },
{ 1.8161187569530204e-05, 0.66666666666666663, 10.000000000000000 },
{ 9.9614751542305571e-08, 0.66666666666666663, 15.000000000000000 },
{ 5.8038484271925811e-10, 0.66666666666666663, 20.000000000000000 },
{ 3.4944937498488603e-12, 0.66666666666666663, 25.000000000000000 },
{ 2.1480755645577720e-14, 0.66666666666666663, 30.000000000000000 },
{ 1.3393949190152161e-16, 0.66666666666666663, 35.000000000000000 },
{ 8.4390460553642992e-19, 0.66666666666666663, 40.000000000000000 },
{ 5.3595716143622089e-21, 0.66666666666666663, 45.000000000000000 },
{ 3.4252085301433749e-23, 0.66666666666666663, 50.000000000000000 },
{ 2.2001025377982308e-25, 0.66666666666666663, 55.000000000000000 },
{ 1.4191011274172078e-27, 0.66666666666666663, 60.000000000000000 },
{ 9.1855803020269763e-30, 0.66666666666666663, 65.000000000000000 },
{ 5.9634299472578764e-32, 0.66666666666666663, 70.000000000000000 },
{ 3.8815254026478500e-34, 0.66666666666666663, 75.000000000000000 },
{ 2.5321003991943851e-36, 0.66666666666666663, 80.000000000000000 },
{ 1.6550585670593067e-38, 0.66666666666666663, 85.000000000000000 },
{ 1.0836820479428605e-40, 0.66666666666666663, 90.000000000000000 },
{ 7.1066428916285356e-43, 0.66666666666666663, 95.000000000000000 },
{ 4.6669364587280465e-45, 0.66666666666666663, 100.00000000000000 },
};
const double toler015 = 2.5000000000000020e-13;
// Test data for nu=1.0000000000000000.
// max(|f - f_GSL|): 1.0339757656912846e-25
// max(|f - f_GSL| / |f_GSL|): 2.9112857291682056e-16
const testcase_cyl_bessel_k<double>
data016[20] =
{
{ 0.0040446134454521655, 1.0000000000000000, 5.0000000000000000 },
{ 1.8648773453825582e-05, 1.0000000000000000, 10.000000000000000 },
{ 1.0141729369762091e-07, 1.0000000000000000, 15.000000000000000 },
{ 5.8830579695570384e-10, 1.0000000000000000, 20.000000000000000 },
{ 3.5327780731999345e-12, 1.0000000000000000, 25.000000000000000 },
{ 2.1677320018915498e-14, 1.0000000000000000, 30.000000000000000 },
{ 1.3499178340011053e-16, 1.0000000000000000, 35.000000000000000 },
{ 8.4971319548610435e-19, 1.0000000000000000, 40.000000000000000 },
{ 5.3923945937225035e-21, 1.0000000000000000, 45.000000000000000 },
{ 3.4441022267175555e-23, 1.0000000000000000, 50.000000000000000 },
{ 2.2111422716117463e-25, 1.0000000000000000, 55.000000000000000 },
{ 1.4256320265171041e-27, 1.0000000000000000, 60.000000000000000 },
{ 9.2246195278906156e-30, 1.0000000000000000, 65.000000000000000 },
{ 5.9869736739138550e-32, 1.0000000000000000, 70.000000000000000 },
{ 3.8958329467421912e-34, 1.0000000000000000, 75.000000000000000 },
{ 2.5408531275211708e-36, 1.0000000000000000, 80.000000000000000 },
{ 1.6604444948567571e-38, 1.0000000000000000, 85.000000000000000 },
{ 1.0870134457498335e-40, 1.0000000000000000, 90.000000000000000 },
{ 7.1273442329907240e-43, 1.0000000000000000, 95.000000000000000 },
{ 4.6798537356369101e-45, 1.0000000000000000, 100.00000000000000 },
};
const double toler016 = 2.5000000000000020e-13;
// Test data for nu=2.0000000000000000.
// max(|f - f_GSL|): 8.6736173798840355e-19
// max(|f - f_GSL| / |f_GSL|): 1.6337745981208381e-16
const testcase_cyl_bessel_k<double>
data017[20] =
{
{ 0.0053089437122234608, 2.0000000000000000, 5.0000000000000000 },
{ 2.1509817006932767e-05, 2.0000000000000000, 10.000000000000000 },
{ 1.1171767065031378e-07, 2.0000000000000000, 15.000000000000000 },
{ 6.3295436122922281e-10, 2.0000000000000000, 20.000000000000000 },
{ 3.7467838080691102e-12, 2.0000000000000000, 25.000000000000000 },
{ 2.2769929632558265e-14, 2.0000000000000000, 30.000000000000000 },
{ 1.4081733110858665e-16, 2.0000000000000000, 35.000000000000000 },
{ 8.8177176978426223e-19, 2.0000000000000000, 40.000000000000000 },
{ 5.5731181045619470e-21, 2.0000000000000000, 45.000000000000000 },
{ 3.5479318388581979e-23, 2.0000000000000000, 50.000000000000000 },
{ 2.2717153918665688e-25, 2.0000000000000000, 55.000000000000000 },
{ 1.4614189081096777e-27, 2.0000000000000000, 60.000000000000000 },
{ 9.4383017680150234e-30, 2.0000000000000000, 65.000000000000000 },
{ 6.1157177279757537e-32, 2.0000000000000000, 70.000000000000000 },
{ 3.9740059241667034e-34, 2.0000000000000000, 75.000000000000000 },
{ 2.5886411706935015e-36, 2.0000000000000000, 80.000000000000000 },
{ 1.6898316402103142e-38, 2.0000000000000000, 85.000000000000000 },
{ 1.1051801100484218e-40, 2.0000000000000000, 90.000000000000000 },
{ 7.2401743221736176e-43, 2.0000000000000000, 95.000000000000000 },
{ 4.7502253038886413e-45, 2.0000000000000000, 100.00000000000000 },
};
const double toler017 = 2.5000000000000020e-13;
// Test data for nu=5.0000000000000000.
// max(|f - f_GSL|): 6.9388939039072284e-18
// max(|f - f_GSL| / |f_GSL|): 2.3552470349020973e-16
const testcase_cyl_bessel_k<double>
data018[20] =
{
{ 0.032706273712031865, 5.0000000000000000, 5.0000000000000000 },
{ 5.7541849985312288e-05, 5.0000000000000000, 10.000000000000000 },
{ 2.1878261369258224e-07, 5.0000000000000000, 15.000000000000000 },
{ 1.0538660139974233e-09, 5.0000000000000000, 20.000000000000000 },
{ 5.6485921365284157e-12, 5.0000000000000000, 25.000000000000000 },
{ 3.2103335105890266e-14, 5.0000000000000000, 30.000000000000000 },
{ 1.8919208406439644e-16, 5.0000000000000000, 35.000000000000000 },
{ 1.1423814375953188e-18, 5.0000000000000000, 40.000000000000000 },
{ 7.0181216822204101e-21, 5.0000000000000000, 45.000000000000000 },
{ 4.3671822541009859e-23, 5.0000000000000000, 50.000000000000000 },
{ 2.7444967640357869e-25, 5.0000000000000000, 55.000000000000000 },
{ 1.7382232741886986e-27, 5.0000000000000000, 60.000000000000000 },
{ 1.1078474298959669e-29, 5.0000000000000000, 65.000000000000000 },
{ 7.0974537081794416e-32, 5.0000000000000000, 70.000000000000000 },
{ 4.5667269500061064e-34, 5.0000000000000000, 75.000000000000000 },
{ 2.9491764420206150e-36, 5.0000000000000000, 80.000000000000000 },
{ 1.9105685973117463e-38, 5.0000000000000000, 85.000000000000000 },
{ 1.2411034311592645e-40, 5.0000000000000000, 90.000000000000000 },
{ 8.0814211331379146e-43, 5.0000000000000000, 95.000000000000000 },
{ 5.2732561132929509e-45, 5.0000000000000000, 100.00000000000000 },
};
const double toler018 = 2.5000000000000020e-13;
// Test data for nu=10.000000000000000.
// max(|f - f_GSL|): 5.3290705182007514e-15
// max(|f - f_GSL| / |f_GSL|): 5.4609173619982130e-16
const testcase_cyl_bessel_k<double>
data019[20] =
{
{ 9.7585628291778121, 10.000000000000000, 5.0000000000000000 },
{ 0.0016142553003906700, 10.000000000000000, 10.000000000000000 },
{ 2.2605303776606435e-06, 10.000000000000000, 15.000000000000000 },
{ 6.3162145283215804e-09, 10.000000000000000, 20.000000000000000 },
{ 2.4076769602801233e-11, 10.000000000000000, 25.000000000000000 },
{ 1.0842816942222975e-13, 10.000000000000000, 30.000000000000000 },
{ 5.3976770429777191e-16, 10.000000000000000, 35.000000000000000 },
{ 2.8680293113671932e-18, 10.000000000000000, 40.000000000000000 },
{ 1.5939871900169600e-20, 10.000000000000000, 45.000000000000000 },
{ 9.1509882099879962e-23, 10.000000000000000, 50.000000000000000 },
{ 5.3823846249592858e-25, 10.000000000000000, 55.000000000000000 },
{ 3.2253408700563144e-27, 10.000000000000000, 60.000000000000000 },
{ 1.9613367530075138e-29, 10.000000000000000, 65.000000000000000 },
{ 1.2068471495933484e-31, 10.000000000000000, 70.000000000000000 },
{ 7.4979152649449644e-34, 10.000000000000000, 75.000000000000000 },
{ 4.6957285830490538e-36, 10.000000000000000, 80.000000000000000 },
{ 2.9606323347034079e-38, 10.000000000000000, 85.000000000000000 },
{ 1.8773542561131613e-40, 10.000000000000000, 90.000000000000000 },
{ 1.1962899527846350e-42, 10.000000000000000, 95.000000000000000 },
{ 7.6554279773881018e-45, 10.000000000000000, 100.00000000000000 },
};
const double toler019 = 2.5000000000000020e-13;
// Test data for nu=20.000000000000000.
// max(|f - f_GSL|): 4.1723251342773438e-07
// max(|f - f_GSL| / |f_GSL|): 1.2224656515794909e-15
const testcase_cyl_bessel_k<double>
data020[20] =
{
{ 482700052.06214869, 20.000000000000000, 5.0000000000000000 },
{ 178.74427820770546, 20.000000000000000, 10.000000000000000 },
{ 0.012141257729731143, 20.000000000000000, 15.000000000000000 },
{ 5.5431116361258155e-06, 20.000000000000000, 20.000000000000000 },
{ 6.3744029330352113e-09, 20.000000000000000, 25.000000000000000 },
{ 1.2304516475442478e-11, 20.000000000000000, 30.000000000000000 },
{ 3.2673136479809018e-14, 20.000000000000000, 35.000000000000000 },
{ 1.0703023799997383e-16, 20.000000000000000, 40.000000000000000 },
{ 4.0549953175660457e-19, 20.000000000000000, 45.000000000000000 },
{ 1.7061483797220349e-21, 20.000000000000000, 50.000000000000000 },
{ 7.7617008115659413e-24, 20.000000000000000, 55.000000000000000 },
{ 3.7482954006874720e-26, 20.000000000000000, 60.000000000000000 },
{ 1.8966880763956576e-28, 20.000000000000000, 65.000000000000000 },
{ 9.9615763479998864e-31, 20.000000000000000, 70.000000000000000 },
{ 5.3921623063091066e-33, 20.000000000000000, 75.000000000000000 },
{ 2.9920407657642272e-35, 20.000000000000000, 80.000000000000000 },
{ 1.6948662723618255e-37, 20.000000000000000, 85.000000000000000 },
{ 9.7689149642963042e-40, 20.000000000000000, 90.000000000000000 },
{ 5.7143603019220823e-42, 20.000000000000000, 95.000000000000000 },
{ 3.3852054148901700e-44, 20.000000000000000, 100.00000000000000 },
};
const double toler020 = 2.5000000000000020e-13;
// Test data for nu=50.000000000000000.
// max(|f - f_GSL|): 8.6655802749976619e+27
// max(|f - f_GSL| / |f_GSL|): 2.6684549464729312e-15
const testcase_cyl_bessel_k<double>
data021[20] =
{
{ 3.3943222434301628e+42, 50.000000000000000, 5.0000000000000000 },
{ 2.0613737753892557e+27, 50.000000000000000, 10.000000000000000 },
{ 1.7267736974519188e+18, 50.000000000000000, 15.000000000000000 },
{ 411711209122.01788, 50.000000000000000, 20.000000000000000 },
{ 1972478.7419813874, 50.000000000000000, 25.000000000000000 },
{ 58.770686258007267, 50.000000000000000, 30.000000000000000 },
{ 0.0058659391182535178, 50.000000000000000, 35.000000000000000 },
{ 1.3634854128794101e-06, 50.000000000000000, 40.000000000000000 },
{ 5.8652396362160819e-10, 50.000000000000000, 45.000000000000000 },
{ 4.0060134766400893e-13, 50.000000000000000, 50.000000000000000 },
{ 3.9062324485711016e-16, 50.000000000000000, 55.000000000000000 },
{ 5.0389298085176510e-19, 50.000000000000000, 60.000000000000000 },
{ 8.1305344250110424e-22, 50.000000000000000, 65.000000000000000 },
{ 1.5732816234948991e-24, 50.000000000000000, 70.000000000000000 },
{ 3.5349854993874412e-27, 50.000000000000000, 75.000000000000000 },
{ 8.9940101003189485e-30, 50.000000000000000, 80.000000000000000 },
{ 2.5403205503080723e-32, 50.000000000000000, 85.000000000000000 },
{ 7.8397596486715721e-35, 50.000000000000000, 90.000000000000000 },
{ 2.6098900651329542e-37, 50.000000000000000, 95.000000000000000 },
{ 9.2745226536133258e-40, 50.000000000000000, 100.00000000000000 },
};
const double toler021 = 2.5000000000000020e-13;
// Test data for nu=100.00000000000000.
// max(|f - f_GSL|): 3.4996011596528191e+101
// max(|f - f_GSL| / |f_GSL|): 4.9711230957426436e-15
const testcase_cyl_bessel_k<double>
data022[20] =
{
{ 7.0398601930616815e+115, 100.00000000000000, 5.0000000000000000 },
{ 4.5966740842695238e+85, 100.00000000000000, 10.000000000000000 },
{ 8.2565552242653946e+67, 100.00000000000000, 15.000000000000000 },
{ 1.7081356456876041e+55, 100.00000000000000, 20.000000000000000 },
{ 1.9858028128780610e+45, 100.00000000000000, 25.000000000000000 },
{ 1.2131584253026677e+37, 100.00000000000000, 30.000000000000000 },
{ 1.1016916354696688e+30, 100.00000000000000, 35.000000000000000 },
{ 7.0074023297775712e+23, 100.00000000000000, 40.000000000000000 },
{ 1.9236643958470894e+18, 100.00000000000000, 45.000000000000000 },
{ 16394035276269.250, 100.00000000000000, 50.000000000000000 },
{ 343254952.89495474, 100.00000000000000, 55.000000000000000 },
{ 14870.012754946298, 100.00000000000000, 60.000000000000000 },
{ 1.1708099078572216, 100.00000000000000, 65.000000000000000 },
{ 0.00015161193930722313, 100.00000000000000, 70.000000000000000 },
{ 2.9850234381623443e-08, 100.00000000000000, 75.000000000000000 },
{ 8.3928710724649129e-12, 100.00000000000000, 80.000000000000000 },
{ 3.2033435630927732e-15, 100.00000000000000, 85.000000000000000 },
{ 1.5922281431788096e-18, 100.00000000000000, 90.000000000000000 },
{ 9.9589454577674131e-22, 100.00000000000000, 95.000000000000000 },
{ 7.6171296304940840e-25, 100.00000000000000, 100.00000000000000 },
};
const double toler022 = 2.5000000000000020e-13;
template<typename Tp, unsigned int Num>
void
test(const testcase_cyl_bessel_k<Tp> (&data)[Num], Tp toler)
{
bool test __attribute__((unused)) = true;
const Tp eps = std::numeric_limits<Tp>::epsilon();
Tp max_abs_diff = -Tp(1);
Tp max_abs_frac = -Tp(1);
unsigned int num_datum = Num;
for (unsigned int i = 0; i < num_datum; ++i)
{
const Tp f = std::cyl_bessel_k(data[i].nu, data[i].x);
const Tp f0 = data[i].f0;
const Tp diff = f - f0;
if (std::abs(diff) > max_abs_diff)
max_abs_diff = std::abs(diff);
if (std::abs(f0) > Tp(10) * eps
&& std::abs(f) > Tp(10) * eps)
{
const Tp frac = diff / f0;
if (std::abs(frac) > max_abs_frac)
max_abs_frac = std::abs(frac);
}
}
VERIFY(max_abs_frac < toler);
}
int
main()
{
test(data001, toler001);
test(data002, toler002);
test(data003, toler003);
test(data004, toler004);
test(data005, toler005);
test(data006, toler006);
test(data007, toler007);
test(data008, toler008);
test(data009, toler009);
test(data010, toler010);
test(data011, toler011);
test(data012, toler012);
test(data013, toler013);
test(data014, toler014);
test(data015, toler015);
test(data016, toler016);
test(data017, toler017);
test(data018, toler018);
test(data019, toler019);
test(data020, toler020);
test(data021, toler021);
test(data022, toler022);
return 0;
}

View File

@ -0,0 +1,40 @@
// { dg-do compile }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.9 cyl_bessel_k
#include <cmath>
void
test01()
{
float nuf = 1.0F / 3.0F, xf = 0.5F;
double nud = 1.0 / 3.0, xd = 0.5;
long double nul = 1.0L / 3.0L, xl = 0.5L;
std::cyl_bessel_k(nuf, xf);
std::cyl_bessel_kf(nuf, xf);
std::cyl_bessel_k(nud, xd);
std::cyl_bessel_k(nul, xl);
std::cyl_bessel_kl(nul, xl);
return;
}

View File

@ -0,0 +1,41 @@
// { dg-do compile { xfail *-*-* } }
// { dg-excess-errors "" }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.9 cyl_bessel_k
#include <math.h>
void
test01()
{
float nuf = 1.0F / 3.0F, xf = 0.5F;
double nud = 1.0 / 3.0, xd = 0.5;
long double nul = 1.0L / 3.0L, xl = 0.5L;
cyl_bessel_k(nuf, xf);
cyl_bessel_kf(nuf, xf);
cyl_bessel_k(nud, xd);
cyl_bessel_k(nul, xl);
cyl_bessel_kl(nul, xl);
return;
}

View File

@ -0,0 +1,88 @@
// { dg-require-c-std "" }
// { dg-add-options ieee }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.10 cyl_neumann
#include <cmath>
#include <testsuite_hooks.h>
void
test01()
{
float xf = std::numeric_limits<float>::quiet_NaN();
double xd = std::numeric_limits<double>::quiet_NaN();
long double xl = std::numeric_limits<long double>::quiet_NaN();
float nuf = 0.0F;
double nud = 0.0;
long double nul = 0.0L;
float a = std::cyl_neumann(nuf, xf);
float b = std::cyl_neumannf(nuf, xf);
double c = std::cyl_neumann(nud, xd);
long double d = std::cyl_neumann(nul, xl);
long double e = std::cyl_neumannl(nul, xl);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
void
test02()
{
float xf = 1.0F;
double xd = 1.0;
long double xl = 1.0L;
float nuf = std::numeric_limits<float>::quiet_NaN();
double nud = std::numeric_limits<double>::quiet_NaN();
long double nul = std::numeric_limits<long double>::quiet_NaN();
float a = std::cyl_neumann(nuf, xf);
float b = std::cyl_neumannf(nuf, xf);
double c = std::cyl_neumann(nud, xd);
long double d = std::cyl_neumann(nul, xl);
long double e = std::cyl_neumannl(nul, xl);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
int
main()
{
test01();
test02();
return 0;
}

View File

@ -0,0 +1,718 @@
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
//
// Copyright (C) 2016 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/>.
// cyl_neumann
// Compare against values generated by the GNU Scientific Library.
// The GSL can be found on the web: http://www.gnu.org/software/gsl/
#include <limits>
#include <cmath>
#if defined(__TEST_DEBUG)
# include <iostream>
# define VERIFY(A) \
if (!(A)) \
{ \
std::cout << "line " << __LINE__ \
<< " max_abs_frac = " << max_abs_frac \
<< std::endl; \
}
#else
# include <testsuite_hooks.h>
#endif
#include <specfun_testcase.h>
// Test data for nu=0.0000000000000000.
// max(|f - f_GSL|): 1.6653345369377348e-16
// max(|f - f_GSL| / |f_GSL|): 2.6623873675138176e-15
const testcase_cyl_neumann<double>
data001[20] =
{
{ -0.93157302493005878, 0.0000000000000000, 0.25000000000000000 },
{ -0.44451873350670656, 0.0000000000000000, 0.50000000000000000 },
{ -0.13717276938577236, 0.0000000000000000, 0.75000000000000000 },
{ 0.088256964215676942, 0.0000000000000000, 1.0000000000000000 },
{ 0.25821685159454072, 0.0000000000000000, 1.2500000000000000 },
{ 0.38244892379775886, 0.0000000000000000, 1.5000000000000000 },
{ 0.46549262864690610, 0.0000000000000000, 1.7500000000000000 },
{ 0.51037567264974493, 0.0000000000000000, 2.0000000000000000 },
{ 0.52006476245727862, 0.0000000000000000, 2.2500000000000000 },
{ 0.49807035961523194, 0.0000000000000000, 2.5000000000000000 },
{ 0.44865872156913222, 0.0000000000000000, 2.7500000000000000 },
{ 0.37685001001279045, 0.0000000000000000, 3.0000000000000000 },
{ 0.28828690267308710, 0.0000000000000000, 3.2500000000000000 },
{ 0.18902194392082688, 0.0000000000000000, 3.5000000000000000 },
{ 0.085256756977362638, 0.0000000000000000, 3.7500000000000000 },
{ -0.016940739325064763, 0.0000000000000000, 4.0000000000000000 },
{ -0.11191885116160770, 0.0000000000000000, 4.2500000000000000 },
{ -0.19470500862950454, 0.0000000000000000, 4.5000000000000000 },
{ -0.26123250323497549, 0.0000000000000000, 4.7500000000000000 },
{ -0.30851762524903359, 0.0000000000000000, 5.0000000000000000 },
};
const double toler001 = 2.5000000000000020e-13;
// Test data for nu=0.33333333333333331.
// max(|f - f_GSL|): 5.8286708792820718e-16
// max(|f - f_GSL| / |f_GSL|): 1.7769445360534625e-14
const testcase_cyl_neumann<double>
data002[20] =
{
{ -1.3461842332051077, 0.33333333333333331, 0.25000000000000000 },
{ -0.84062782604337771, 0.33333333333333331, 0.50000000000000000 },
{ -0.52488281484097077, 0.33333333333333331, 0.75000000000000000 },
{ -0.27880164127599205, 0.33333333333333331, 1.0000000000000000 },
{ -0.074321349727836453, 0.33333333333333331, 1.2500000000000000 },
{ 0.096610087766627981, 0.33333333333333331, 1.5000000000000000 },
{ 0.23582564494922068, 0.33333333333333331, 1.7500000000000000 },
{ 0.34319996626034494, 0.33333333333333331, 2.0000000000000000 },
{ 0.41835668452349323, 0.33333333333333331, 2.2500000000000000 },
{ 0.46145947419129157, 0.33333333333333331, 2.5000000000000000 },
{ 0.47358926135786023, 0.33333333333333331, 2.7500000000000000 },
{ 0.45689303457230640, 0.33333333333333331, 3.0000000000000000 },
{ 0.41458485697347386, 0.33333333333333331, 3.2500000000000000 },
{ 0.35084133277859947, 0.33333333333333331, 3.5000000000000000 },
{ 0.27061914527820891, 0.33333333333333331, 3.7500000000000000 },
{ 0.17941676634394862, 0.33333333333333331, 4.0000000000000000 },
{ 0.083000434191526043, 0.33333333333333331, 4.2500000000000000 },
{ -0.012886361627105348, 0.33333333333333331, 4.5000000000000000 },
{ -0.10281143123935124, 0.33333333333333331, 4.7500000000000000 },
{ -0.18192321129343850, 0.33333333333333331, 5.0000000000000000 },
};
const double toler002 = 1.0000000000000008e-12;
// Test data for nu=0.50000000000000000.
// max(|f - f_GSL|): 4.4408920985006262e-16
// max(|f - f_GSL| / |f_GSL|): 5.7217850214577088e-15
const testcase_cyl_neumann<double>
data003[20] =
{
{ -1.5461605241060765, 0.50000000000000000, 0.25000000000000000 },
{ -0.99024588024340454, 0.50000000000000000, 0.50000000000000000 },
{ -0.67411792914454460, 0.50000000000000000, 0.75000000000000000 },
{ -0.43109886801837594, 0.50000000000000000, 1.0000000000000000 },
{ -0.22502969244466481, 0.50000000000000000, 1.2500000000000000 },
{ -0.046083165893097265, 0.50000000000000000, 1.5000000000000000 },
{ 0.10750804524368722, 0.50000000000000000, 1.7500000000000000 },
{ 0.23478571040624849, 0.50000000000000000, 2.0000000000000000 },
{ 0.33414002338271825, 0.50000000000000000, 2.2500000000000000 },
{ 0.40427830223905686, 0.50000000000000000, 2.5000000000000000 },
{ 0.44472115119490507, 0.50000000000000000, 2.7500000000000000 },
{ 0.45604882079463316, 0.50000000000000000, 3.0000000000000000 },
{ 0.43998859501924370, 0.50000000000000000, 3.2500000000000000 },
{ 0.39938682536304909, 0.50000000000000000, 3.5000000000000000 },
{ 0.33809163836693340, 0.50000000000000000, 3.7500000000000000 },
{ 0.26076607667717877, 0.50000000000000000, 4.0000000000000000 },
{ 0.17264962544644955, 0.50000000000000000, 4.2500000000000000 },
{ 0.079285862862978548, 0.50000000000000000, 4.5000000000000000 },
{ -0.013765943019498003, 0.50000000000000000, 4.7500000000000000 },
{ -0.10121770918510846, 0.50000000000000000, 5.0000000000000000 },
};
const double toler003 = 5.0000000000000039e-13;
// Test data for nu=0.66666666666666663.
// max(|f - f_GSL|): 1.4988010832439613e-15
// max(|f - f_GSL| / |f_GSL|): 6.3663053018318525e-15
const testcase_cyl_neumann<double>
data004[20] =
{
{ -1.8021638417426857, 0.66666666666666663, 0.25000000000000000 },
{ -1.1316060101031435, 0.66666666666666663, 0.50000000000000000 },
{ -0.80251156358450737, 0.66666666666666663, 0.75000000000000000 },
{ -0.56270321497463327, 0.66666666666666663, 1.0000000000000000 },
{ -0.36007453643432208, 0.66666666666666663, 1.2500000000000000 },
{ -0.18017937469615020, 0.66666666666666663, 1.5000000000000000 },
{ -0.019885608758103752, 0.66666666666666663, 1.7500000000000000 },
{ 0.11989345361903521, 0.66666666666666663, 2.0000000000000000 },
{ 0.23690889836358039, 0.66666666666666663, 2.2500000000000000 },
{ 0.32882045742954535, 0.66666666666666663, 2.5000000000000000 },
{ 0.39385133784531856, 0.66666666666666663, 2.7500000000000000 },
{ 0.43115101690935642, 0.66666666666666663, 3.0000000000000000 },
{ 0.44098127351445843, 0.66666666666666663, 3.2500000000000000 },
{ 0.42477631413456485, 0.66666666666666663, 3.5000000000000000 },
{ 0.38510384155620386, 0.66666666666666663, 3.7500000000000000 },
{ 0.32554526794354366, 0.66666666666666663, 4.0000000000000000 },
{ 0.25051080073878446, 0.66666666666666663, 4.2500000000000000 },
{ 0.16500507211842136, 0.66666666666666663, 4.5000000000000000 },
{ 0.074359649728861360, 0.66666666666666663, 4.7500000000000000 },
{ -0.016050662643389627, 0.66666666666666663, 5.0000000000000000 },
};
const double toler004 = 5.0000000000000039e-13;
// Test data for nu=1.0000000000000000.
// max(|f - f_GSL|): 9.1593399531575415e-16
// max(|f - f_GSL| / |f_GSL|): 3.3683879467319323e-14
const testcase_cyl_neumann<double>
data005[13] =
{
{ -0.10703243154093699, 1.0000000000000000, 2.0000000000000000 },
{ 0.027192057738017056, 1.0000000000000000, 2.2500000000000000 },
{ 0.14591813796678599, 1.0000000000000000, 2.5000000000000000 },
{ 0.24601900149738354, 1.0000000000000000, 2.7500000000000000 },
{ 0.32467442479180003, 1.0000000000000000, 3.0000000000000000 },
{ 0.37977777371708382, 1.0000000000000000, 3.2500000000000000 },
{ 0.41018841788751170, 1.0000000000000000, 3.5000000000000000 },
{ 0.41586877934522715, 1.0000000000000000, 3.7500000000000000 },
{ 0.39792571055709991, 1.0000000000000000, 4.0000000000000000 },
{ 0.35856889308385076, 1.0000000000000000, 4.2500000000000000 },
{ 0.30099732306965449, 1.0000000000000000, 4.5000000000000000 },
{ 0.22922559673872217, 1.0000000000000000, 4.7500000000000000 },
{ 0.14786314339122700, 1.0000000000000000, 5.0000000000000000 },
};
const double toler005 = 2.5000000000000015e-12;
// Test data for nu=2.0000000000000000.
// max(|f - f_GSL|): 6.1062266354383610e-16
// max(|f - f_GSL| / |f_GSL|): 1.2540693630135021e-14
const testcase_cyl_neumann<double>
data006[20] =
{
{ -20.701268809592200, 2.0000000000000000, 0.25000000000000000 },
{ -5.4413708371742668, 2.0000000000000000, 0.50000000000000000 },
{ -2.6297460326656559, 2.0000000000000000, 0.75000000000000000 },
{ -1.6506826068162548, 2.0000000000000000, 1.0000000000000000 },
{ -1.1931993101785539, 2.0000000000000000, 1.2500000000000000 },
{ -0.93219375976297369, 2.0000000000000000, 1.5000000000000000 },
{ -0.75574746972832973, 2.0000000000000000, 1.7500000000000000 },
{ -0.61740810419068193, 2.0000000000000000, 2.0000000000000000 },
{ -0.49589404446793012, 2.0000000000000000, 2.2500000000000000 },
{ -0.38133584924180314, 2.0000000000000000, 2.5000000000000000 },
{ -0.26973581138921693, 2.0000000000000000, 2.7500000000000000 },
{ -0.16040039348492377, 2.0000000000000000, 3.0000000000000000 },
{ -0.054577503462573951, 2.0000000000000000, 3.2500000000000000 },
{ 0.045371437729179787, 2.0000000000000000, 3.5000000000000000 },
{ 0.13653992534009185, 2.0000000000000000, 3.7500000000000000 },
{ 0.21590359460361472, 2.0000000000000000, 4.0000000000000000 },
{ 0.28065715378930217, 2.0000000000000000, 4.2500000000000000 },
{ 0.32848159666046206, 2.0000000000000000, 4.5000000000000000 },
{ 0.35774854396706901, 2.0000000000000000, 4.7500000000000000 },
{ 0.36766288260552438, 2.0000000000000000, 5.0000000000000000 },
};
const double toler006 = 1.0000000000000008e-12;
// Test data for nu=5.0000000000000000.
// max(|f - f_GSL|): 8.8817841970012523e-15
// max(|f - f_GSL| / |f_GSL|): 1.6846903979704834e-15
const testcase_cyl_neumann<double>
data007[13] =
{
{ -9.9359891284819675, 5.0000000000000000, 2.0000000000000000 },
{ -5.9446343848076424, 5.0000000000000000, 2.2500000000000000 },
{ -3.8301760007407522, 5.0000000000000000, 2.5000000000000000 },
{ -2.6287042009459087, 5.0000000000000000, 2.7500000000000000 },
{ -1.9059459538286738, 5.0000000000000000, 3.0000000000000000 },
{ -1.4498157389142654, 5.0000000000000000, 3.2500000000000000 },
{ -1.1494603169763686, 5.0000000000000000, 3.5000000000000000 },
{ -0.94343105151431672, 5.0000000000000000, 3.7500000000000000 },
{ -0.79585142111419982, 5.0000000000000000, 4.0000000000000000 },
{ -0.68479288173907016, 5.0000000000000000, 4.2500000000000000 },
{ -0.59631936513587558, 5.0000000000000000, 4.5000000000000000 },
{ -0.52130838331747587, 5.0000000000000000, 4.7500000000000000 },
{ -0.45369482249110193, 5.0000000000000000, 5.0000000000000000 },
};
const double toler007 = 2.5000000000000020e-13;
// Test data for nu=10.000000000000000.
// max(|f - f_GSL|): 2.3841857910156250e-07
// max(|f - f_GSL| / |f_GSL|): 1.4991559422183497e-15
const testcase_cyl_neumann<double>
data008[20] =
{
{ -124241617095379.48, 10.000000000000000, 0.25000000000000000 },
{ -121963623349.56966, 10.000000000000000, 0.50000000000000000 },
{ -2133501638.9057348, 10.000000000000000, 0.75000000000000000 },
{ -121618014.27868921, 10.000000000000000, 1.0000000000000000 },
{ -13265210.158452792, 10.000000000000000, 1.2500000000000000 },
{ -2183993.0260864049, 10.000000000000000, 1.5000000000000000 },
{ -478274.82386541169, 10.000000000000000, 1.7500000000000000 },
{ -129184.54220803917, 10.000000000000000, 2.0000000000000000 },
{ -40993.254794381690, 10.000000000000000, 2.2500000000000000 },
{ -14782.847716021070, 10.000000000000000, 2.5000000000000000 },
{ -5916.5330998776262, 10.000000000000000, 2.7500000000000000 },
{ -2582.6071294842995, 10.000000000000000, 3.0000000000000000 },
{ -1213.3423564023892, 10.000000000000000, 3.2500000000000000 },
{ -607.27437834125760, 10.000000000000000, 3.5000000000000000 },
{ -321.17461059752202, 10.000000000000000, 3.7500000000000000 },
{ -178.33055590796428, 10.000000000000000, 4.0000000000000000 },
{ -103.40496587570090, 10.000000000000000, 4.2500000000000000 },
{ -62.345024619781434, 10.000000000000000, 4.5000000000000000 },
{ -38.944510430296937, 10.000000000000000, 4.7500000000000000 },
{ -25.129110095610095, 10.000000000000000, 5.0000000000000000 },
};
const double toler008 = 2.5000000000000020e-13;
// Test data for nu=20.000000000000000.
// max(|f - f_GSL|): 6442450944.0000000
// max(|f - f_GSL| / |f_GSL|): 1.6458221996165416e-15
const testcase_cyl_neumann<double>
data009[20] =
{
{ -4.4678815064152581e+34, 20.000000000000000, 0.25000000000000000 },
{ -4.2714301215659088e+28, 20.000000000000000, 0.50000000000000000 },
{ -1.2898357375834223e+25, 20.000000000000000, 0.75000000000000000 },
{ -4.1139703148355065e+22, 20.000000000000000, 1.0000000000000000 },
{ -4.7783533372148580e+20, 20.000000000000000, 1.2500000000000000 },
{ -1.2577301772964241e+19, 20.000000000000000, 1.5000000000000000 },
{ -5.8251041176649626e+17, 20.000000000000000, 1.7500000000000000 },
{ -40816513889983640., 20.000000000000000, 2.0000000000000000 },
{ -3925339868516418.5, 20.000000000000000, 2.2500000000000000 },
{ -484776559582090.25, 20.000000000000000, 2.5000000000000000 },
{ -73320655044814.469, 20.000000000000000, 2.7500000000000000 },
{ -13113540041757.449, 20.000000000000000, 3.0000000000000000 },
{ -2700669268882.7139, 20.000000000000000, 3.2500000000000000 },
{ -627339518240.21240, 20.000000000000000, 3.5000000000000000 },
{ -161695236802.71753, 20.000000000000000, 3.7500000000000000 },
{ -45637199262.220100, 20.000000000000000, 4.0000000000000000 },
{ -13953299213.925377, 20.000000000000000, 4.2500000000000000 },
{ -4580215756.5691023, 20.000000000000000, 4.5000000000000000 },
{ -1602110715.5159132, 20.000000000000000, 4.7500000000000000 },
{ -593396529.69143200, 20.000000000000000, 5.0000000000000000 },
};
const double toler009 = 2.5000000000000020e-13;
// Test data for nu=50.000000000000000.
// max(|f - f_GSL|): 6.4703872001161536e+68
// max(|f - f_GSL| / |f_GSL|): 3.7730746786493403e-15
const testcase_cyl_neumann<double>
data010[20] =
{
{ -2.7643487471155969e+107, 50.000000000000000, 0.25000000000000000 },
{ -2.4575848224461092e+92, 50.000000000000000, 0.50000000000000000 },
{ -3.8604508467683829e+83, 50.000000000000000, 0.75000000000000000 },
{ -2.1911428126053411e+77, 50.000000000000000, 1.0000000000000000 },
{ -3.1362926828833165e+72, 50.000000000000000, 1.2500000000000000 },
{ -3.4584216846550566e+68, 50.000000000000000, 1.5000000000000000 },
{ -1.5607714080312795e+65, 50.000000000000000, 1.7500000000000000 },
{ -1.9761505765184128e+62, 50.000000000000000, 2.0000000000000000 },
{ -5.5023640499231188e+59, 50.000000000000000, 2.2500000000000000 },
{ -2.8530384545826849e+57, 50.000000000000000, 2.5000000000000000 },
{ -2.4467169322684809e+55, 50.000000000000000, 2.7500000000000000 },
{ -3.1793891461005181e+53, 50.000000000000000, 3.0000000000000000 },
{ -5.8573901231568658e+51, 50.000000000000000, 3.2500000000000000 },
{ -1.4528262197760965e+50, 50.000000000000000, 3.5000000000000000 },
{ -4.6566569870478635e+48, 50.000000000000000, 3.7500000000000000 },
{ -1.8661134361400254e+47, 50.000000000000000, 4.0000000000000000 },
{ -9.1005883612255402e+45, 50.000000000000000, 4.2500000000000000 },
{ -5.2813777542386141e+44, 50.000000000000000, 4.5000000000000000 },
{ -3.5795477722116469e+43, 50.000000000000000, 4.7500000000000000 },
{ -2.7888370175838930e+42, 50.000000000000000, 5.0000000000000000 },
};
const double toler010 = 2.5000000000000020e-13;
// Test data for nu=100.00000000000000.
// max(|f - f_GSL|): 1.6136484921850493e+233
// max(|f - f_GSL| / |f_GSL|): 3.7090973947899002e-13
const testcase_cyl_neumann<double>
data011[20] =
{
{ -6.0523080585856754e+245, 100.00000000000000, 0.25000000000000000 },
{ -4.7766903780412668e+215, 100.00000000000000, 0.50000000000000000 },
{ -1.1758283017660654e+198, 100.00000000000000, 0.75000000000000000 },
{ -3.7752878101091316e+185, 100.00000000000000, 1.0000000000000000 },
{ -7.7013290730008304e+175, 100.00000000000000, 1.2500000000000000 },
{ -9.3152624794288802e+167, 100.00000000000000, 1.5000000000000000 },
{ -1.8854163374247264e+161, 100.00000000000000, 1.7500000000000000 },
{ -3.0008260488569689e+155, 100.00000000000000, 2.0000000000000000 },
{ -2.3075650873777408e+150, 100.00000000000000, 2.2500000000000000 },
{ -6.1476258561369381e+145, 100.00000000000000, 2.5000000000000000 },
{ -4.4758816234829593e+141, 100.00000000000000, 2.7500000000000000 },
{ -7.4747961023547846e+137, 100.00000000000000, 3.0000000000000000 },
{ -2.5067022766900123e+134, 100.00000000000000, 3.2500000000000000 },
{ -1.5222488313431896e+131, 100.00000000000000, 3.5000000000000000 },
{ -1.5422392812241397e+128, 100.00000000000000, 3.7500000000000000 },
{ -2.4400857387551062e+125, 100.00000000000000, 4.0000000000000000 },
{ -5.7118153392422278e+122, 100.00000000000000, 4.2500000000000000 },
{ -1.8915420905194465e+120, 100.00000000000000, 4.5000000000000000 },
{ -8.5357945104770158e+117, 100.00000000000000, 4.7500000000000000 },
{ -5.0848639160196196e+115, 100.00000000000000, 5.0000000000000000 },
};
const double toler011 = 2.5000000000000014e-11;
// cyl_neumann
// Test data for nu=0.0000000000000000.
// max(|f - f_GSL|): 7.1245093158367467e-15
// max(|f - f_GSL| / |f_GSL|): 1.5215931554460198e-12
const testcase_cyl_neumann<double>
data012[20] =
{
{ -0.30851762524903359, 0.0000000000000000, 5.0000000000000000 },
{ 0.055671167283599457, 0.0000000000000000, 10.000000000000000 },
{ 0.20546429603891822, 0.0000000000000000, 15.000000000000000 },
{ 0.062640596809384053, 0.0000000000000000, 20.000000000000000 },
{ -0.12724943226800617, 0.0000000000000000, 25.000000000000000 },
{ -0.11729573168666413, 0.0000000000000000, 30.000000000000000 },
{ 0.045797987195155689, 0.0000000000000000, 35.000000000000000 },
{ 0.12593641705826092, 0.0000000000000000, 40.000000000000000 },
{ 0.027060469763313333, 0.0000000000000000, 45.000000000000000 },
{ -0.098064995470077118, 0.0000000000000000, 50.000000000000000 },
{ -0.077569178730412594, 0.0000000000000000, 55.000000000000000 },
{ 0.047358952209449426, 0.0000000000000000, 60.000000000000000 },
{ 0.097183557740181920, 0.0000000000000000, 65.000000000000000 },
{ 0.0093096664589409992, 0.0000000000000000, 70.000000000000000 },
{ -0.085369047647775656, 0.0000000000000000, 75.000000000000000 },
{ -0.055620339089770016, 0.0000000000000000, 80.000000000000000 },
{ 0.049567884951494251, 0.0000000000000000, 85.000000000000000 },
{ 0.079776475854877751, 0.0000000000000000, 90.000000000000000 },
{ -0.0028230995861232107, 0.0000000000000000, 95.000000000000000 },
{ -0.077244313365083153, 0.0000000000000000, 100.00000000000000 },
};
const double toler012 = 1.0000000000000006e-10;
// Test data for nu=0.33333333333333331.
// max(|f - f_GSL|): 6.4392935428259079e-15
// max(|f - f_GSL| / |f_GSL|): 4.0229312517518102e-13
const testcase_cyl_neumann<double>
data013[20] =
{
{ -0.18192321129343850, 0.33333333333333331, 5.0000000000000000 },
{ 0.17020111788268760, 0.33333333333333331, 10.000000000000000 },
{ 0.18540507541540796, 0.33333333333333331, 15.000000000000000 },
{ -0.028777707635715043, 0.33333333333333331, 20.000000000000000 },
{ -0.15829741864944163, 0.33333333333333331, 25.000000000000000 },
{ -0.058645772316705209, 0.33333333333333331, 30.000000000000000 },
{ 0.10294930308870617, 0.33333333333333331, 35.000000000000000 },
{ 0.10547870367098922, 0.33333333333333331, 40.000000000000000 },
{ -0.034334228816010816, 0.33333333333333331, 45.000000000000000 },
{ -0.11283489933031279, 0.33333333333333331, 50.000000000000000 },
{ -0.030007358986895105, 0.33333333333333331, 55.000000000000000 },
{ 0.086699173295718121, 0.33333333333333331, 60.000000000000000 },
{ 0.074875579668878658, 0.33333333333333331, 65.000000000000000 },
{ -0.039323246374552680, 0.33333333333333331, 70.000000000000000 },
{ -0.091263539574475236, 0.33333333333333331, 75.000000000000000 },
{ -0.013358849535984318, 0.33333333333333331, 80.000000000000000 },
{ 0.078373575537830198, 0.33333333333333331, 85.000000000000000 },
{ 0.055812482883955940, 0.33333333333333331, 90.000000000000000 },
{ -0.043310380106990683, 0.33333333333333331, 95.000000000000000 },
{ -0.076900504962136559, 0.33333333333333331, 100.00000000000000 },
};
const double toler013 = 2.5000000000000014e-11;
// Test data for nu=0.50000000000000000.
// max(|f - f_GSL|): 6.5988881026157742e-15
// max(|f - f_GSL| / |f_GSL|): 6.0282403975230169e-13
const testcase_cyl_neumann<double>
data014[20] =
{
{ -0.10121770918510846, 0.50000000000000000, 5.0000000000000000 },
{ 0.21170886633139810, 0.50000000000000000, 10.000000000000000 },
{ 0.15650551590730855, 0.50000000000000000, 15.000000000000000 },
{ -0.072806904785061938, 0.50000000000000000, 20.000000000000000 },
{ -0.15817308404205055, 0.50000000000000000, 25.000000000000000 },
{ -0.022470290598831138, 0.50000000000000000, 30.000000000000000 },
{ 0.12187835265849535, 0.50000000000000000, 35.000000000000000 },
{ 0.084138655676395377, 0.50000000000000000, 40.000000000000000 },
{ -0.062482641933003201, 0.50000000000000000, 45.000000000000000 },
{ -0.10888475635053954, 0.50000000000000000, 50.000000000000000 },
{ -0.0023805454010949376, 0.50000000000000000, 55.000000000000000 },
{ 0.098104683735037918, 0.50000000000000000, 60.000000000000000 },
{ 0.055663470218594434, 0.50000000000000000, 65.000000000000000 },
{ -0.060396767883824871, 0.50000000000000000, 70.000000000000000 },
{ -0.084922578922046868, 0.50000000000000000, 75.000000000000000 },
{ 0.0098472271924441284, 0.50000000000000000, 80.000000000000000 },
{ 0.085190643574343625, 0.50000000000000000, 85.000000000000000 },
{ 0.037684970437156268, 0.50000000000000000, 90.000000000000000 },
{ -0.059772904856097500, 0.50000000000000000, 95.000000000000000 },
{ -0.068803091468728109, 0.50000000000000000, 100.00000000000000 },
};
const double toler014 = 5.0000000000000028e-11;
// Test data for nu=0.66666666666666663.
// max(|f - f_GSL|): 7.2442052356791464e-15
// max(|f - f_GSL| / |f_GSL|): 4.1296144775547441e-13
const testcase_cyl_neumann<double>
data015[20] =
{
{ -0.016050662643389627, 0.66666666666666663, 5.0000000000000000 },
{ 0.23937232657540733, 0.66666666666666663, 10.000000000000000 },
{ 0.11762106604241235, 0.66666666666666663, 15.000000000000000 },
{ -0.11182254014899558, 0.66666666666666663, 20.000000000000000 },
{ -0.14756582982938804, 0.66666666666666663, 25.000000000000000 },
{ 0.015078692908077713, 0.66666666666666663, 30.000000000000000 },
{ 0.13260911815705795, 0.66666666666666663, 35.000000000000000 },
{ 0.057217565989652698, 0.66666666666666663, 40.000000000000000 },
{ -0.086373755152382006, 0.66666666666666663, 45.000000000000000 },
{ -0.097624139208051616, 0.66666666666666663, 50.000000000000000 },
{ 0.025354902147023392, 0.66666666666666663, 55.000000000000000 },
{ 0.10288136476351206, 0.66666666666666663, 60.000000000000000 },
{ 0.032728379560128203, 0.66666666666666663, 65.000000000000000 },
{ -0.077363672735747818, 0.66666666666666663, 70.000000000000000 },
{ -0.072855870458293961, 0.66666666666666663, 75.000000000000000 },
{ 0.032358106046953543, 0.66666666666666663, 80.000000000000000 },
{ 0.086240651537394228, 0.66666666666666663, 85.000000000000000 },
{ 0.017029601697285190, 0.66666666666666663, 90.000000000000000 },
{ -0.072173520560584681, 0.66666666666666663, 95.000000000000000 },
{ -0.056057339204073887, 0.66666666666666663, 100.00000000000000 },
};
const double toler015 = 2.5000000000000014e-11;
// Test data for nu=1.0000000000000000.
// max(|f - f_GSL|): 7.6640083168655337e-15
// max(|f - f_GSL| / |f_GSL|): 4.2719333494531163e-13
const testcase_cyl_neumann<double>
data016[20] =
{
{ 0.14786314339122700, 1.0000000000000000, 5.0000000000000000 },
{ 0.24901542420695386, 1.0000000000000000, 10.000000000000000 },
{ 0.021073628036873522, 1.0000000000000000, 15.000000000000000 },
{ -0.16551161436252115, 1.0000000000000000, 20.000000000000000 },
{ -0.098829964783237412, 1.0000000000000000, 25.000000000000000 },
{ 0.084425570661747135, 1.0000000000000000, 30.000000000000000 },
{ 0.12751273354559009, 1.0000000000000000, 35.000000000000000 },
{ -0.0057935058215497536, 1.0000000000000000, 40.000000000000000 },
{ -0.11552517964639945, 1.0000000000000000, 45.000000000000000 },
{ -0.056795668562014692, 1.0000000000000000, 50.000000000000000 },
{ 0.073846265432577926, 1.0000000000000000, 55.000000000000000 },
{ 0.091869609369866892, 1.0000000000000000, 60.000000000000000 },
{ -0.017940374275377362, 1.0000000000000000, 65.000000000000000 },
{ -0.094844652625716230, 1.0000000000000000, 70.000000000000000 },
{ -0.035213785160580421, 1.0000000000000000, 75.000000000000000 },
{ 0.069395913784588037, 1.0000000000000000, 80.000000000000000 },
{ 0.071233187582749768, 1.0000000000000000, 85.000000000000000 },
{ -0.026187238607768244, 1.0000000000000000, 90.000000000000000 },
{ -0.081827958724501215, 1.0000000000000000, 95.000000000000000 },
{ -0.020372312002759834, 1.0000000000000000, 100.00000000000000 },
};
const double toler016 = 2.5000000000000014e-11;
// Test data for nu=2.0000000000000000.
// max(|f - f_GSL|): 7.1193051454088163e-15
// max(|f - f_GSL| / |f_GSL|): 3.9371586401654762e-12
const testcase_cyl_neumann<double>
data017[20] =
{
{ 0.36766288260552438, 2.0000000000000000, 5.0000000000000000 },
{ -0.0058680824422086830, 2.0000000000000000, 10.000000000000000 },
{ -0.20265447896733507, 2.0000000000000000, 15.000000000000000 },
{ -0.079191758245636165, 2.0000000000000000, 20.000000000000000 },
{ 0.11934303508534717, 2.0000000000000000, 25.000000000000000 },
{ 0.12292410306411394, 2.0000000000000000, 30.000000000000000 },
{ -0.038511545278264829, 2.0000000000000000, 35.000000000000000 },
{ -0.12622609234933840, 2.0000000000000000, 40.000000000000000 },
{ -0.032194922192042195, 2.0000000000000000, 45.000000000000000 },
{ 0.095793168727596537, 2.0000000000000000, 50.000000000000000 },
{ 0.080254497473415426, 2.0000000000000000, 55.000000000000000 },
{ -0.044296631897120527, 2.0000000000000000, 60.000000000000000 },
{ -0.097735569256347382, 2.0000000000000000, 65.000000000000000 },
{ -0.012019513676818605, 2.0000000000000000, 70.000000000000000 },
{ 0.084430013376826846, 2.0000000000000000, 75.000000000000000 },
{ 0.057355236934384719, 2.0000000000000000, 80.000000000000000 },
{ -0.047891809949547198, 2.0000000000000000, 85.000000000000000 },
{ -0.080358414490605934, 2.0000000000000000, 90.000000000000000 },
{ 0.0011004057182389746, 2.0000000000000000, 95.000000000000000 },
{ 0.076836867125027963, 2.0000000000000000, 100.00000000000000 },
};
const double toler017 = 2.5000000000000017e-10;
// Test data for nu=5.0000000000000000.
// max(|f - f_GSL|): 7.8097792989562098e-15
// max(|f - f_GSL| / |f_GSL|): 3.2731037832632215e-11
const testcase_cyl_neumann<double>
data018[20] =
{
{ -0.45369482249110193, 5.0000000000000000, 5.0000000000000000 },
{ 0.13540304768936234, 5.0000000000000000, 10.000000000000000 },
{ 0.16717271575940015, 5.0000000000000000, 15.000000000000000 },
{ -0.10003576788953220, 5.0000000000000000, 20.000000000000000 },
{ -0.14705799311372267, 5.0000000000000000, 25.000000000000000 },
{ 0.031627359289264301, 5.0000000000000000, 30.000000000000000 },
{ 0.13554781474770028, 5.0000000000000000, 35.000000000000000 },
{ 0.031869448780850247, 5.0000000000000000, 40.000000000000000 },
{ -0.10426932700176872, 5.0000000000000000, 45.000000000000000 },
{ -0.078548413913081594, 5.0000000000000000, 50.000000000000000 },
{ 0.055257033062858375, 5.0000000000000000, 55.000000000000000 },
{ 0.099464632840450887, 5.0000000000000000, 60.000000000000000 },
{ 0.00023860469499595305, 5.0000000000000000, 65.000000000000000 },
{ -0.091861802216406052, 5.0000000000000000, 70.000000000000000 },
{ -0.048383671296970042, 5.0000000000000000, 75.000000000000000 },
{ 0.060293667104896316, 5.0000000000000000, 80.000000000000000 },
{ 0.077506166682733996, 5.0000000000000000, 85.000000000000000 },
{ -0.015338764062239767, 5.0000000000000000, 90.000000000000000 },
{ -0.081531504045514361, 5.0000000000000000, 95.000000000000000 },
{ -0.029480196281661937, 5.0000000000000000, 100.00000000000000 },
};
const double toler018 = 2.5000000000000013e-09;
// Test data for nu=10.000000000000000.
// max(|f - f_GSL|): 1.7763568394002505e-14
// max(|f - f_GSL| / |f_GSL|): 2.7466153115234563e-12
const testcase_cyl_neumann<double>
data019[20] =
{
{ -25.129110095610095, 10.000000000000000, 5.0000000000000000 },
{ -0.35981415218340279, 10.000000000000000, 10.000000000000000 },
{ 0.21997141360195577, 10.000000000000000, 15.000000000000000 },
{ -0.043894653515658105, 10.000000000000000, 20.000000000000000 },
{ -0.14871839049980651, 10.000000000000000, 25.000000000000000 },
{ 0.075056702122397012, 10.000000000000000, 30.000000000000000 },
{ 0.12222473135000546, 10.000000000000000, 35.000000000000000 },
{ -0.046723877232677985, 10.000000000000000, 40.000000000000000 },
{ -0.11739339009322181, 10.000000000000000, 45.000000000000000 },
{ 0.0057238971820535930, 10.000000000000000, 50.000000000000000 },
{ 0.10733910125831631, 10.000000000000000, 55.000000000000000 },
{ 0.036290350559545478, 10.000000000000000, 60.000000000000000 },
{ -0.083239127691715667, 10.000000000000000, 65.000000000000000 },
{ -0.069639384138314858, 10.000000000000000, 70.000000000000000 },
{ 0.045798335061325066, 10.000000000000000, 75.000000000000000 },
{ 0.086269195064844456, 10.000000000000000, 80.000000000000000 },
{ -0.0018234674126248740, 10.000000000000000, 85.000000000000000 },
{ -0.082067762371231284, 10.000000000000000, 90.000000000000000 },
{ -0.038798074754578089, 10.000000000000000, 95.000000000000000 },
{ 0.058331574236414913, 10.000000000000000, 100.00000000000000 },
};
const double toler019 = 2.5000000000000017e-10;
// Test data for nu=20.000000000000000.
// max(|f - f_GSL|): 7.1525573730468750e-07
// max(|f - f_GSL| / |f_GSL|): 1.7017552833615218e-12
const testcase_cyl_neumann<double>
data020[20] =
{
{ -593396529.69143200, 20.000000000000000, 5.0000000000000000 },
{ -1597.4838482696259, 20.000000000000000, 10.000000000000000 },
{ -3.3087330924737621, 20.000000000000000, 15.000000000000000 },
{ -0.28548945860020319, 20.000000000000000, 20.000000000000000 },
{ 0.19804074776289243, 20.000000000000000, 25.000000000000000 },
{ -0.16848153948742683, 20.000000000000000, 30.000000000000000 },
{ 0.10102784152594022, 20.000000000000000, 35.000000000000000 },
{ 0.045161820565805755, 20.000000000000000, 40.000000000000000 },
{ -0.12556489308015448, 20.000000000000000, 45.000000000000000 },
{ 0.016442633948115834, 20.000000000000000, 50.000000000000000 },
{ 0.10853448778255181, 20.000000000000000, 55.000000000000000 },
{ -0.026721408520664701, 20.000000000000000, 60.000000000000000 },
{ -0.098780425256324175, 20.000000000000000, 65.000000000000000 },
{ 0.016201957786018233, 20.000000000000000, 70.000000000000000 },
{ 0.093591198265063721, 20.000000000000000, 75.000000000000000 },
{ 0.0040484400737296200, 20.000000000000000, 80.000000000000000 },
{ -0.086314929459920531, 20.000000000000000, 85.000000000000000 },
{ -0.028274110097231530, 20.000000000000000, 90.000000000000000 },
{ 0.072349520791638741, 20.000000000000000, 95.000000000000000 },
{ 0.051247973076188474, 20.000000000000000, 100.00000000000000 },
};
const double toler020 = 1.0000000000000006e-10;
// Test data for nu=50.000000000000000.
// max(|f - f_GSL|): 1.0522490333925732e+28
// max(|f - f_GSL| / |f_GSL|): 2.6658726302692481e-12
const testcase_cyl_neumann<double>
data021[20] =
{
{ -2.7888370175838930e+42, 50.000000000000000, 5.0000000000000000 },
{ -3.6410665018007421e+27, 50.000000000000000, 10.000000000000000 },
{ -1.0929732912175415e+19, 50.000000000000000, 15.000000000000000 },
{ -15606426801663.734, 50.000000000000000, 20.000000000000000 },
{ -753573251.44662738, 50.000000000000000, 25.000000000000000 },
{ -386759.32602734759, 50.000000000000000, 30.000000000000000 },
{ -1172.8690492895323, 50.000000000000000, 35.000000000000000 },
{ -15.615608873419944, 50.000000000000000, 40.000000000000000 },
{ -0.87058346204176895, 50.000000000000000, 45.000000000000000 },
{ -0.21031655464397747, 50.000000000000000, 50.000000000000000 },
{ 0.093048240412999389, 50.000000000000000, 55.000000000000000 },
{ 0.0086417699626744754, 50.000000000000000, 60.000000000000000 },
{ -0.025019788459222037, 50.000000000000000, 65.000000000000000 },
{ -0.0014815155191909152, 50.000000000000000, 70.000000000000000 },
{ 0.050335774732164121, 50.000000000000000, 75.000000000000000 },
{ -0.092924250967987232, 50.000000000000000, 80.000000000000000 },
{ 0.087332463030205698, 50.000000000000000, 85.000000000000000 },
{ -0.016164237701651860, 50.000000000000000, 90.000000000000000 },
{ -0.068897613820457934, 50.000000000000000, 95.000000000000000 },
{ 0.076505263944803045, 50.000000000000000, 100.00000000000000 },
};
const double toler021 = 2.5000000000000017e-10;
// Test data for nu=100.00000000000000.
// max(|f - f_GSL|): 6.3342780989716025e+102
// max(|f - f_GSL| / |f_GSL|): 1.2681517765786818e-13
const testcase_cyl_neumann<double>
data022[20] =
{
{ -5.0848639160196196e+115, 100.00000000000000, 5.0000000000000000 },
{ -4.8491482711800252e+85, 100.00000000000000, 10.000000000000000 },
{ -1.6375955323195320e+68, 100.00000000000000, 15.000000000000000 },
{ -8.2002648144679126e+55, 100.00000000000000, 20.000000000000000 },
{ -2.9712216432562368e+46, 100.00000000000000, 25.000000000000000 },
{ -7.2875284708240751e+38, 100.00000000000000, 30.000000000000000 },
{ -3.4251079902108953e+32, 100.00000000000000, 35.000000000000000 },
{ -1.4552439438101802e+27, 100.00000000000000, 40.000000000000000 },
{ -3.4506612476220073e+22, 100.00000000000000, 45.000000000000000 },
{ -3.2938001882025953e+18, 100.00000000000000, 50.000000000000000 },
{ -1005686182055527.4, 100.00000000000000, 55.000000000000000 },
{ -831892881402.11377, 100.00000000000000, 60.000000000000000 },
{ -1650863778.0598330, 100.00000000000000, 65.000000000000000 },
{ -7192614.1976097794, 100.00000000000000, 70.000000000000000 },
{ -64639.072261231595, 100.00000000000000, 75.000000000000000 },
{ -1152.5905185698466, 100.00000000000000, 80.000000000000000 },
{ -40.250761402101560, 100.00000000000000, 85.000000000000000 },
{ -2.8307771387185459, 100.00000000000000, 90.000000000000000 },
{ -0.45762200495904848, 100.00000000000000, 95.000000000000000 },
{ -0.16692141141757652, 100.00000000000000, 100.00000000000000 },
};
const double toler022 = 1.0000000000000006e-11;
template<typename Tp, unsigned int Num>
void
test(const testcase_cyl_neumann<Tp> (&data)[Num], Tp toler)
{
bool test __attribute__((unused)) = true;
const Tp eps = std::numeric_limits<Tp>::epsilon();
Tp max_abs_diff = -Tp(1);
Tp max_abs_frac = -Tp(1);
unsigned int num_datum = Num;
for (unsigned int i = 0; i < num_datum; ++i)
{
const Tp f = std::cyl_neumann(data[i].nu, data[i].x);
const Tp f0 = data[i].f0;
const Tp diff = f - f0;
if (std::abs(diff) > max_abs_diff)
max_abs_diff = std::abs(diff);
if (std::abs(f0) > Tp(10) * eps
&& std::abs(f) > Tp(10) * eps)
{
const Tp frac = diff / f0;
if (std::abs(frac) > max_abs_frac)
max_abs_frac = std::abs(frac);
}
}
VERIFY(max_abs_frac < toler);
}
int
main()
{
test(data001, toler001);
test(data002, toler002);
test(data003, toler003);
test(data004, toler004);
test(data005, toler005);
test(data006, toler006);
test(data007, toler007);
test(data008, toler008);
test(data009, toler009);
test(data010, toler010);
test(data011, toler011);
test(data012, toler012);
test(data013, toler013);
test(data014, toler014);
test(data015, toler015);
test(data016, toler016);
test(data017, toler017);
test(data018, toler018);
test(data019, toler019);
test(data020, toler020);
test(data021, toler021);
test(data022, toler022);
return 0;
}

View File

@ -0,0 +1,40 @@
// { dg-do compile }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.10 cyl_neumann
#include <cmath>
void
test01()
{
float nuf = 1.0F / 3.0F, xf = 0.5F;
double nud = 1.0 / 3.0, xd = 0.5;
long double nul = 1.0L / 3.0L, xl = 0.5L;
std::cyl_neumann(nuf, xf);
std::cyl_neumannf(nuf, xf);
std::cyl_neumann(nud, xd);
std::cyl_neumann(nul, xl);
std::cyl_neumannl(nul, xl);
return;
}

View File

@ -0,0 +1,41 @@
// { dg-do compile { xfail *-*-* } }
// { dg-excess-errors "" }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.10 cyl_neumann
#include <math.h>
void
test01()
{
float nuf = 1.0F / 3.0F, xf = 0.5F;
double nud = 1.0 / 3.0, xd = 0.5;
long double nul = 1.0L / 3.0L, xl = 0.5L;
cyl_neumann(nuf, xf);
cyl_neumannf(nuf, xf);
cyl_neumann(nud, xd);
cyl_neumann(nul, xl);
cyl_neumannl(nul, xl);
return;
}

View File

@ -0,0 +1,88 @@
// { dg-require-c-std "" }
// { dg-add-options ieee }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.11 ellint_1
#include <cmath>
#include <testsuite_hooks.h>
void
test01()
{
float kf = std::numeric_limits<float>::quiet_NaN();
double kd = std::numeric_limits<double>::quiet_NaN();
long double kl = std::numeric_limits<long double>::quiet_NaN();
float phif = std::atan2(1.0F, 1.0F);
double phid = std::atan2(1.0, 1.0);
long double phil = std::atan2(1.0L, 1.0L);
float a = std::ellint_1(kf, phif);
float b = std::ellint_1f(kf, phif);
double c = std::ellint_1(kd, phid);
long double d = std::ellint_1(kl, phil);
long double e = std::ellint_1l(kl, phil);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
void
test02()
{
float kf = 0.5F;
double kd = 0.5;
long double kl = 0.5L;
float phif = std::numeric_limits<float>::quiet_NaN();
double phid = std::numeric_limits<double>::quiet_NaN();
long double phil = std::numeric_limits<long double>::quiet_NaN();
float a = std::ellint_1(kf, phif);
float b = std::ellint_1f(kf, phif);
double c = std::ellint_1(kd, phid);
long double d = std::ellint_1(kl, phil);
long double e = std::ellint_1l(kl, phil);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
int
main()
{
test01();
test02();
return 0;
}

View File

@ -0,0 +1,451 @@
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
//
// Copyright (C) 2016 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/>.
// ellint_1
// Compare against values generated by the GNU Scientific Library.
// The GSL can be found on the web: http://www.gnu.org/software/gsl/
#include <limits>
#include <cmath>
#if defined(__TEST_DEBUG)
# include <iostream>
# define VERIFY(A) \
if (!(A)) \
{ \
std::cout << "line " << __LINE__ \
<< " max_abs_frac = " << max_abs_frac \
<< std::endl; \
}
#else
# include <testsuite_hooks.h>
#endif
#include <specfun_testcase.h>
// Test data for k=-0.90000000000000002.
// max(|f - f_GSL|): 6.6613381477509392e-16
// max(|f - f_GSL| / |f_GSL|): 4.3381508715713370e-16
const testcase_ellint_1<double>
data001[10] =
{
{ 0.0000000000000000, -0.90000000000000002, 0.0000000000000000 },
{ 0.17525427376115024, -0.90000000000000002, 0.17453292519943295 },
{ 0.35492464591297446, -0.90000000000000002, 0.34906585039886590 },
{ 0.54388221416157112, -0.90000000000000002, 0.52359877559829882 },
{ 0.74797400423532490, -0.90000000000000002, 0.69813170079773179 },
{ 0.97463898451966458, -0.90000000000000002, 0.87266462599716477 },
{ 1.2334463254523440, -0.90000000000000002, 1.0471975511965976 },
{ 1.5355247765594913, -0.90000000000000002, 1.2217304763960306 },
{ 1.8882928567775121, -0.90000000000000002, 1.3962634015954636 },
{ 2.2805491384227703, -0.90000000000000002, 1.5707963267948966 },
};
const double toler001 = 2.5000000000000020e-13;
// Test data for k=-0.80000000000000004.
// max(|f - f_GSL|): 4.4408920985006262e-16
// max(|f - f_GSL| / |f_GSL|): 4.1175183168766718e-16
const testcase_ellint_1<double>
data002[10] =
{
{ 0.0000000000000000, -0.80000000000000004, 0.0000000000000000 },
{ 0.17510154241338899, -0.80000000000000004, 0.17453292519943295 },
{ 0.35365068839779390, -0.80000000000000004, 0.34906585039886590 },
{ 0.53926804409084550, -0.80000000000000004, 0.52359877559829882 },
{ 0.73587926028070361, -0.80000000000000004, 0.69813170079773179 },
{ 0.94770942970071170, -0.80000000000000004, 0.87266462599716477 },
{ 1.1789022995388236, -0.80000000000000004, 1.0471975511965976 },
{ 1.4323027881876009, -0.80000000000000004, 1.2217304763960306 },
{ 1.7069629739121674, -0.80000000000000004, 1.3962634015954636 },
{ 1.9953027776647296, -0.80000000000000004, 1.5707963267948966 },
};
const double toler002 = 2.5000000000000020e-13;
// Test data for k=-0.69999999999999996.
// max(|f - f_GSL|): 3.3306690738754696e-16
// max(|f - f_GSL| / |f_GSL|): 3.5930208052157665e-16
const testcase_ellint_1<double>
data003[10] =
{
{ 0.0000000000000000, -0.69999999999999996, 0.0000000000000000 },
{ 0.17496737466916723, -0.69999999999999996, 0.17453292519943295 },
{ 0.35254687535677925, -0.69999999999999996, 0.34906585039886590 },
{ 0.53536740275997119, -0.69999999999999996, 0.52359877559829882 },
{ 0.72603797651684454, -0.69999999999999996, 0.69813170079773179 },
{ 0.92698296348313458, -0.69999999999999996, 0.87266462599716477 },
{ 1.1400447527693316, -0.69999999999999996, 1.0471975511965976 },
{ 1.3657668117194073, -0.69999999999999996, 1.2217304763960306 },
{ 1.6024686895959159, -0.69999999999999996, 1.3962634015954636 },
{ 1.8456939983747236, -0.69999999999999996, 1.5707963267948966 },
};
const double toler003 = 2.5000000000000020e-13;
// Test data for k=-0.59999999999999998.
// max(|f - f_GSL|): 4.4408920985006262e-16
// max(|f - f_GSL| / |f_GSL|): 3.3664899092028927e-16
const testcase_ellint_1<double>
data004[10] =
{
{ 0.0000000000000000, -0.59999999999999998, 0.0000000000000000 },
{ 0.17485154362988359, -0.59999999999999998, 0.17453292519943295 },
{ 0.35160509865544326, -0.59999999999999998, 0.34906585039886590 },
{ 0.53210652578446138, -0.59999999999999998, 0.52359877559829882 },
{ 0.71805304664485659, -0.59999999999999998, 0.69813170079773179 },
{ 0.91082759030195970, -0.59999999999999998, 0.87266462599716477 },
{ 1.1112333229323361, -0.59999999999999998, 1.0471975511965976 },
{ 1.3191461190365270, -0.59999999999999998, 1.2217304763960306 },
{ 1.5332022105084773, -0.59999999999999998, 1.3962634015954636 },
{ 1.7507538029157526, -0.59999999999999998, 1.5707963267948966 },
};
const double toler004 = 2.5000000000000020e-13;
// Test data for k=-0.50000000000000000.
// max(|f - f_GSL|): 2.2204460492503131e-16
// max(|f - f_GSL| / |f_GSL|): 3.1201497220602069e-16
const testcase_ellint_1<double>
data005[10] =
{
{ 0.0000000000000000, -0.50000000000000000, 0.0000000000000000 },
{ 0.17475385514035785, -0.50000000000000000, 0.17453292519943295 },
{ 0.35081868470101585, -0.50000000000000000, 0.34906585039886590 },
{ 0.52942862705190574, -0.50000000000000000, 0.52359877559829882 },
{ 0.71164727562630314, -0.50000000000000000, 0.69813170079773179 },
{ 0.89824523594227768, -0.50000000000000000, 0.87266462599716477 },
{ 1.0895506700518851, -0.50000000000000000, 1.0471975511965976 },
{ 1.2853005857432931, -0.50000000000000000, 1.2217304763960306 },
{ 1.4845545520549484, -0.50000000000000000, 1.3962634015954636 },
{ 1.6857503548125963, -0.50000000000000000, 1.5707963267948966 },
};
const double toler005 = 2.5000000000000020e-13;
// Test data for k=-0.40000000000000002.
// max(|f - f_GSL|): 6.6613381477509392e-16
// max(|f - f_GSL| / |f_GSL|): 4.0617918857203532e-16
const testcase_ellint_1<double>
data006[10] =
{
{ 0.0000000000000000, -0.40000000000000002, 0.0000000000000000 },
{ 0.17467414669441528, -0.40000000000000002, 0.17453292519943295 },
{ 0.35018222772483443, -0.40000000000000002, 0.34906585039886590 },
{ 0.52729015917508737, -0.40000000000000002, 0.52359877559829882 },
{ 0.70662374407341244, -0.40000000000000002, 0.69813170079773179 },
{ 0.88859210497602170, -0.40000000000000002, 0.87266462599716477 },
{ 1.0733136290471379, -0.40000000000000002, 1.0471975511965976 },
{ 1.2605612170157061, -0.40000000000000002, 1.2217304763960306 },
{ 1.4497513956433439, -0.40000000000000002, 1.3962634015954636 },
{ 1.6399998658645112, -0.40000000000000002, 1.5707963267948966 },
};
const double toler006 = 2.5000000000000020e-13;
// Test data for k=-0.30000000000000004.
// max(|f - f_GSL|): 8.8817841970012523e-16
// max(|f - f_GSL| / |f_GSL|): 6.3361874537309281e-16
const testcase_ellint_1<double>
data007[10] =
{
{ 0.0000000000000000, -0.30000000000000004, 0.0000000000000000 },
{ 0.17461228653000099, -0.30000000000000004, 0.17453292519943295 },
{ 0.34969146102798415, -0.30000000000000004, 0.34906585039886590 },
{ 0.52565822873726320, -0.30000000000000004, 0.52359877559829882 },
{ 0.70284226512408532, -0.30000000000000004, 0.69813170079773179 },
{ 0.88144139195111182, -0.30000000000000004, 0.87266462599716477 },
{ 1.0614897067260520, -0.30000000000000004, 1.0471975511965976 },
{ 1.2428416824174218, -0.30000000000000004, 1.2217304763960306 },
{ 1.4251795877015927, -0.30000000000000004, 1.3962634015954636 },
{ 1.6080486199305128, -0.30000000000000004, 1.5707963267948966 },
};
const double toler007 = 2.5000000000000020e-13;
// Test data for k=-0.19999999999999996.
// max(|f - f_GSL|): 4.4408920985006262e-16
// max(|f - f_GSL| / |f_GSL|): 4.2156475739151676e-16
const testcase_ellint_1<double>
data008[10] =
{
{ 0.0000000000000000, -0.19999999999999996, 0.0000000000000000 },
{ 0.17456817290292809, -0.19999999999999996, 0.17453292519943295 },
{ 0.34934315932086801, -0.19999999999999996, 0.34906585039886590 },
{ 0.52450880529443988, -0.19999999999999996, 0.52359877559829882 },
{ 0.70020491009844876, -0.19999999999999996, 0.69813170079773179 },
{ 0.87651006649967955, -0.19999999999999996, 0.87266462599716477 },
{ 1.0534305870298994, -0.19999999999999996, 1.0471975511965976 },
{ 1.2308975521670784, -0.19999999999999996, 1.2217304763960306 },
{ 1.4087733584990738, -0.19999999999999996, 1.3962634015954636 },
{ 1.5868678474541660, -0.19999999999999996, 1.5707963267948966 },
};
const double toler008 = 2.5000000000000020e-13;
// Test data for k=-0.099999999999999978.
// max(|f - f_GSL|): 4.4408920985006262e-16
// max(|f - f_GSL| / |f_GSL|): 3.1735566504509650e-16
const testcase_ellint_1<double>
data009[10] =
{
{ 0.0000000000000000, -0.099999999999999978, 0.0000000000000000 },
{ 0.17454173353063659, -0.099999999999999978, 0.17453292519943295 },
{ 0.34913506721468091, -0.099999999999999978, 0.34906585039886590 },
{ 0.52382550016538942, -0.099999999999999978, 0.52359877559829882 },
{ 0.69864700854177020, -0.099999999999999978, 0.69813170079773179 },
{ 0.87361792586964870, -0.099999999999999978, 0.87266462599716477 },
{ 1.0487386319621683, -0.099999999999999978, 1.0471975511965976 },
{ 1.2239913752078757, -0.099999999999999978, 1.2217304763960306 },
{ 1.3993423113684049, -0.099999999999999978, 1.3962634015954636 },
{ 1.5747455615173562, -0.099999999999999978, 1.5707963267948966 },
};
const double toler009 = 2.5000000000000020e-13;
// Test data for k=0.0000000000000000.
// max(|f - f_GSL|): 2.2204460492503131e-16
// max(|f - f_GSL| / |f_GSL|): 2.1203697876423452e-16
const testcase_ellint_1<double>
data010[10] =
{
{ 0.0000000000000000, 0.0000000000000000, 0.0000000000000000 },
{ 0.17453292519943292, 0.0000000000000000, 0.17453292519943295 },
{ 0.34906585039886584, 0.0000000000000000, 0.34906585039886590 },
{ 0.52359877559829870, 0.0000000000000000, 0.52359877559829882 },
{ 0.69813170079773168, 0.0000000000000000, 0.69813170079773179 },
{ 0.87266462599716477, 0.0000000000000000, 0.87266462599716477 },
{ 1.0471975511965974, 0.0000000000000000, 1.0471975511965976 },
{ 1.2217304763960304, 0.0000000000000000, 1.2217304763960306 },
{ 1.3962634015954631, 0.0000000000000000, 1.3962634015954636 },
{ 1.5707963267948966, 0.0000000000000000, 1.5707963267948966 },
};
const double toler010 = 2.5000000000000020e-13;
// Test data for k=0.10000000000000009.
// max(|f - f_GSL|): 4.4408920985006262e-16
// max(|f - f_GSL| / |f_GSL|): 3.1735566504509650e-16
const testcase_ellint_1<double>
data011[10] =
{
{ 0.0000000000000000, 0.10000000000000009, 0.0000000000000000 },
{ 0.17454173353063659, 0.10000000000000009, 0.17453292519943295 },
{ 0.34913506721468091, 0.10000000000000009, 0.34906585039886590 },
{ 0.52382550016538942, 0.10000000000000009, 0.52359877559829882 },
{ 0.69864700854177020, 0.10000000000000009, 0.69813170079773179 },
{ 0.87361792586964870, 0.10000000000000009, 0.87266462599716477 },
{ 1.0487386319621683, 0.10000000000000009, 1.0471975511965976 },
{ 1.2239913752078757, 0.10000000000000009, 1.2217304763960306 },
{ 1.3993423113684049, 0.10000000000000009, 1.3962634015954636 },
{ 1.5747455615173562, 0.10000000000000009, 1.5707963267948966 },
};
const double toler011 = 2.5000000000000020e-13;
// Test data for k=0.19999999999999996.
// max(|f - f_GSL|): 4.4408920985006262e-16
// max(|f - f_GSL| / |f_GSL|): 4.2156475739151676e-16
const testcase_ellint_1<double>
data012[10] =
{
{ 0.0000000000000000, 0.19999999999999996, 0.0000000000000000 },
{ 0.17456817290292809, 0.19999999999999996, 0.17453292519943295 },
{ 0.34934315932086801, 0.19999999999999996, 0.34906585039886590 },
{ 0.52450880529443988, 0.19999999999999996, 0.52359877559829882 },
{ 0.70020491009844876, 0.19999999999999996, 0.69813170079773179 },
{ 0.87651006649967955, 0.19999999999999996, 0.87266462599716477 },
{ 1.0534305870298994, 0.19999999999999996, 1.0471975511965976 },
{ 1.2308975521670784, 0.19999999999999996, 1.2217304763960306 },
{ 1.4087733584990738, 0.19999999999999996, 1.3962634015954636 },
{ 1.5868678474541660, 0.19999999999999996, 1.5707963267948966 },
};
const double toler012 = 2.5000000000000020e-13;
// Test data for k=0.30000000000000004.
// max(|f - f_GSL|): 8.8817841970012523e-16
// max(|f - f_GSL| / |f_GSL|): 6.3361874537309281e-16
const testcase_ellint_1<double>
data013[10] =
{
{ 0.0000000000000000, 0.30000000000000004, 0.0000000000000000 },
{ 0.17461228653000099, 0.30000000000000004, 0.17453292519943295 },
{ 0.34969146102798415, 0.30000000000000004, 0.34906585039886590 },
{ 0.52565822873726320, 0.30000000000000004, 0.52359877559829882 },
{ 0.70284226512408532, 0.30000000000000004, 0.69813170079773179 },
{ 0.88144139195111182, 0.30000000000000004, 0.87266462599716477 },
{ 1.0614897067260520, 0.30000000000000004, 1.0471975511965976 },
{ 1.2428416824174218, 0.30000000000000004, 1.2217304763960306 },
{ 1.4251795877015927, 0.30000000000000004, 1.3962634015954636 },
{ 1.6080486199305128, 0.30000000000000004, 1.5707963267948966 },
};
const double toler013 = 2.5000000000000020e-13;
// Test data for k=0.39999999999999991.
// max(|f - f_GSL|): 8.8817841970012523e-16
// max(|f - f_GSL| / |f_GSL|): 5.4157225142938039e-16
const testcase_ellint_1<double>
data014[10] =
{
{ 0.0000000000000000, 0.39999999999999991, 0.0000000000000000 },
{ 0.17467414669441528, 0.39999999999999991, 0.17453292519943295 },
{ 0.35018222772483443, 0.39999999999999991, 0.34906585039886590 },
{ 0.52729015917508737, 0.39999999999999991, 0.52359877559829882 },
{ 0.70662374407341244, 0.39999999999999991, 0.69813170079773179 },
{ 0.88859210497602170, 0.39999999999999991, 0.87266462599716477 },
{ 1.0733136290471379, 0.39999999999999991, 1.0471975511965976 },
{ 1.2605612170157061, 0.39999999999999991, 1.2217304763960306 },
{ 1.4497513956433439, 0.39999999999999991, 1.3962634015954636 },
{ 1.6399998658645112, 0.39999999999999991, 1.5707963267948966 },
};
const double toler014 = 2.5000000000000020e-13;
// Test data for k=0.50000000000000000.
// max(|f - f_GSL|): 2.2204460492503131e-16
// max(|f - f_GSL| / |f_GSL|): 3.1201497220602069e-16
const testcase_ellint_1<double>
data015[10] =
{
{ 0.0000000000000000, 0.50000000000000000, 0.0000000000000000 },
{ 0.17475385514035785, 0.50000000000000000, 0.17453292519943295 },
{ 0.35081868470101585, 0.50000000000000000, 0.34906585039886590 },
{ 0.52942862705190574, 0.50000000000000000, 0.52359877559829882 },
{ 0.71164727562630314, 0.50000000000000000, 0.69813170079773179 },
{ 0.89824523594227768, 0.50000000000000000, 0.87266462599716477 },
{ 1.0895506700518851, 0.50000000000000000, 1.0471975511965976 },
{ 1.2853005857432931, 0.50000000000000000, 1.2217304763960306 },
{ 1.4845545520549484, 0.50000000000000000, 1.3962634015954636 },
{ 1.6857503548125963, 0.50000000000000000, 1.5707963267948966 },
};
const double toler015 = 2.5000000000000020e-13;
// Test data for k=0.60000000000000009.
// max(|f - f_GSL|): 4.4408920985006262e-16
// max(|f - f_GSL| / |f_GSL|): 3.3664899092028927e-16
const testcase_ellint_1<double>
data016[10] =
{
{ 0.0000000000000000, 0.60000000000000009, 0.0000000000000000 },
{ 0.17485154362988359, 0.60000000000000009, 0.17453292519943295 },
{ 0.35160509865544326, 0.60000000000000009, 0.34906585039886590 },
{ 0.53210652578446138, 0.60000000000000009, 0.52359877559829882 },
{ 0.71805304664485659, 0.60000000000000009, 0.69813170079773179 },
{ 0.91082759030195970, 0.60000000000000009, 0.87266462599716477 },
{ 1.1112333229323361, 0.60000000000000009, 1.0471975511965976 },
{ 1.3191461190365270, 0.60000000000000009, 1.2217304763960306 },
{ 1.5332022105084775, 0.60000000000000009, 1.3962634015954636 },
{ 1.7507538029157526, 0.60000000000000009, 1.5707963267948966 },
};
const double toler016 = 2.5000000000000020e-13;
// Test data for k=0.69999999999999996.
// max(|f - f_GSL|): 3.3306690738754696e-16
// max(|f - f_GSL| / |f_GSL|): 3.5930208052157665e-16
const testcase_ellint_1<double>
data017[10] =
{
{ 0.0000000000000000, 0.69999999999999996, 0.0000000000000000 },
{ 0.17496737466916723, 0.69999999999999996, 0.17453292519943295 },
{ 0.35254687535677925, 0.69999999999999996, 0.34906585039886590 },
{ 0.53536740275997119, 0.69999999999999996, 0.52359877559829882 },
{ 0.72603797651684454, 0.69999999999999996, 0.69813170079773179 },
{ 0.92698296348313458, 0.69999999999999996, 0.87266462599716477 },
{ 1.1400447527693316, 0.69999999999999996, 1.0471975511965976 },
{ 1.3657668117194073, 0.69999999999999996, 1.2217304763960306 },
{ 1.6024686895959159, 0.69999999999999996, 1.3962634015954636 },
{ 1.8456939983747236, 0.69999999999999996, 1.5707963267948966 },
};
const double toler017 = 2.5000000000000020e-13;
// Test data for k=0.80000000000000004.
// max(|f - f_GSL|): 4.4408920985006262e-16
// max(|f - f_GSL| / |f_GSL|): 4.1175183168766718e-16
const testcase_ellint_1<double>
data018[10] =
{
{ 0.0000000000000000, 0.80000000000000004, 0.0000000000000000 },
{ 0.17510154241338899, 0.80000000000000004, 0.17453292519943295 },
{ 0.35365068839779390, 0.80000000000000004, 0.34906585039886590 },
{ 0.53926804409084550, 0.80000000000000004, 0.52359877559829882 },
{ 0.73587926028070361, 0.80000000000000004, 0.69813170079773179 },
{ 0.94770942970071170, 0.80000000000000004, 0.87266462599716477 },
{ 1.1789022995388236, 0.80000000000000004, 1.0471975511965976 },
{ 1.4323027881876009, 0.80000000000000004, 1.2217304763960306 },
{ 1.7069629739121674, 0.80000000000000004, 1.3962634015954636 },
{ 1.9953027776647296, 0.80000000000000004, 1.5707963267948966 },
};
const double toler018 = 2.5000000000000020e-13;
// Test data for k=0.89999999999999991.
// max(|f - f_GSL|): 8.8817841970012523e-16
// max(|f - f_GSL| / |f_GSL|): 3.8945813740035884e-16
const testcase_ellint_1<double>
data019[10] =
{
{ 0.0000000000000000, 0.89999999999999991, 0.0000000000000000 },
{ 0.17525427376115024, 0.89999999999999991, 0.17453292519943295 },
{ 0.35492464591297446, 0.89999999999999991, 0.34906585039886590 },
{ 0.54388221416157112, 0.89999999999999991, 0.52359877559829882 },
{ 0.74797400423532490, 0.89999999999999991, 0.69813170079773179 },
{ 0.97463898451966458, 0.89999999999999991, 0.87266462599716477 },
{ 1.2334463254523440, 0.89999999999999991, 1.0471975511965976 },
{ 1.5355247765594910, 0.89999999999999991, 1.2217304763960306 },
{ 1.8882928567775117, 0.89999999999999991, 1.3962634015954636 },
{ 2.2805491384227703, 0.89999999999999991, 1.5707963267948966 },
};
const double toler019 = 2.5000000000000020e-13;
template<typename Tp, unsigned int Num>
void
test(const testcase_ellint_1<Tp> (&data)[Num], Tp toler)
{
bool test __attribute__((unused)) = true;
const Tp eps = std::numeric_limits<Tp>::epsilon();
Tp max_abs_diff = -Tp(1);
Tp max_abs_frac = -Tp(1);
unsigned int num_datum = Num;
for (unsigned int i = 0; i < num_datum; ++i)
{
const Tp f = std::ellint_1(data[i].k, data[i].phi);
const Tp f0 = data[i].f0;
const Tp diff = f - f0;
if (std::abs(diff) > max_abs_diff)
max_abs_diff = std::abs(diff);
if (std::abs(f0) > Tp(10) * eps
&& std::abs(f) > Tp(10) * eps)
{
const Tp frac = diff / f0;
if (std::abs(frac) > max_abs_frac)
max_abs_frac = std::abs(frac);
}
}
VERIFY(max_abs_frac < toler);
}
int
main()
{
test(data001, toler001);
test(data002, toler002);
test(data003, toler003);
test(data004, toler004);
test(data005, toler005);
test(data006, toler006);
test(data007, toler007);
test(data008, toler008);
test(data009, toler009);
test(data010, toler010);
test(data011, toler011);
test(data012, toler012);
test(data013, toler013);
test(data014, toler014);
test(data015, toler015);
test(data016, toler016);
test(data017, toler017);
test(data018, toler018);
test(data019, toler019);
return 0;
}

View File

@ -0,0 +1,40 @@
// { dg-do compile }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.11 ellint_1
#include <cmath>
void
test01()
{
float kf = 0.5F, phif = std::atan2(1.0F, 1.0F);
double kd = 0.5, phid = std::atan2(1.0, 1.0);
long double kl = 0.5L, phil = std::atan2(1.0L, 1.0L);
std::ellint_1(kf, phif);
std::ellint_1f(kf, phif);
std::ellint_1(kd, phid);
std::ellint_1(kl, phil);
std::ellint_1l(kl, phil);
return;
}

View File

@ -0,0 +1,41 @@
// { dg-do compile { xfail *-*-* } }
// { dg-excess-errors "" }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.11 ellint_1
#include <math.h>
void
test01()
{
float kf = 0.5F, phif = atan2(1.0F, 1.0F);
double kd = 0.5, phid = atan2(1.0, 1.0);
long double kl = 0.5L, phil = atan2(1.0L, 1.0L);
ellint_1(kf, phif);
ellint_1f(kf, phif);
ellint_1(kd, phid);
ellint_1(kl, phil);
ellint_1l(kl, phil);
return;
}

View File

@ -0,0 +1,88 @@
// { dg-require-c-std "" }
// { dg-add-options ieee }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.12 ellint_2
#include <cmath>
#include <testsuite_hooks.h>
void
test01()
{
float kf = std::numeric_limits<float>::quiet_NaN();
double kd = std::numeric_limits<double>::quiet_NaN();
long double kl = std::numeric_limits<long double>::quiet_NaN();
float phif = std::atan2(1.0F, 1.0F);
double phid = std::atan2(1.0, 1.0);
long double phil = std::atan2(1.0L, 1.0L);
float a = std::ellint_2(kf, phif);
float b = std::ellint_2f(kf, phif);
double c = std::ellint_2(kd, phid);
long double d = std::ellint_2(kl, phil);
long double e = std::ellint_2l(kl, phil);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
void
test02()
{
float kf = 0.5F;
double kd = 0.5;
long double kl = 0.5L;
float phif = std::numeric_limits<float>::quiet_NaN();
double phid = std::numeric_limits<double>::quiet_NaN();
long double phil = std::numeric_limits<long double>::quiet_NaN();
float a = std::ellint_2(kf, phif);
float b = std::ellint_2f(kf, phif);
double c = std::ellint_2(kd, phid);
long double d = std::ellint_2(kl, phil);
long double e = std::ellint_2l(kl, phil);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
int
main()
{
test01();
test02();
return 0;
}

View File

@ -0,0 +1,451 @@
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
//
// Copyright (C) 2016 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/>.
// ellint_2
// Compare against values generated by the GNU Scientific Library.
// The GSL can be found on the web: http://www.gnu.org/software/gsl/
#include <limits>
#include <cmath>
#if defined(__TEST_DEBUG)
# include <iostream>
# define VERIFY(A) \
if (!(A)) \
{ \
std::cout << "line " << __LINE__ \
<< " max_abs_frac = " << max_abs_frac \
<< std::endl; \
}
#else
# include <testsuite_hooks.h>
#endif
#include <specfun_testcase.h>
// Test data for k=-0.90000000000000002.
// max(|f - f_GSL|): 6.6613381477509392e-16
// max(|f - f_GSL| / |f_GSL|): 6.6116483711056737e-16
const testcase_ellint_2<double>
data001[10] =
{
{ 0.0000000000000000, -0.90000000000000002, 0.0000000000000000 },
{ 0.17381690606167960, -0.90000000000000002, 0.17453292519943295 },
{ 0.34337919186972055, -0.90000000000000002, 0.34906585039886590 },
{ 0.50464268659856326, -0.90000000000000002, 0.52359877559829882 },
{ 0.65400003842368570, -0.90000000000000002, 0.69813170079773179 },
{ 0.78854928419904646, -0.90000000000000002, 0.87266462599716477 },
{ 0.90645698626315396, -0.90000000000000002, 1.0471975511965976 },
{ 1.0075154899135925, -0.90000000000000002, 1.2217304763960306 },
{ 1.0940135583194068, -0.90000000000000002, 1.3962634015954636 },
{ 1.1716970527816140, -0.90000000000000002, 1.5707963267948966 },
};
const double toler001 = 2.5000000000000020e-13;
// Test data for k=-0.80000000000000004.
// max(|f - f_GSL|): 4.4408920985006262e-16
// max(|f - f_GSL| / |f_GSL|): 3.4793687438660849e-16
const testcase_ellint_2<double>
data002[10] =
{
{ 0.0000000000000000, -0.80000000000000004, 0.0000000000000000 },
{ 0.17396762274534805, -0.80000000000000004, 0.17453292519943295 },
{ 0.34458685226969316, -0.80000000000000004, 0.34906585039886590 },
{ 0.50872923654502433, -0.80000000000000004, 0.52359877559829882 },
{ 0.66372016539176215, -0.80000000000000004, 0.69813170079773179 },
{ 0.80760344410167406, -0.80000000000000004, 0.87266462599716477 },
{ 0.93945480372495049, -0.80000000000000004, 1.0471975511965976 },
{ 1.0597473310395036, -0.80000000000000004, 1.2217304763960306 },
{ 1.1706981862452361, -0.80000000000000004, 1.3962634015954636 },
{ 1.2763499431699064, -0.80000000000000004, 1.5707963267948966 },
};
const double toler002 = 2.5000000000000020e-13;
// Test data for k=-0.69999999999999996.
// max(|f - f_GSL|): 3.3306690738754696e-16
// max(|f - f_GSL| / |f_GSL|): 4.0435005012914979e-16
const testcase_ellint_2<double>
data003[10] =
{
{ 0.0000000000000000, -0.69999999999999996, 0.0000000000000000 },
{ 0.17410041242702542, -0.69999999999999996, 0.17453292519943295 },
{ 0.34564605085764760, -0.69999999999999996, 0.34906585039886590 },
{ 0.51228495693314646, -0.69999999999999996, 0.52359877559829882 },
{ 0.67207654098799530, -0.69999999999999996, 0.69813170079773179 },
{ 0.82370932631556515, -0.69999999999999996, 0.87266462599716477 },
{ 0.96672313309452795, -0.69999999999999996, 1.0471975511965976 },
{ 1.1017090644949503, -0.69999999999999996, 1.2217304763960306 },
{ 1.2304180097292914, -0.69999999999999996, 1.3962634015954636 },
{ 1.3556611355719554, -0.69999999999999996, 1.5707963267948966 },
};
const double toler003 = 2.5000000000000020e-13;
// Test data for k=-0.59999999999999998.
// max(|f - f_GSL|): 4.4408920985006262e-16
// max(|f - f_GSL| / |f_GSL|): 3.9101039108874066e-16
const testcase_ellint_2<double>
data004[10] =
{
{ 0.0000000000000000, -0.59999999999999998, 0.0000000000000000 },
{ 0.17421534919599127, -0.59999999999999998, 0.17453292519943295 },
{ 0.34655927787174101, -0.59999999999999998, 0.34906585039886590 },
{ 0.51533034538432143, -0.59999999999999998, 0.52359877559829882 },
{ 0.67916550597453018, -0.59999999999999998, 0.69813170079773179 },
{ 0.83720218180349870, -0.59999999999999998, 0.87266462599716477 },
{ 0.98922159354937755, -0.59999999999999998, 1.0471975511965976 },
{ 1.1357478470419360, -0.59999999999999998, 1.2217304763960306 },
{ 1.2780617372844056, -0.59999999999999998, 1.3962634015954636 },
{ 1.4180833944487241, -0.59999999999999998, 1.5707963267948966 },
};
const double toler004 = 2.5000000000000020e-13;
// Test data for k=-0.50000000000000000.
// max(|f - f_GSL|): 2.2204460492503131e-16
// max(|f - f_GSL| / |f_GSL|): 3.2412420886495652e-16
const testcase_ellint_2<double>
data005[10] =
{
{ 0.0000000000000000, -0.50000000000000000, 0.0000000000000000 },
{ 0.17431249677315910, -0.50000000000000000, 0.17453292519943295 },
{ 0.34732862537770803, -0.50000000000000000, 0.34906585039886590 },
{ 0.51788193485993794, -0.50000000000000000, 0.52359877559829882 },
{ 0.68506022954164536, -0.50000000000000000, 0.69813170079773179 },
{ 0.84831662803347196, -0.50000000000000000, 0.87266462599716477 },
{ 1.0075555551444717, -0.50000000000000000, 1.0471975511965976 },
{ 1.1631768599287300, -0.50000000000000000, 1.2217304763960306 },
{ 1.3160584048772543, -0.50000000000000000, 1.3962634015954636 },
{ 1.4674622093394274, -0.50000000000000000, 1.5707963267948966 },
};
const double toler005 = 2.5000000000000020e-13;
// Test data for k=-0.40000000000000002.
// max(|f - f_GSL|): 6.6613381477509392e-16
// max(|f - f_GSL| / |f_GSL|): 5.6222658248988364e-16
const testcase_ellint_2<double>
data006[10] =
{
{ 0.0000000000000000, -0.40000000000000002, 0.0000000000000000 },
{ 0.17439190872481267, -0.40000000000000002, 0.17453292519943295 },
{ 0.34795581767099210, -0.40000000000000002, 0.34906585039886590 },
{ 0.51995290683804463, -0.40000000000000002, 0.52359877559829882 },
{ 0.68981638464431538, -0.40000000000000002, 0.69813170079773179 },
{ 0.85722088859936041, -0.40000000000000002, 0.87266462599716477 },
{ 1.0221301327876993, -0.40000000000000002, 1.0471975511965976 },
{ 1.1848138019818371, -0.40000000000000002, 1.2217304763960306 },
{ 1.3458259266501533, -0.40000000000000002, 1.3962634015954636 },
{ 1.5059416123600402, -0.40000000000000002, 1.5707963267948966 },
};
const double toler006 = 2.5000000000000020e-13;
// Test data for k=-0.30000000000000004.
// max(|f - f_GSL|): 8.8817841970012523e-16
// max(|f - f_GSL| / |f_GSL|): 6.3860540218057383e-16
const testcase_ellint_2<double>
data007[10] =
{
{ 0.0000000000000000, -0.30000000000000004, 0.0000000000000000 },
{ 0.17445362864048913, -0.30000000000000004, 0.17453292519943295 },
{ 0.34844223535713464, -0.30000000000000004, 0.34906585039886590 },
{ 0.52155353877411770, -0.30000000000000004, 0.52359877559829882 },
{ 0.69347584418369879, -0.30000000000000004, 0.69813170079773179 },
{ 0.86403609928237668, -0.30000000000000004, 0.87266462599716477 },
{ 1.0332234514065408, -0.30000000000000004, 1.0471975511965976 },
{ 1.2011943182068923, -0.30000000000000004, 1.2217304763960306 },
{ 1.3682566113689623, -0.30000000000000004, 1.3962634015954636 },
{ 1.5348334649232491, -0.30000000000000004, 1.5707963267948966 },
};
const double toler007 = 2.5000000000000020e-13;
// Test data for k=-0.19999999999999996.
// max(|f - f_GSL|): 4.4408920985006262e-16
// max(|f - f_GSL| / |f_GSL|): 4.2658819988515356e-16
const testcase_ellint_2<double>
data008[10] =
{
{ 0.0000000000000000, -0.19999999999999996, 0.0000000000000000 },
{ 0.17449769027652812, -0.19999999999999996, 0.17453292519943295 },
{ 0.34878893400762095, -0.19999999999999996, 0.34906585039886590 },
{ 0.52269152856057410, -0.19999999999999996, 0.52359877559829882 },
{ 0.69606913360157563, -0.19999999999999996, 0.69813170079773179 },
{ 0.86884782374863356, -0.19999999999999996, 0.87266462599716477 },
{ 1.0410255369689567, -0.19999999999999996, 1.0471975511965976 },
{ 1.2126730391631360, -0.19999999999999996, 1.2217304763960306 },
{ 1.3839259540325153, -0.19999999999999996, 1.3962634015954636 },
{ 1.5549685462425291, -0.19999999999999996, 1.5707963267948966 },
};
const double toler008 = 2.5000000000000020e-13;
// Test data for k=-0.099999999999999978.
// max(|f - f_GSL|): 4.4408920985006262e-16
// max(|f - f_GSL| / |f_GSL|): 3.1875595485348029e-16
const testcase_ellint_2<double>
data009[10] =
{
{ 0.0000000000000000, -0.099999999999999978, 0.0000000000000000 },
{ 0.17452411766649939, -0.099999999999999978, 0.17453292519943295 },
{ 0.34899665805442404, -0.099999999999999978, 0.34906585039886590 },
{ 0.52337222400508776, -0.099999999999999978, 0.52359877559829882 },
{ 0.69761705217284864, -0.099999999999999978, 0.69813170079773179 },
{ 0.87171309273007491, -0.099999999999999978, 0.87266462599716477 },
{ 1.0456602197056326, -0.099999999999999978, 1.0471975511965976 },
{ 1.2194762899272025, -0.099999999999999978, 1.2217304763960306 },
{ 1.3931950229892744, -0.099999999999999978, 1.3962634015954636 },
{ 1.5668619420216685, -0.099999999999999978, 1.5707963267948966 },
};
const double toler009 = 2.5000000000000020e-13;
// Test data for k=0.0000000000000000.
// max(|f - f_GSL|): 2.2204460492503131e-16
// max(|f - f_GSL| / |f_GSL|): 2.1203697876423452e-16
const testcase_ellint_2<double>
data010[10] =
{
{ 0.0000000000000000, 0.0000000000000000, 0.0000000000000000 },
{ 0.17453292519943292, 0.0000000000000000, 0.17453292519943295 },
{ 0.34906585039886584, 0.0000000000000000, 0.34906585039886590 },
{ 0.52359877559829870, 0.0000000000000000, 0.52359877559829882 },
{ 0.69813170079773168, 0.0000000000000000, 0.69813170079773179 },
{ 0.87266462599716477, 0.0000000000000000, 0.87266462599716477 },
{ 1.0471975511965974, 0.0000000000000000, 1.0471975511965976 },
{ 1.2217304763960304, 0.0000000000000000, 1.2217304763960306 },
{ 1.3962634015954631, 0.0000000000000000, 1.3962634015954636 },
{ 1.5707963267948966, 0.0000000000000000, 1.5707963267948966 },
};
const double toler010 = 2.5000000000000020e-13;
// Test data for k=0.10000000000000009.
// max(|f - f_GSL|): 4.4408920985006262e-16
// max(|f - f_GSL| / |f_GSL|): 3.1875595485348029e-16
const testcase_ellint_2<double>
data011[10] =
{
{ 0.0000000000000000, 0.10000000000000009, 0.0000000000000000 },
{ 0.17452411766649939, 0.10000000000000009, 0.17453292519943295 },
{ 0.34899665805442404, 0.10000000000000009, 0.34906585039886590 },
{ 0.52337222400508776, 0.10000000000000009, 0.52359877559829882 },
{ 0.69761705217284864, 0.10000000000000009, 0.69813170079773179 },
{ 0.87171309273007491, 0.10000000000000009, 0.87266462599716477 },
{ 1.0456602197056326, 0.10000000000000009, 1.0471975511965976 },
{ 1.2194762899272025, 0.10000000000000009, 1.2217304763960306 },
{ 1.3931950229892744, 0.10000000000000009, 1.3962634015954636 },
{ 1.5668619420216685, 0.10000000000000009, 1.5707963267948966 },
};
const double toler011 = 2.5000000000000020e-13;
// Test data for k=0.19999999999999996.
// max(|f - f_GSL|): 4.4408920985006262e-16
// max(|f - f_GSL| / |f_GSL|): 4.2658819988515356e-16
const testcase_ellint_2<double>
data012[10] =
{
{ 0.0000000000000000, 0.19999999999999996, 0.0000000000000000 },
{ 0.17449769027652812, 0.19999999999999996, 0.17453292519943295 },
{ 0.34878893400762095, 0.19999999999999996, 0.34906585039886590 },
{ 0.52269152856057410, 0.19999999999999996, 0.52359877559829882 },
{ 0.69606913360157563, 0.19999999999999996, 0.69813170079773179 },
{ 0.86884782374863356, 0.19999999999999996, 0.87266462599716477 },
{ 1.0410255369689567, 0.19999999999999996, 1.0471975511965976 },
{ 1.2126730391631360, 0.19999999999999996, 1.2217304763960306 },
{ 1.3839259540325153, 0.19999999999999996, 1.3962634015954636 },
{ 1.5549685462425291, 0.19999999999999996, 1.5707963267948966 },
};
const double toler012 = 2.5000000000000020e-13;
// Test data for k=0.30000000000000004.
// max(|f - f_GSL|): 8.8817841970012523e-16
// max(|f - f_GSL| / |f_GSL|): 6.3860540218057383e-16
const testcase_ellint_2<double>
data013[10] =
{
{ 0.0000000000000000, 0.30000000000000004, 0.0000000000000000 },
{ 0.17445362864048913, 0.30000000000000004, 0.17453292519943295 },
{ 0.34844223535713464, 0.30000000000000004, 0.34906585039886590 },
{ 0.52155353877411770, 0.30000000000000004, 0.52359877559829882 },
{ 0.69347584418369879, 0.30000000000000004, 0.69813170079773179 },
{ 0.86403609928237668, 0.30000000000000004, 0.87266462599716477 },
{ 1.0332234514065408, 0.30000000000000004, 1.0471975511965976 },
{ 1.2011943182068923, 0.30000000000000004, 1.2217304763960306 },
{ 1.3682566113689623, 0.30000000000000004, 1.3962634015954636 },
{ 1.5348334649232491, 0.30000000000000004, 1.5707963267948966 },
};
const double toler013 = 2.5000000000000020e-13;
// Test data for k=0.39999999999999991.
// max(|f - f_GSL|): 8.8817841970012523e-16
// max(|f - f_GSL| / |f_GSL|): 5.8978277272530773e-16
const testcase_ellint_2<double>
data014[10] =
{
{ 0.0000000000000000, 0.39999999999999991, 0.0000000000000000 },
{ 0.17439190872481267, 0.39999999999999991, 0.17453292519943295 },
{ 0.34795581767099210, 0.39999999999999991, 0.34906585039886590 },
{ 0.51995290683804463, 0.39999999999999991, 0.52359877559829882 },
{ 0.68981638464431538, 0.39999999999999991, 0.69813170079773179 },
{ 0.85722088859936041, 0.39999999999999991, 0.87266462599716477 },
{ 1.0221301327876993, 0.39999999999999991, 1.0471975511965976 },
{ 1.1848138019818373, 0.39999999999999991, 1.2217304763960306 },
{ 1.3458259266501533, 0.39999999999999991, 1.3962634015954636 },
{ 1.5059416123600404, 0.39999999999999991, 1.5707963267948966 },
};
const double toler014 = 2.5000000000000020e-13;
// Test data for k=0.50000000000000000.
// max(|f - f_GSL|): 2.2204460492503131e-16
// max(|f - f_GSL| / |f_GSL|): 3.2412420886495652e-16
const testcase_ellint_2<double>
data015[10] =
{
{ 0.0000000000000000, 0.50000000000000000, 0.0000000000000000 },
{ 0.17431249677315910, 0.50000000000000000, 0.17453292519943295 },
{ 0.34732862537770803, 0.50000000000000000, 0.34906585039886590 },
{ 0.51788193485993794, 0.50000000000000000, 0.52359877559829882 },
{ 0.68506022954164536, 0.50000000000000000, 0.69813170079773179 },
{ 0.84831662803347196, 0.50000000000000000, 0.87266462599716477 },
{ 1.0075555551444717, 0.50000000000000000, 1.0471975511965976 },
{ 1.1631768599287300, 0.50000000000000000, 1.2217304763960306 },
{ 1.3160584048772543, 0.50000000000000000, 1.3962634015954636 },
{ 1.4674622093394274, 0.50000000000000000, 1.5707963267948966 },
};
const double toler015 = 2.5000000000000020e-13;
// Test data for k=0.60000000000000009.
// max(|f - f_GSL|): 4.4408920985006262e-16
// max(|f - f_GSL| / |f_GSL|): 3.9101039108874066e-16
const testcase_ellint_2<double>
data016[10] =
{
{ 0.0000000000000000, 0.60000000000000009, 0.0000000000000000 },
{ 0.17421534919599127, 0.60000000000000009, 0.17453292519943295 },
{ 0.34655927787174101, 0.60000000000000009, 0.34906585039886590 },
{ 0.51533034538432143, 0.60000000000000009, 0.52359877559829882 },
{ 0.67916550597453018, 0.60000000000000009, 0.69813170079773179 },
{ 0.83720218180349870, 0.60000000000000009, 0.87266462599716477 },
{ 0.98922159354937744, 0.60000000000000009, 1.0471975511965976 },
{ 1.1357478470419360, 0.60000000000000009, 1.2217304763960306 },
{ 1.2780617372844056, 0.60000000000000009, 1.3962634015954636 },
{ 1.4180833944487241, 0.60000000000000009, 1.5707963267948966 },
};
const double toler016 = 2.5000000000000020e-13;
// Test data for k=0.69999999999999996.
// max(|f - f_GSL|): 3.3306690738754696e-16
// max(|f - f_GSL| / |f_GSL|): 4.0435005012914979e-16
const testcase_ellint_2<double>
data017[10] =
{
{ 0.0000000000000000, 0.69999999999999996, 0.0000000000000000 },
{ 0.17410041242702542, 0.69999999999999996, 0.17453292519943295 },
{ 0.34564605085764760, 0.69999999999999996, 0.34906585039886590 },
{ 0.51228495693314646, 0.69999999999999996, 0.52359877559829882 },
{ 0.67207654098799530, 0.69999999999999996, 0.69813170079773179 },
{ 0.82370932631556515, 0.69999999999999996, 0.87266462599716477 },
{ 0.96672313309452795, 0.69999999999999996, 1.0471975511965976 },
{ 1.1017090644949503, 0.69999999999999996, 1.2217304763960306 },
{ 1.2304180097292914, 0.69999999999999996, 1.3962634015954636 },
{ 1.3556611355719554, 0.69999999999999996, 1.5707963267948966 },
};
const double toler017 = 2.5000000000000020e-13;
// Test data for k=0.80000000000000004.
// max(|f - f_GSL|): 4.4408920985006262e-16
// max(|f - f_GSL| / |f_GSL|): 3.4793687438660849e-16
const testcase_ellint_2<double>
data018[10] =
{
{ 0.0000000000000000, 0.80000000000000004, 0.0000000000000000 },
{ 0.17396762274534805, 0.80000000000000004, 0.17453292519943295 },
{ 0.34458685226969316, 0.80000000000000004, 0.34906585039886590 },
{ 0.50872923654502433, 0.80000000000000004, 0.52359877559829882 },
{ 0.66372016539176215, 0.80000000000000004, 0.69813170079773179 },
{ 0.80760344410167406, 0.80000000000000004, 0.87266462599716477 },
{ 0.93945480372495049, 0.80000000000000004, 1.0471975511965976 },
{ 1.0597473310395036, 0.80000000000000004, 1.2217304763960306 },
{ 1.1706981862452361, 0.80000000000000004, 1.3962634015954636 },
{ 1.2763499431699064, 0.80000000000000004, 1.5707963267948966 },
};
const double toler018 = 2.5000000000000020e-13;
// Test data for k=0.89999999999999991.
// max(|f - f_GSL|): 4.4408920985006262e-16
// max(|f - f_GSL| / |f_GSL|): 3.7901367831880493e-16
const testcase_ellint_2<double>
data019[10] =
{
{ 0.0000000000000000, 0.89999999999999991, 0.0000000000000000 },
{ 0.17381690606167960, 0.89999999999999991, 0.17453292519943295 },
{ 0.34337919186972055, 0.89999999999999991, 0.34906585039886590 },
{ 0.50464268659856326, 0.89999999999999991, 0.52359877559829882 },
{ 0.65400003842368570, 0.89999999999999991, 0.69813170079773179 },
{ 0.78854928419904657, 0.89999999999999991, 0.87266462599716477 },
{ 0.90645698626315407, 0.89999999999999991, 1.0471975511965976 },
{ 1.0075154899135930, 0.89999999999999991, 1.2217304763960306 },
{ 1.0940135583194071, 0.89999999999999991, 1.3962634015954636 },
{ 1.1716970527816144, 0.89999999999999991, 1.5707963267948966 },
};
const double toler019 = 2.5000000000000020e-13;
template<typename Tp, unsigned int Num>
void
test(const testcase_ellint_2<Tp> (&data)[Num], Tp toler)
{
bool test __attribute__((unused)) = true;
const Tp eps = std::numeric_limits<Tp>::epsilon();
Tp max_abs_diff = -Tp(1);
Tp max_abs_frac = -Tp(1);
unsigned int num_datum = Num;
for (unsigned int i = 0; i < num_datum; ++i)
{
const Tp f = std::ellint_2(data[i].k, data[i].phi);
const Tp f0 = data[i].f0;
const Tp diff = f - f0;
if (std::abs(diff) > max_abs_diff)
max_abs_diff = std::abs(diff);
if (std::abs(f0) > Tp(10) * eps
&& std::abs(f) > Tp(10) * eps)
{
const Tp frac = diff / f0;
if (std::abs(frac) > max_abs_frac)
max_abs_frac = std::abs(frac);
}
}
VERIFY(max_abs_frac < toler);
}
int
main()
{
test(data001, toler001);
test(data002, toler002);
test(data003, toler003);
test(data004, toler004);
test(data005, toler005);
test(data006, toler006);
test(data007, toler007);
test(data008, toler008);
test(data009, toler009);
test(data010, toler010);
test(data011, toler011);
test(data012, toler012);
test(data013, toler013);
test(data014, toler014);
test(data015, toler015);
test(data016, toler016);
test(data017, toler017);
test(data018, toler018);
test(data019, toler019);
return 0;
}

View File

@ -0,0 +1,40 @@
// { dg-do compile }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.12 ellint_2
#include <cmath>
void
test01()
{
float kf = 0.5F, phif = std::atan2(1.0F, 1.0F);
double kd = 0.5, phid = std::atan2(1.0, 1.0);
long double kl = 0.5L, phil = std::atan2(1.0L, 1.0L);
std::ellint_2(kf, phif);
std::ellint_2f(kf, phif);
std::ellint_2(kd, phid);
std::ellint_2(kl, phil);
std::ellint_2l(kl, phil);
return;
}

View File

@ -0,0 +1,41 @@
// { dg-do compile { xfail *-*-* } }
// { dg-excess-errors "" }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.12 ellint_2
#include <math.h>
void
test01()
{
float kf = 0.5F, phif = atan2(1.0F, 1.0F);
double kd = 0.5, phid = atan2(1.0, 1.0);
long double kl = 0.5L, phil = atan2(1.0L, 1.0L);
ellint_2(kf, phif);
ellint_2f(kf, phif);
ellint_2(kd, phid);
ellint_2(kl, phil);
ellint_2l(kl, phil);
return;
}

View File

@ -0,0 +1,128 @@
// { dg-require-c-std "" }
// { dg-add-options ieee }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.13 ellint_3
#include <cmath>
#include <testsuite_hooks.h>
void
test01()
{
float kf = std::numeric_limits<float>::quiet_NaN();
double kd = std::numeric_limits<double>::quiet_NaN();
long double kl = std::numeric_limits<long double>::quiet_NaN();
float nuf = 0.2F;
double nud = 0.2;
long double nul = 0.2L;
float phif = std::atan2(1.0F, 1.0F);
double phid = std::atan2(1.0, 1.0);
long double phil = std::atan2(1.0L, 1.0L);
float a = std::ellint_3(kf, nuf, phif);
float b = std::ellint_3f(kf, nuf, phif);
double c = std::ellint_3(kd, nud, phid);
long double d = std::ellint_3(kl, nul, phil);
long double e = std::ellint_3l(kl, nul, phil);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
void
test02()
{
float kf = 0.5F;
double kd = 0.5;
long double kl = 0.5L;
float nuf = std::numeric_limits<float>::quiet_NaN();
double nud = std::numeric_limits<double>::quiet_NaN();
long double nul = std::numeric_limits<long double>::quiet_NaN();
float phif = std::atan2(1.0F, 1.0F);
double phid = std::atan2(1.0, 1.0);
long double phil = std::atan2(1.0L, 1.0L);
float a = std::ellint_3(kf, nuf, phif);
float b = std::ellint_3f(kf, nuf, phif);
double c = std::ellint_3(kd, nud, phid);
long double d = std::ellint_3(kl, nul, phil);
long double e = std::ellint_3l(kl, nul, phil);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
void
test03()
{
float kf = 0.5F;
double kd = 0.5;
long double kl = 0.5L;
float nuf = 0.2F;
double nud = 0.2;
long double nul = 0.2L;
float phif = std::numeric_limits<float>::quiet_NaN();
double phid = std::numeric_limits<double>::quiet_NaN();
long double phil = std::numeric_limits<long double>::quiet_NaN();
float a = std::ellint_3(kf, nuf, phif);
float b = std::ellint_3f(kf, nuf, phif);
double c = std::ellint_3(kd, nud, phid);
long double d = std::ellint_3(kl, nul, phil);
long double e = std::ellint_3l(kl, nul, phil);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
int
main()
{
test01();
test02();
test03();
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,40 @@
// { dg-do compile }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.13 ellint_3
#include <cmath>
void
test01()
{
float kf = 0.5F, nuf = 0.2F, phif = std::atan2(1.0F, 1.0F);
double kd = 0.5, nud = 0.2, phid = std::atan2(1.0, 1.0);
long double kl = 0.5L, nul = 0.2L, phil = std::atan2(1.0L, 1.0L);
std::ellint_3(kf, nuf, phif);
std::ellint_3f(kf, nuf, phif);
std::ellint_3(kd, nud, phid);
std::ellint_3(kl, nul, phil);
std::ellint_3l(kl, nul, phil);
return;
}

View File

@ -0,0 +1,41 @@
// { dg-do compile { xfail *-*-* } }
// { dg-excess-errors "" }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.13 ellint_3
#include <math.h>
void
test01()
{
float kf = 0.5F, nuf = 0.2F, phif = atan2(1.0F, 1.0F);
double kd = 0.5, nud = 0.2, phid = atan2(1.0, 1.0);
long double kl = 0.5L, nul = 0.2L, phil = atan2(1.0L, 1.0L);
ellint_3(kf, nuf, phif);
ellint_3f(kf, nuf, phif);
ellint_3(kd, nud, phid);
ellint_3(kl, nul, phil);
ellint_3l(kl, nul, phil);
return;
}

View File

@ -0,0 +1,56 @@
// { dg-require-c-std "" }
// { dg-add-options ieee }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.14 expint
#include <cmath>
#include <testsuite_hooks.h>
void
test01()
{
float xf = std::numeric_limits<float>::quiet_NaN();
double xd = std::numeric_limits<double>::quiet_NaN();
long double xl = std::numeric_limits<long double>::quiet_NaN();
float a = std::expint(xf);
float b = std::expintf(xf);
double c = std::expint(xd);
long double d = std::expint(xl);
long double e = std::expintl(xl);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
int
main()
{
test01();
return 0;
}

View File

@ -0,0 +1,193 @@
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
//
// Copyright (C) 2016 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/>.
// expint
// Compare against values generated by the GNU Scientific Library.
// The GSL can be found on the web: http://www.gnu.org/software/gsl/
#include <limits>
#include <cmath>
#if defined(__TEST_DEBUG)
# include <iostream>
# define VERIFY(A) \
if (!(A)) \
{ \
std::cout << "line " << __LINE__ \
<< " max_abs_frac = " << max_abs_frac \
<< std::endl; \
}
#else
# include <testsuite_hooks.h>
#endif
#include <specfun_testcase.h>
// Test data.
// max(|f - f_GSL|): 4.4408920985006262e-16
// max(|f - f_GSL| / |f_GSL|): 2.0242558374827411e-15
const testcase_expint<double>
data001[50] =
{
{ -3.7832640295504591e-24, -50.000000000000000 },
{ -1.0489811642368024e-23, -49.000000000000000 },
{ -2.9096641904058423e-23, -48.000000000000000 },
{ -8.0741978427258127e-23, -47.000000000000000 },
{ -2.2415317597442998e-22, -46.000000000000000 },
{ -6.2256908094623848e-22, -45.000000000000000 },
{ -1.7299598742816476e-21, -44.000000000000000 },
{ -4.8094965569500181e-21, -43.000000000000000 },
{ -1.3377908810011775e-20, -42.000000000000000 },
{ -3.7231667764599780e-20, -41.000000000000000 },
{ -1.0367732614516570e-19, -40.000000000000000 },
{ -2.8887793015227007e-19, -39.000000000000000 },
{ -8.0541069142907499e-19, -38.000000000000000 },
{ -2.2470206975885714e-18, -37.000000000000000 },
{ -6.2733390097622421e-18, -36.000000000000000 },
{ -1.7527059389947371e-17, -35.000000000000000 },
{ -4.9006761183927874e-17, -34.000000000000000 },
{ -1.3713843484487468e-16, -33.000000000000000 },
{ -3.8409618012250671e-16, -32.000000000000000 },
{ -1.0767670386162383e-15, -31.000000000000000 },
{ -3.0215520106888124e-15, -30.000000000000000 },
{ -8.4877597783535634e-15, -29.000000000000000 },
{ -2.3869415119337330e-14, -28.000000000000000 },
{ -6.7206374352620390e-14, -27.000000000000000 },
{ -1.8946858856749785e-13, -26.000000000000000 },
{ -5.3488997553402167e-13, -25.000000000000000 },
{ -1.5123058939997059e-12, -24.000000000000000 },
{ -4.2826847956656722e-12, -23.000000000000000 },
{ -1.2149378956204371e-11, -22.000000000000000 },
{ -3.4532012671467559e-11, -21.000000000000000 },
{ -9.8355252906498815e-11, -20.000000000000000 },
{ -2.8078290970607954e-10, -19.000000000000000 },
{ -8.0360903448286769e-10, -18.000000000000000 },
{ -2.3064319898216547e-09, -17.000000000000000 },
{ -6.6404872494410427e-09, -16.000000000000000 },
{ -1.9186278921478670e-08, -15.000000000000000 },
{ -5.5656311111451816e-08, -14.000000000000000 },
{ -1.6218662188014328e-07, -13.000000000000000 },
{ -4.7510818246724931e-07, -12.000000000000000 },
{ -1.4003003042474418e-06, -11.000000000000000 },
{ -4.1569689296853246e-06, -10.000000000000000 },
{ -1.2447354178006272e-05, -9.0000000000000000 },
{ -3.7665622843924906e-05, -8.0000000000000000 },
{ -0.00011548173161033820, -7.0000000000000000 },
{ -0.00036008245216265862, -6.0000000000000000 },
{ -0.0011482955912753257, -5.0000000000000000 },
{ -0.0037793524098489058, -4.0000000000000000 },
{ -0.013048381094197037, -3.0000000000000000 },
{ -0.048900510708061125, -2.0000000000000000 },
{ -0.21938393439552029, -1.0000000000000000 },
};
const double toler001 = 2.5000000000000020e-13;
// expint
// Test data.
// max(|f - f_GSL|): 2048.0000000000000
// max(|f - f_GSL| / |f_GSL|): 1.4993769017626171e-15
const testcase_expint<double>
data002[50] =
{
{ 1.8951178163559366, 1.0000000000000000 },
{ 4.9542343560018907, 2.0000000000000000 },
{ 9.9338325706254160, 3.0000000000000000 },
{ 19.630874470056217, 4.0000000000000000 },
{ 40.185275355803178, 5.0000000000000000 },
{ 85.989762142439204, 6.0000000000000000 },
{ 191.50474333550136, 7.0000000000000000 },
{ 440.37989953483833, 8.0000000000000000 },
{ 1037.8782907170896, 9.0000000000000000 },
{ 2492.2289762418782, 10.000000000000000 },
{ 6071.4063740986112, 11.000000000000000 },
{ 14959.532666397528, 12.000000000000000 },
{ 37197.688490689041, 13.000000000000000 },
{ 93192.513633965369, 14.000000000000000 },
{ 234955.85249076830, 15.000000000000000 },
{ 595560.99867083691, 16.000000000000000 },
{ 1516637.8940425171, 17.000000000000000 },
{ 3877904.3305974435, 18.000000000000000 },
{ 9950907.2510468438, 19.000000000000000 },
{ 25615652.664056588, 20.000000000000000 },
{ 66127186.355484925, 21.000000000000000 },
{ 171144671.30036369, 22.000000000000000 },
{ 443966369.83027124, 23.000000000000000 },
{ 1154115391.8491828, 24.000000000000000 },
{ 3005950906.5255494, 25.000000000000000 },
{ 7842940991.8981876, 26.000000000000000 },
{ 20496497119.880810, 27.000000000000000 },
{ 53645118592.314682, 28.000000000000000 },
{ 140599195758.40689, 29.000000000000000 },
{ 368973209407.27417, 30.000000000000000 },
{ 969455575968.39392, 31.000000000000000 },
{ 2550043566357.7871, 32.000000000000000 },
{ 6714640184076.4971, 33.000000000000000 },
{ 17698037244116.266, 34.000000000000000 },
{ 46690550144661.602, 35.000000000000000 },
{ 123285207991209.75, 36.000000000000000 },
{ 325798899867226.50, 37.000000000000000 },
{ 861638819996578.75, 38.000000000000000 },
{ 2280446200301902.5, 39.000000000000000 },
{ 6039718263611242.0, 40.000000000000000 },
{ 16006649143245042., 41.000000000000000 },
{ 42447960921368504., 42.000000000000000 },
{ 1.1263482901669666e+17, 43.000000000000000 },
{ 2.9904447186323366e+17, 44.000000000000000 },
{ 7.9439160357044531e+17, 45.000000000000000 },
{ 2.1113423886478239e+18, 46.000000000000000 },
{ 5.6143296808103424e+18, 47.000000000000000 },
{ 1.4936302131129930e+19, 48.000000000000000 },
{ 3.9754427479037444e+19, 49.000000000000000 },
{ 1.0585636897131690e+20, 50.000000000000000 },
};
const double toler002 = 2.5000000000000020e-13;
template<typename Tp, unsigned int Num>
void
test(const testcase_expint<Tp> (&data)[Num], Tp toler)
{
bool test __attribute__((unused)) = true;
const Tp eps = std::numeric_limits<Tp>::epsilon();
Tp max_abs_diff = -Tp(1);
Tp max_abs_frac = -Tp(1);
unsigned int num_datum = Num;
for (unsigned int i = 0; i < num_datum; ++i)
{
const Tp f = std::expint(data[i].x);
const Tp f0 = data[i].f0;
const Tp diff = f - f0;
if (std::abs(diff) > max_abs_diff)
max_abs_diff = std::abs(diff);
if (std::abs(f0) > Tp(10) * eps
&& std::abs(f) > Tp(10) * eps)
{
const Tp frac = diff / f0;
if (std::abs(frac) > max_abs_frac)
max_abs_frac = std::abs(frac);
}
}
VERIFY(max_abs_frac < toler);
}
int
main()
{
test(data001, toler001);
test(data002, toler002);
return 0;
}

View File

@ -0,0 +1,40 @@
// { dg-do compile }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.14 expint
#include <cmath>
void
test01()
{
float xf = 0.5F;
double xd = 0.5;
long double xl = 0.5L;
std::expint(xf);
std::expintf(xf);
std::expint(xd);
std::expint(xl);
std::expintl(xl);
return;
}

View File

@ -0,0 +1,41 @@
// { dg-do compile { xfail *-*-* } }
// { dg-excess-errors "" }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.14 expint
#include <math.h>
void
test01()
{
float xf = 0.5F;
double xd = 0.5;
long double xl = 0.5L;
expint(xf);
expintf(xf);
expint(xd);
expint(xl);
expintl(xl);
return;
}

View File

@ -0,0 +1,58 @@
// { dg-require-c-std "" }
// { dg-add-options ieee }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.15 hermite
#include <cmath>
#include <testsuite_hooks.h>
void
test01()
{
float xf = std::numeric_limits<float>::quiet_NaN();
double xd = std::numeric_limits<double>::quiet_NaN();
long double xl = std::numeric_limits<long double>::quiet_NaN();
unsigned int n = 5;
float a = std::hermite(n, xf);
float b = std::hermitef(n, xf);
double c = std::hermite(n, xd);
long double d = std::hermite(n, xl);
long double e = std::hermitel(n, xl);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
int
main()
{
test01();
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,42 @@
// { dg-do compile }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.15 hermite
#include <cmath>
void
test01()
{
float xf = 2.5F;
double xd = 2.5;
long double xl = 2.5L;
unsigned int n = 5;
std::hermite(n, xf);
std::hermitef(n, xf);
std::hermite(n, xd);
std::hermite(n, xl);
std::hermitel(n, xl);
return;
}

View File

@ -0,0 +1,42 @@
// { dg-do compile { xfail *-*-* } }
// { dg-excess-errors "" }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.15 hermite
#include <math.h>
void
test01()
{
float xf = 2.5F;
double xd = 2.5;
long double xl = 2.5L;
unsigned int n = 5;
hermite(n, xf);
hermitef(n, xf);
hermite(n, xd);
hermite(n, xl);
hermitel(n, xl);
return;
}

View File

@ -0,0 +1,58 @@
// { dg-require-c-std "" }
// { dg-add-options ieee }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.16 laguerre
#include <cmath>
#include <testsuite_hooks.h>
void
test01()
{
float xf = std::numeric_limits<float>::quiet_NaN();
double xd = std::numeric_limits<double>::quiet_NaN();
long double xl = std::numeric_limits<long double>::quiet_NaN();
unsigned int n = 2;
float a = std::laguerre(n, xf);
float b = std::laguerref(n, xf);
double c = std::laguerre(n, xd);
long double d = std::laguerre(n, xl);
long double e = std::laguerrel(n, xl);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
int
main()
{
test01();
return 0;
}

View File

@ -0,0 +1,319 @@
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
//
// Copyright (C) 2016 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/>.
// laguerre
// Compare against values generated by the GNU Scientific Library.
// The GSL can be found on the web: http://www.gnu.org/software/gsl/
#include <limits>
#include <cmath>
#if defined(__TEST_DEBUG)
# include <iostream>
# define VERIFY(A) \
if (!(A)) \
{ \
std::cout << "line " << __LINE__ \
<< " max_abs_frac = " << max_abs_frac \
<< std::endl; \
}
#else
# include <testsuite_hooks.h>
#endif
#include <specfun_testcase.h>
// Test data for n=0.
// max(|f - f_GSL|): 0.0000000000000000
// max(|f - f_GSL| / |f_GSL|): 0.0000000000000000
const testcase_laguerre<double>
data001[21] =
{
{ 1.0000000000000000, 0, 0.0000000000000000 },
{ 1.0000000000000000, 0, 5.0000000000000000 },
{ 1.0000000000000000, 0, 10.000000000000000 },
{ 1.0000000000000000, 0, 15.000000000000000 },
{ 1.0000000000000000, 0, 20.000000000000000 },
{ 1.0000000000000000, 0, 25.000000000000000 },
{ 1.0000000000000000, 0, 30.000000000000000 },
{ 1.0000000000000000, 0, 35.000000000000000 },
{ 1.0000000000000000, 0, 40.000000000000000 },
{ 1.0000000000000000, 0, 45.000000000000000 },
{ 1.0000000000000000, 0, 50.000000000000000 },
{ 1.0000000000000000, 0, 55.000000000000000 },
{ 1.0000000000000000, 0, 60.000000000000000 },
{ 1.0000000000000000, 0, 65.000000000000000 },
{ 1.0000000000000000, 0, 70.000000000000000 },
{ 1.0000000000000000, 0, 75.000000000000000 },
{ 1.0000000000000000, 0, 80.000000000000000 },
{ 1.0000000000000000, 0, 85.000000000000000 },
{ 1.0000000000000000, 0, 90.000000000000000 },
{ 1.0000000000000000, 0, 95.000000000000000 },
{ 1.0000000000000000, 0, 100.00000000000000 },
};
const double toler001 = 2.5000000000000020e-13;
// Test data for n=1.
// max(|f - f_GSL|): 0.0000000000000000
// max(|f - f_GSL| / |f_GSL|): 0.0000000000000000
const testcase_laguerre<double>
data002[21] =
{
{ 1.0000000000000000, 1, 0.0000000000000000 },
{ -4.0000000000000000, 1, 5.0000000000000000 },
{ -9.0000000000000000, 1, 10.000000000000000 },
{ -14.000000000000000, 1, 15.000000000000000 },
{ -19.000000000000000, 1, 20.000000000000000 },
{ -24.000000000000000, 1, 25.000000000000000 },
{ -29.000000000000000, 1, 30.000000000000000 },
{ -34.000000000000000, 1, 35.000000000000000 },
{ -39.000000000000000, 1, 40.000000000000000 },
{ -44.000000000000000, 1, 45.000000000000000 },
{ -49.000000000000000, 1, 50.000000000000000 },
{ -54.000000000000000, 1, 55.000000000000000 },
{ -59.000000000000000, 1, 60.000000000000000 },
{ -64.000000000000000, 1, 65.000000000000000 },
{ -69.000000000000000, 1, 70.000000000000000 },
{ -74.000000000000000, 1, 75.000000000000000 },
{ -79.000000000000000, 1, 80.000000000000000 },
{ -84.000000000000000, 1, 85.000000000000000 },
{ -89.000000000000000, 1, 90.000000000000000 },
{ -94.000000000000000, 1, 95.000000000000000 },
{ -99.000000000000000, 1, 100.00000000000000 },
};
const double toler002 = 2.5000000000000020e-13;
// Test data for n=2.
// max(|f - f_GSL|): 0.0000000000000000
// max(|f - f_GSL| / |f_GSL|): 0.0000000000000000
const testcase_laguerre<double>
data003[21] =
{
{ 1.0000000000000000, 2, 0.0000000000000000 },
{ 3.5000000000000000, 2, 5.0000000000000000 },
{ 31.000000000000000, 2, 10.000000000000000 },
{ 83.500000000000000, 2, 15.000000000000000 },
{ 161.00000000000000, 2, 20.000000000000000 },
{ 263.50000000000000, 2, 25.000000000000000 },
{ 391.00000000000000, 2, 30.000000000000000 },
{ 543.50000000000000, 2, 35.000000000000000 },
{ 721.00000000000000, 2, 40.000000000000000 },
{ 923.50000000000000, 2, 45.000000000000000 },
{ 1151.0000000000000, 2, 50.000000000000000 },
{ 1403.5000000000000, 2, 55.000000000000000 },
{ 1681.0000000000000, 2, 60.000000000000000 },
{ 1983.5000000000000, 2, 65.000000000000000 },
{ 2311.0000000000000, 2, 70.000000000000000 },
{ 2663.5000000000000, 2, 75.000000000000000 },
{ 3041.0000000000000, 2, 80.000000000000000 },
{ 3443.5000000000000, 2, 85.000000000000000 },
{ 3871.0000000000000, 2, 90.000000000000000 },
{ 4323.5000000000000, 2, 95.000000000000000 },
{ 4801.0000000000000, 2, 100.00000000000000 },
};
const double toler003 = 2.5000000000000020e-13;
// Test data for n=5.
// max(|f - f_GSL|): 7.4505805969238281e-09
// max(|f - f_GSL| / |f_GSL|): 1.9501553136894460e-16
const testcase_laguerre<double>
data004[21] =
{
{ 1.0000000000000000, 5, 0.0000000000000000 },
{ -3.1666666666666665, 5, 5.0000000000000000 },
{ 34.333333333333329, 5, 10.000000000000000 },
{ -355.25000000000000, 5, 15.000000000000000 },
{ -4765.6666666666670, 5, 20.000000000000000 },
{ -23040.666666666664, 5, 25.000000000000000 },
{ -74399.000000000000, 5, 30.000000000000000 },
{ -190559.41666666663, 5, 35.000000000000000 },
{ -418865.66666666663, 5, 40.000000000000000 },
{ -825411.50000000000, 5, 45.000000000000000 },
{ -1498165.6666666665, 5, 50.000000000000000 },
{ -2550096.9166666670, 5, 55.000000000000000 },
{ -4122299.0000000000, 5, 60.000000000000000 },
{ -6387115.6666666670, 5, 65.000000000000000 },
{ -9551265.6666666679, 5, 70.000000000000000 },
{ -13858967.750000000, 5, 75.000000000000000 },
{ -19595065.666666664, 5, 80.000000000000000 },
{ -27088153.166666668, 5, 85.000000000000000 },
{ -36713699.000000000, 5, 90.000000000000000 },
{ -48897171.916666657, 5, 95.000000000000000 },
{ -64117165.666666664, 5, 100.00000000000000 },
};
const double toler004 = 2.5000000000000020e-13;
// Test data for n=10.
// max(|f - f_GSL|): 0.0029296875000000000
// max(|f - f_GSL| / |f_GSL|): 6.1315986390500118e-15
const testcase_laguerre<double>
data005[21] =
{
{ 1.0000000000000000, 10, 0.0000000000000000 },
{ 1.7562761794532631, 10, 5.0000000000000000 },
{ 27.984126984126977, 10, 10.000000000000000 },
{ -237.51841517857147, 10, 15.000000000000000 },
{ 3227.8077601410932, 10, 20.000000000000000 },
{ -45786.199797453693, 10, 25.000000000000000 },
{ 15129.571428571455, 10, 30.000000000000000 },
{ 7764800.8179494590, 10, 35.000000000000000 },
{ 79724066.608465582, 10, 40.000000000000000 },
{ 469865425.65122765, 10, 45.000000000000000 },
{ 2037190065.3738980, 10, 50.000000000000000 },
{ 7187828002.9825764, 10, 55.000000000000000 },
{ 21804200401.000000, 10, 60.000000000000000 },
{ 58854343015.616211, 10, 65.000000000000000 },
{ 144688291819.51855, 10, 70.000000000000000 },
{ 329425241736.70038, 10, 75.000000000000000 },
{ 703324772760.08276, 10, 80.000000000000000 },
{ 1421627560118.6157, 10, 85.000000000000000 },
{ 2741055412243.8569, 10, 90.000000000000000 },
{ 5071986977681.8652, 10, 95.000000000000000 },
{ 9051283795429.5723, 10, 100.00000000000000 },
};
const double toler005 = 5.0000000000000039e-13;
// Test data for n=20.
// max(|f - f_GSL|): 2048.0000000000000
// max(|f - f_GSL| / |f_GSL|): 7.1189246999774008e-15
const testcase_laguerre<double>
data006[21] =
{
{ 1.0000000000000000, 20, 0.0000000000000000 },
{ 2.0202257444769134, 20, 5.0000000000000000 },
{ -11.961333867812119, 20, 10.000000000000000 },
{ -50.151037960139455, 20, 15.000000000000000 },
{ 2829.4728613531743, 20, 20.000000000000000 },
{ -11583.947899113540, 20, 25.000000000000000 },
{ -18439.424502520938, 20, 30.000000000000000 },
{ -38838.223606979285, 20, 35.000000000000000 },
{ 24799805.877530713, 20, 40.000000000000000 },
{ -673953823.59913278, 20, 45.000000000000000 },
{ 7551960453.7672548, 20, 50.000000000000000 },
{ 31286508510.614746, 20, 55.000000000000000 },
{ -1379223608444.9155, 20, 60.000000000000000 },
{ -6692517968212.9717, 20, 65.000000000000000 },
{ 165423821874449.94, 20, 70.000000000000000 },
{ 3082390018008546.5, 20, 75.000000000000000 },
{ 29500368536981676., 20, 80.000000000000000 },
{ 2.0353526354974186e+17, 20, 85.000000000000000 },
{ 1.1292309514432901e+18, 20, 90.000000000000000 },
{ 5.3239262855563100e+18, 20, 95.000000000000000 },
{ 2.2061882785931735e+19, 20, 100.00000000000000 },
};
const double toler006 = 5.0000000000000039e-13;
// Test data for n=50.
// max(|f - f_GSL|): 196608.00000000000
// max(|f - f_GSL| / |f_GSL|): 4.2910775919271532e-15
const testcase_laguerre<double>
data007[21] =
{
{ 1.0000000000000000, 50, 0.0000000000000000 },
{ 1.4735258819430543, 50, 5.0000000000000000 },
{ 17.534183446338233, 50, 10.000000000000000 },
{ -195.62436619077380, 50, 15.000000000000000 },
{ 980.26961889791028, 50, 20.000000000000000 },
{ 24812.277673870878, 50, 25.000000000000000 },
{ 293000.50735962362, 50, 30.000000000000000 },
{ 2316195.5013375278, 50, 35.000000000000000 },
{ -14896937.968694873, 50, 40.000000000000000 },
{ -502066598.00813466, 50, 45.000000000000000 },
{ 2513677852.6916871, 50, 50.000000000000000 },
{ 45129675503.538910, 50, 55.000000000000000 },
{ -883876565337.99219, 50, 60.000000000000000 },
{ 9361319947203.8418, 50, 65.000000000000000 },
{ -80967880733583.234, 50, 70.000000000000000 },
{ 717391079438942.62, 50, 75.000000000000000 },
{ -8217471769564841.0, 50, 80.000000000000000 },
{ 1.2595276229009978e+17, 50, 85.000000000000000 },
{ -2.1140031308048891e+18, 50, 90.000000000000000 },
{ 3.2438187475835134e+19, 50, 95.000000000000000 },
{ -3.9710103487094692e+20, 50, 100.00000000000000 },
};
const double toler007 = 2.5000000000000020e-13;
// Test data for n=100.
// max(|f - f_GSL|): 98304.000000000000
// max(|f - f_GSL| / |f_GSL|): 3.8776197831393928e-15
const testcase_laguerre<double>
data008[21] =
{
{ 1.0000000000000000, 100, 0.0000000000000000 },
{ 1.4555271625328801, 100, 5.0000000000000000 },
{ 13.277662844303450, 100, 10.000000000000000 },
{ 91.737038454342454, 100, 15.000000000000000 },
{ 1854.0367283243388, 100, 20.000000000000000 },
{ -11281.698886837261, 100, 25.000000000000000 },
{ 170141.86987046551, 100, 30.000000000000000 },
{ -2950092.7025822806, 100, 35.000000000000000 },
{ -7272442.3156006960, 100, 40.000000000000000 },
{ 295697471.90876162, 100, 45.000000000000000 },
{ 4847420871.2690506, 100, 50.000000000000000 },
{ 59406998102.392288, 100, 55.000000000000000 },
{ 693492765740.29688, 100, 60.000000000000000 },
{ 6606192010150.3154, 100, 65.000000000000000 },
{ 17125518672239.770, 100, 70.000000000000000 },
{ -870493767065150.12, 100, 75.000000000000000 },
{ -13763178176383768., 100, 80.000000000000000 },
{ 30667078414479584., 100, 85.000000000000000 },
{ 2.1307220490380173e+18, 100, 90.000000000000000 },
{ -7.2706523009007821e+18, 100, 95.000000000000000 },
{ -2.6292260693068916e+20, 100, 100.00000000000000 },
};
const double toler008 = 2.5000000000000020e-13;
template<typename Tp, unsigned int Num>
void
test(const testcase_laguerre<Tp> (&data)[Num], Tp toler)
{
bool test __attribute__((unused)) = true;
const Tp eps = std::numeric_limits<Tp>::epsilon();
Tp max_abs_diff = -Tp(1);
Tp max_abs_frac = -Tp(1);
unsigned int num_datum = Num;
for (unsigned int i = 0; i < num_datum; ++i)
{
const Tp f = std::laguerre(data[i].n, data[i].x);
const Tp f0 = data[i].f0;
const Tp diff = f - f0;
if (std::abs(diff) > max_abs_diff)
max_abs_diff = std::abs(diff);
if (std::abs(f0) > Tp(10) * eps
&& std::abs(f) > Tp(10) * eps)
{
const Tp frac = diff / f0;
if (std::abs(frac) > max_abs_frac)
max_abs_frac = std::abs(frac);
}
}
VERIFY(max_abs_frac < toler);
}
int
main()
{
test(data001, toler001);
test(data002, toler002);
test(data003, toler003);
test(data004, toler004);
test(data005, toler005);
test(data006, toler006);
test(data007, toler007);
test(data008, toler008);
return 0;
}

View File

@ -0,0 +1,42 @@
// { dg-do compile }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.16 laguerre
#include <cmath>
void
test01()
{
float xf = 0.5F;
double xd = 0.5;
long double xl = 0.5L;
unsigned int n = 2;
std::laguerre(n, xf);
std::laguerref(n, xf);
std::laguerre(n, xd);
std::laguerre(n, xl);
std::laguerrel(n, xl);
return;
}

View File

@ -0,0 +1,42 @@
// { dg-do compile { xfail *-*-* } }
// { dg-excess-errors "" }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.16 laguerre
#include <math.h>
void
test01()
{
float xf = 0.5F;
double xd = 0.5;
long double xl = 0.5L;
unsigned int n = 2;
laguerre(n, xf);
laguerref(n, xf);
laguerre(n, xd);
laguerre(n, xl);
laguerrel(n, xl);
return;
}

View File

@ -0,0 +1,59 @@
// { dg-require-c-std "" }
// { dg-add-options ieee }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.17 legendre
#include <cmath>
#include <testsuite_hooks.h>
void
test01()
{
float xf = std::numeric_limits<float>::quiet_NaN();
double xd = std::numeric_limits<double>::quiet_NaN();
long double xl = std::numeric_limits<long double>::quiet_NaN();
unsigned int l = 2;
float a = std::legendre(l, xf);
float b = std::legendref(l, xf);
double c = std::legendre(l, xd);
long double d = std::legendre(l, xl);
long double e = std::legendrel(l, xl);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
int
main()
{
test01();
return 0;
}

View File

@ -0,0 +1,319 @@
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
//
// Copyright (C) 2016 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/>.
// legendre
// Compare against values generated by the GNU Scientific Library.
// The GSL can be found on the web: http://www.gnu.org/software/gsl/
#include <limits>
#include <cmath>
#if defined(__TEST_DEBUG)
# include <iostream>
# define VERIFY(A) \
if (!(A)) \
{ \
std::cout << "line " << __LINE__ \
<< " max_abs_frac = " << max_abs_frac \
<< std::endl; \
}
#else
# include <testsuite_hooks.h>
#endif
#include <specfun_testcase.h>
// Test data for l=0.
// max(|f - f_GSL|): 0.0000000000000000
// max(|f - f_GSL| / |f_GSL|): 0.0000000000000000
const testcase_legendre<double>
data001[21] =
{
{ 1.0000000000000000, 0, -1.0000000000000000 },
{ 1.0000000000000000, 0, -0.90000000000000002 },
{ 1.0000000000000000, 0, -0.80000000000000004 },
{ 1.0000000000000000, 0, -0.69999999999999996 },
{ 1.0000000000000000, 0, -0.59999999999999998 },
{ 1.0000000000000000, 0, -0.50000000000000000 },
{ 1.0000000000000000, 0, -0.40000000000000002 },
{ 1.0000000000000000, 0, -0.30000000000000004 },
{ 1.0000000000000000, 0, -0.19999999999999996 },
{ 1.0000000000000000, 0, -0.099999999999999978 },
{ 1.0000000000000000, 0, 0.0000000000000000 },
{ 1.0000000000000000, 0, 0.10000000000000009 },
{ 1.0000000000000000, 0, 0.19999999999999996 },
{ 1.0000000000000000, 0, 0.30000000000000004 },
{ 1.0000000000000000, 0, 0.39999999999999991 },
{ 1.0000000000000000, 0, 0.50000000000000000 },
{ 1.0000000000000000, 0, 0.60000000000000009 },
{ 1.0000000000000000, 0, 0.69999999999999996 },
{ 1.0000000000000000, 0, 0.80000000000000004 },
{ 1.0000000000000000, 0, 0.89999999999999991 },
{ 1.0000000000000000, 0, 1.0000000000000000 },
};
const double toler001 = 2.5000000000000020e-13;
// Test data for l=1.
// max(|f - f_GSL|): 0.0000000000000000
// max(|f - f_GSL| / |f_GSL|): 0.0000000000000000
const testcase_legendre<double>
data002[21] =
{
{ -1.0000000000000000, 1, -1.0000000000000000 },
{ -0.90000000000000002, 1, -0.90000000000000002 },
{ -0.80000000000000004, 1, -0.80000000000000004 },
{ -0.69999999999999996, 1, -0.69999999999999996 },
{ -0.59999999999999998, 1, -0.59999999999999998 },
{ -0.50000000000000000, 1, -0.50000000000000000 },
{ -0.40000000000000002, 1, -0.40000000000000002 },
{ -0.30000000000000004, 1, -0.30000000000000004 },
{ -0.19999999999999996, 1, -0.19999999999999996 },
{ -0.099999999999999978, 1, -0.099999999999999978 },
{ 0.0000000000000000, 1, 0.0000000000000000 },
{ 0.10000000000000009, 1, 0.10000000000000009 },
{ 0.19999999999999996, 1, 0.19999999999999996 },
{ 0.30000000000000004, 1, 0.30000000000000004 },
{ 0.39999999999999991, 1, 0.39999999999999991 },
{ 0.50000000000000000, 1, 0.50000000000000000 },
{ 0.60000000000000009, 1, 0.60000000000000009 },
{ 0.69999999999999996, 1, 0.69999999999999996 },
{ 0.80000000000000004, 1, 0.80000000000000004 },
{ 0.89999999999999991, 1, 0.89999999999999991 },
{ 1.0000000000000000, 1, 1.0000000000000000 },
};
const double toler002 = 2.5000000000000020e-13;
// Test data for l=2.
// max(|f - f_GSL|): 1.1102230246251565e-16
// max(|f - f_GSL| / |f_GSL|): 1.3877787807814482e-15
const testcase_legendre<double>
data003[21] =
{
{ 1.0000000000000000, 2, -1.0000000000000000 },
{ 0.71500000000000008, 2, -0.90000000000000002 },
{ 0.46000000000000019, 2, -0.80000000000000004 },
{ 0.23499999999999988, 2, -0.69999999999999996 },
{ 0.039999999999999925, 2, -0.59999999999999998 },
{ -0.12500000000000000, 2, -0.50000000000000000 },
{ -0.25999999999999995, 2, -0.40000000000000002 },
{ -0.36499999999999999, 2, -0.30000000000000004 },
{ -0.44000000000000006, 2, -0.19999999999999996 },
{ -0.48499999999999999, 2, -0.099999999999999978 },
{ -0.50000000000000000, 2, 0.0000000000000000 },
{ -0.48499999999999999, 2, 0.10000000000000009 },
{ -0.44000000000000006, 2, 0.19999999999999996 },
{ -0.36499999999999999, 2, 0.30000000000000004 },
{ -0.26000000000000012, 2, 0.39999999999999991 },
{ -0.12500000000000000, 2, 0.50000000000000000 },
{ 0.040000000000000147, 2, 0.60000000000000009 },
{ 0.23499999999999988, 2, 0.69999999999999996 },
{ 0.46000000000000019, 2, 0.80000000000000004 },
{ 0.71499999999999986, 2, 0.89999999999999991 },
{ 1.0000000000000000, 2, 1.0000000000000000 },
};
const double toler003 = 2.5000000000000020e-13;
// Test data for l=5.
// max(|f - f_GSL|): 2.0122792321330962e-16
// max(|f - f_GSL| / |f_GSL|): 4.8911475274404243e-15
const testcase_legendre<double>
data004[21] =
{
{ -1.0000000000000000, 5, -1.0000000000000000 },
{ 0.041141250000000087, 5, -0.90000000000000002 },
{ 0.39951999999999993, 5, -0.80000000000000004 },
{ 0.36519874999999991, 5, -0.69999999999999996 },
{ 0.15263999999999994, 5, -0.59999999999999998 },
{ -0.089843750000000000, 5, -0.50000000000000000 },
{ -0.27063999999999994, 5, -0.40000000000000002 },
{ -0.34538625000000001, 5, -0.30000000000000004 },
{ -0.30751999999999996, 5, -0.19999999999999996 },
{ -0.17882874999999995, 5, -0.099999999999999978 },
{ 0.0000000000000000, 5, 0.0000000000000000 },
{ 0.17882875000000015, 5, 0.10000000000000009 },
{ 0.30751999999999996, 5, 0.19999999999999996 },
{ 0.34538625000000001, 5, 0.30000000000000004 },
{ 0.27064000000000010, 5, 0.39999999999999991 },
{ 0.089843750000000000, 5, 0.50000000000000000 },
{ -0.15264000000000016, 5, 0.60000000000000009 },
{ -0.36519874999999991, 5, 0.69999999999999996 },
{ -0.39951999999999993, 5, 0.80000000000000004 },
{ -0.041141250000000261, 5, 0.89999999999999991 },
{ 1.0000000000000000, 5, 1.0000000000000000 },
};
const double toler004 = 2.5000000000000020e-13;
// Test data for l=10.
// max(|f - f_GSL|): 2.7755575615628914e-16
// max(|f - f_GSL| / |f_GSL|): 1.0547610802636413e-15
const testcase_legendre<double>
data005[21] =
{
{ 1.0000000000000000, 10, -1.0000000000000000 },
{ -0.26314561785585960, 10, -0.90000000000000002 },
{ 0.30052979560000004, 10, -0.80000000000000004 },
{ 0.085805795531640333, 10, -0.69999999999999996 },
{ -0.24366274560000001, 10, -0.59999999999999998 },
{ -0.18822860717773438, 10, -0.50000000000000000 },
{ 0.096839064399999925, 10, -0.40000000000000002 },
{ 0.25147634951601561, 10, -0.30000000000000004 },
{ 0.12907202559999983, 10, -0.19999999999999996 },
{ -0.12212499738710943, 10, -0.099999999999999978 },
{ -0.24609375000000000, 10, 0.0000000000000000 },
{ -0.12212499738710922, 10, 0.10000000000000009 },
{ 0.12907202559999983, 10, 0.19999999999999996 },
{ 0.25147634951601561, 10, 0.30000000000000004 },
{ 0.096839064400000258, 10, 0.39999999999999991 },
{ -0.18822860717773438, 10, 0.50000000000000000 },
{ -0.24366274559999984, 10, 0.60000000000000009 },
{ 0.085805795531640333, 10, 0.69999999999999996 },
{ 0.30052979560000004, 10, 0.80000000000000004 },
{ -0.26314561785585899, 10, 0.89999999999999991 },
{ 1.0000000000000000, 10, 1.0000000000000000 },
};
const double toler005 = 2.5000000000000020e-13;
// Test data for l=20.
// max(|f - f_GSL|): 3.3306690738754696e-16
// max(|f - f_GSL| / |f_GSL|): 2.2307336678138069e-15
const testcase_legendre<double>
data006[21] =
{
{ 1.0000000000000000, 20, -1.0000000000000000 },
{ -0.14930823530984835, 20, -0.90000000000000002 },
{ 0.22420460541741347, 20, -0.80000000000000004 },
{ -0.20457394463834172, 20, -0.69999999999999996 },
{ 0.15916752910098109, 20, -0.59999999999999998 },
{ -0.048358381067373557, 20, -0.50000000000000000 },
{ -0.10159261558628156, 20, -0.40000000000000002 },
{ 0.18028715947998042, 20, -0.30000000000000004 },
{ -0.098042194344594796, 20, -0.19999999999999996 },
{ -0.082077130944527663, 20, -0.099999999999999978 },
{ 0.17619705200195312, 20, 0.0000000000000000 },
{ -0.082077130944528023, 20, 0.10000000000000009 },
{ -0.098042194344594796, 20, 0.19999999999999996 },
{ 0.18028715947998042, 20, 0.30000000000000004 },
{ -0.10159261558628112, 20, 0.39999999999999991 },
{ -0.048358381067373557, 20, 0.50000000000000000 },
{ 0.15916752910098075, 20, 0.60000000000000009 },
{ -0.20457394463834172, 20, 0.69999999999999996 },
{ 0.22420460541741347, 20, 0.80000000000000004 },
{ -0.14930823530984924, 20, 0.89999999999999991 },
{ 1.0000000000000000, 20, 1.0000000000000000 },
};
const double toler006 = 2.5000000000000020e-13;
// Test data for l=50.
// max(|f - f_GSL|): 3.6082248300317588e-16
// max(|f - f_GSL| / |f_GSL|): 2.1700196856209138e-15
const testcase_legendre<double>
data007[21] =
{
{ 1.0000000000000000, 50, -1.0000000000000000 },
{ -0.17003765994383671, 50, -0.90000000000000002 },
{ 0.13879737345093113, 50, -0.80000000000000004 },
{ -0.014572731645892852, 50, -0.69999999999999996 },
{ -0.058860798844002096, 50, -0.59999999999999998 },
{ -0.031059099239609811, 50, -0.50000000000000000 },
{ 0.041569033381825375, 50, -0.40000000000000002 },
{ 0.10911051574714797, 50, -0.30000000000000004 },
{ 0.083432272204197494, 50, -0.19999999999999996 },
{ -0.038205812661313600, 50, -0.099999999999999978 },
{ -0.11227517265921705, 50, 0.0000000000000000 },
{ -0.038205812661314155, 50, 0.10000000000000009 },
{ 0.083432272204197494, 50, 0.19999999999999996 },
{ 0.10911051574714797, 50, 0.30000000000000004 },
{ 0.041569033381824674, 50, 0.39999999999999991 },
{ -0.031059099239609811, 50, 0.50000000000000000 },
{ -0.058860798844001430, 50, 0.60000000000000009 },
{ -0.014572731645892852, 50, 0.69999999999999996 },
{ 0.13879737345093113, 50, 0.80000000000000004 },
{ -0.17003765994383657, 50, 0.89999999999999991 },
{ 1.0000000000000000, 50, 1.0000000000000000 },
};
const double toler007 = 2.5000000000000020e-13;
// Test data for l=100.
// max(|f - f_GSL|): 3.4694469519536142e-16
// max(|f - f_GSL| / |f_GSL|): 6.8214063779431592e-15
const testcase_legendre<double>
data008[21] =
{
{ 1.0000000000000000, 100, -1.0000000000000000 },
{ 0.10226582055871893, 100, -0.90000000000000002 },
{ 0.050861167913584228, 100, -0.80000000000000004 },
{ -0.077132507199778641, 100, -0.69999999999999996 },
{ -0.023747023905133141, 100, -0.59999999999999998 },
{ -0.060518025961861198, 100, -0.50000000000000000 },
{ -0.072258202125684470, 100, -0.40000000000000002 },
{ 0.057127392202801566, 100, -0.30000000000000004 },
{ 0.014681835355659706, 100, -0.19999999999999996 },
{ -0.063895098434750205, 100, -0.099999999999999978 },
{ 0.079589237387178727, 100, 0.0000000000000000 },
{ -0.063895098434749761, 100, 0.10000000000000009 },
{ 0.014681835355659706, 100, 0.19999999999999996 },
{ 0.057127392202801566, 100, 0.30000000000000004 },
{ -0.072258202125685025, 100, 0.39999999999999991 },
{ -0.060518025961861198, 100, 0.50000000000000000 },
{ -0.023747023905134217, 100, 0.60000000000000009 },
{ -0.077132507199778641, 100, 0.69999999999999996 },
{ 0.050861167913584228, 100, 0.80000000000000004 },
{ 0.10226582055871711, 100, 0.89999999999999991 },
{ 1.0000000000000000, 100, 1.0000000000000000 },
};
const double toler008 = 5.0000000000000039e-13;
template<typename Tp, unsigned int Num>
void
test(const testcase_legendre<Tp> (&data)[Num], Tp toler)
{
bool test __attribute__((unused)) = true;
const Tp eps = std::numeric_limits<Tp>::epsilon();
Tp max_abs_diff = -Tp(1);
Tp max_abs_frac = -Tp(1);
unsigned int num_datum = Num;
for (unsigned int i = 0; i < num_datum; ++i)
{
const Tp f = std::legendre(data[i].l, data[i].x);
const Tp f0 = data[i].f0;
const Tp diff = f - f0;
if (std::abs(diff) > max_abs_diff)
max_abs_diff = std::abs(diff);
if (std::abs(f0) > Tp(10) * eps
&& std::abs(f) > Tp(10) * eps)
{
const Tp frac = diff / f0;
if (std::abs(frac) > max_abs_frac)
max_abs_frac = std::abs(frac);
}
}
VERIFY(max_abs_frac < toler);
}
int
main()
{
test(data001, toler001);
test(data002, toler002);
test(data003, toler003);
test(data004, toler004);
test(data005, toler005);
test(data006, toler006);
test(data007, toler007);
test(data008, toler008);
return 0;
}

View File

@ -0,0 +1,42 @@
// { dg-do compile }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.17 legendre
#include <cmath>
void
test01()
{
float xf = 0.5F;
double xd = 0.5;
long double xl = 0.5L;
unsigned int l = 2;
std::legendre(l, xf);
std::legendref(l, xf);
std::legendre(l, xd);
std::legendre(l, xl);
std::legendrel(l, xl);
return;
}

View File

@ -0,0 +1,42 @@
// { dg-do compile { xfail *-*-* } }
// { dg-excess-errors "" }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.17 legendre
#include <math.h>
void
test01()
{
float xf = 0.5F;
double xd = 0.5;
long double xl = 0.5L;
unsigned int l = 2;
legendre(l, xf);
legendref(l, xf);
legendre(l, xd);
legendre(l, xl);
legendrel(l, xl);
return;
}

View File

@ -0,0 +1,56 @@
// { dg-require-c-std "" }
// { dg-add-options ieee }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.18 riemann_zeta
#include <cmath>
#include <testsuite_hooks.h>
void
test01()
{
float xf = std::numeric_limits<float>::quiet_NaN();
double xd = std::numeric_limits<double>::quiet_NaN();
long double xl = std::numeric_limits<long double>::quiet_NaN();
float a = std::riemann_zeta(xf);
float b = std::riemann_zetaf(xf);
double c = std::riemann_zeta(xd);
long double d = std::riemann_zeta(xl);
long double e = std::riemann_zetal(xl);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
int
main()
{
test01();
return 0;
}

View File

@ -0,0 +1,307 @@
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
//
// Copyright (C) 2016 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/>.
// riemann_zeta
// This can take long on simulators, timing out the test.
// { dg-options "-DMAX_ITERATIONS=5" { target simulator } }
#ifndef MAX_ITERATIONS
#define MAX_ITERATIONS (sizeof(data001) / sizeof(testcase_riemann_zeta<double>))
#endif
// Compare against values generated by the GNU Scientific Library.
// The GSL can be found on the web: http://www.gnu.org/software/gsl/
#include <limits>
#include <cmath>
#if defined(__TEST_DEBUG)
# include <iostream>
# define VERIFY(A) \
if (!(A)) \
{ \
std::cout << "line " << __LINE__ \
<< " max_abs_frac = " << max_abs_frac \
<< std::endl; \
}
#else
# include <testsuite_hooks.h>
#endif
#include <specfun_testcase.h>
// Test data.
// max(|f - f_GSL|): 8.8817841970012523e-16
// max(|f - f_GSL| / |f_GSL|): 3.7349082148991403e-15
const testcase_riemann_zeta<double>
data001[55] =
{
{ 0.0000000000000000, -10.000000000000000 },
{ -0.0033669820451019579, -9.8000000000000007 },
{ -0.0058129517767319039, -9.5999999999999996 },
{ -0.0072908732290557004, -9.4000000000000004 },
{ -0.0078420910654484442, -9.1999999999999993 },
{ -0.0075757575757575803, -9.0000000000000000 },
{ -0.0066476555677551898, -8.8000000000000007 },
{ -0.0052400095350859429, -8.5999999999999996 },
{ -0.0035434308017674959, -8.4000000000000004 },
{ -0.0017417330388368585, -8.1999999999999993 },
{ 0.0000000000000000, -8.0000000000000000 },
{ 0.0015440036789213961, -7.7999999999999998 },
{ 0.0027852131086497423, -7.5999999999999996 },
{ 0.0036537321227995880, -7.4000000000000004 },
{ 0.0041147930817053468, -7.2000000000000002 },
{ 0.0041666666666666683, -7.0000000000000000 },
{ 0.0038369975032738366, -6.7999999999999998 },
{ 0.0031780270571782981, -6.5999999999999996 },
{ 0.0022611282027338573, -6.4000000000000004 },
{ 0.0011710237049390511, -6.2000000000000002 },
{ 0.0000000000000000, -6.0000000000000000 },
{ -0.0011576366649881879, -5.7999999999999998 },
{ -0.0022106784318564345, -5.5999999999999996 },
{ -0.0030755853460586891, -5.4000000000000004 },
{ -0.0036804380477934787, -5.2000000000000002 },
{ -0.0039682539682539698, -5.0000000000000000 },
{ -0.0038996891301999797, -4.7999999999999998 },
{ -0.0034551830834302711, -4.5999999999999996 },
{ -0.0026366345018725115, -4.4000000000000004 },
{ -0.0014687209305056974, -4.2000000000000002 },
{ 0.0000000000000000, -4.0000000000000000 },
{ 0.0016960463875825202, -3.7999999999999998 },
{ 0.0035198355903356747, -3.5999999999999996 },
{ 0.0053441503206513421, -3.4000000000000004 },
{ 0.0070119720770910540, -3.2000000000000002 },
{ 0.0083333333333333350, -3.0000000000000000 },
{ 0.0090807294856852811, -2.7999999999999998 },
{ 0.0089824623788396681, -2.5999999999999996 },
{ 0.0077130239874243630, -2.4000000000000004 },
{ 0.0048792123593036068, -2.2000000000000002 },
{ 0.0000000000000000, -2.0000000000000000 },
{ -0.0075229347765968010, -1.8000000000000007 },
{ -0.018448986678963775, -1.5999999999999996 },
{ -0.033764987694047593, -1.4000000000000004 },
{ -0.054788441243880631, -1.1999999999999993 },
{ -0.083333333333333398, -1.0000000000000000 },
{ -0.12198707766977103, -0.80000000000000071 },
{ -0.17459571193801401, -0.59999999999999964 },
{ -0.24716546083171492, -0.40000000000000036 },
{ -0.34966628059831484, -0.19999999999999929 },
{ -0.49999999999999994, 0.0000000000000000 },
{ -0.73392092489633953, 0.19999999999999929 },
{ -1.1347977838669825, 0.40000000000000036 },
{ -1.9526614482239983, 0.59999999999999964 },
{ -4.4375384158955677, 0.80000000000000071 },
};
const double toler001 = 2.5000000000000020e-13;
// riemann_zeta
// This can take long on simulators, timing out the test.
// { dg-options "-DMAX_ITERATIONS=5" { target simulator } }
#ifndef MAX_ITERATIONS
#define MAX_ITERATIONS (sizeof(data001) / sizeof(testcase_riemann_zeta<double>))
#endif
// Test data.
// max(|f - f_GSL|): 2.6645352591003757e-15
// max(|f - f_GSL| / |f_GSL|): 1.1657079722157521e-15
const testcase_riemann_zeta<double>
data002[145] =
{
{ 5.5915824411777502, 1.2000000000000000 },
{ 3.1055472779775792, 1.3999999999999999 },
{ 2.2857656656801324, 1.6000000000000001 },
{ 1.8822296181028220, 1.8000000000000000 },
{ 1.6449340668482275, 2.0000000000000000 },
{ 1.4905432565068937, 2.2000000000000002 },
{ 1.3833428588407359, 2.3999999999999999 },
{ 1.3054778090727803, 2.6000000000000001 },
{ 1.2470314223172541, 2.7999999999999998 },
{ 1.2020569031595945, 3.0000000000000000 },
{ 1.1667733709844674, 3.2000000000000002 },
{ 1.1386637757280420, 3.3999999999999999 },
{ 1.1159890791233376, 3.6000000000000001 },
{ 1.0975105764590047, 3.7999999999999998 },
{ 1.0823232337111381, 4.0000000000000000 },
{ 1.0697514772338095, 4.2000000000000002 },
{ 1.0592817259798355, 4.4000000000000004 },
{ 1.0505173825665735, 4.5999999999999996 },
{ 1.0431480133351789, 4.7999999999999998 },
{ 1.0369277551433700, 5.0000000000000000 },
{ 1.0316598766779168, 5.2000000000000002 },
{ 1.0271855389203537, 5.4000000000000004 },
{ 1.0233754792270300, 5.5999999999999996 },
{ 1.0201237683883446, 5.7999999999999998 },
{ 1.0173430619844492, 6.0000000000000000 },
{ 1.0149609451852233, 6.2000000000000002 },
{ 1.0129170887121841, 6.4000000000000004 },
{ 1.0111610141542708, 6.5999999999999996 },
{ 1.0096503223447120, 6.7999999999999998 },
{ 1.0083492773819229, 7.0000000000000000 },
{ 1.0072276664807169, 7.2000000000000002 },
{ 1.0062598756930512, 7.4000000000000004 },
{ 1.0054241359879634, 7.5999999999999996 },
{ 1.0047019048164696, 7.7999999999999998 },
{ 1.0040773561979444, 8.0000000000000000 },
{ 1.0035369583062013, 8.1999999999999993 },
{ 1.0030691220374448, 8.4000000000000004 },
{ 1.0026639074861505, 8.5999999999999996 },
{ 1.0023127779098220, 8.8000000000000007 },
{ 1.0020083928260823, 9.0000000000000000 },
{ 1.0017444334995897, 9.1999999999999993 },
{ 1.0015154553480514, 9.4000000000000004 },
{ 1.0013167628052648, 9.5999999999999996 },
{ 1.0011443029840295, 9.8000000000000007 },
{ 1.0009945751278182, 10.000000000000000 },
{ 1.0008645533615086, 10.199999999999999 },
{ 1.0007516206744649, 10.400000000000000 },
{ 1.0006535124140847, 10.600000000000000 },
{ 1.0005682678503411, 10.800000000000001 },
{ 1.0004941886041194, 11.000000000000000 },
{ 1.0004298029239944, 11.199999999999999 },
{ 1.0003738349551168, 11.400000000000000 },
{ 1.0003251782761946, 11.600000000000000 },
{ 1.0002828730909989, 11.800000000000001 },
{ 1.0002460865533080, 12.000000000000000 },
{ 1.0002140957818750, 12.199999999999999 },
{ 1.0001862731874056, 12.400000000000000 },
{ 1.0001620737887460, 12.600000000000000 },
{ 1.0001410242422089, 12.800000000000001 },
{ 1.0001227133475783, 13.000000000000000 },
{ 1.0001067838280169, 13.199999999999999 },
{ 1.0000929252097515, 13.400000000000000 },
{ 1.0000808676518718, 13.600000000000000 },
{ 1.0000703765974504, 13.800000000000001 },
{ 1.0000612481350588, 14.000000000000000 },
{ 1.0000533049750668, 14.199999999999999 },
{ 1.0000463929582293, 14.400000000000000 },
{ 1.0000403780253397, 14.600000000000000 },
{ 1.0000351435864272, 14.800000000000001 },
{ 1.0000305882363070, 15.000000000000000 },
{ 1.0000266237704787, 15.199999999999999 },
{ 1.0000231734615617, 15.400000000000000 },
{ 1.0000201705617975, 15.600000000000000 },
{ 1.0000175570017611, 15.800000000000001 },
{ 1.0000152822594086, 16.000000000000000 },
{ 1.0000133023770337, 16.199999999999999 },
{ 1.0000115791066830, 16.399999999999999 },
{ 1.0000100791671644, 16.600000000000001 },
{ 1.0000087735980010, 16.800000000000001 },
{ 1.0000076371976379, 17.000000000000000 },
{ 1.0000066480348633, 17.199999999999999 },
{ 1.0000057870238734, 17.399999999999999 },
{ 1.0000050375546607, 17.600000000000001 },
{ 1.0000043851715013, 17.800000000000001 },
{ 1.0000038172932648, 18.000000000000000 },
{ 1.0000033229700953, 18.199999999999999 },
{ 1.0000028926717153, 18.399999999999999 },
{ 1.0000025181032419, 18.600000000000001 },
{ 1.0000021920449287, 18.800000000000001 },
{ 1.0000019082127167, 19.000000000000000 },
{ 1.0000016611368951, 19.199999999999999 },
{ 1.0000014460565094, 19.399999999999999 },
{ 1.0000012588274738, 19.600000000000001 },
{ 1.0000010958426055, 19.800000000000001 },
{ 1.0000009539620338, 20.000000000000000 },
{ 1.0000008304526344, 20.199999999999999 },
{ 1.0000007229353187, 20.399999999999999 },
{ 1.0000006293391575, 20.600000000000001 },
{ 1.0000005478614529, 20.800000000000001 },
{ 1.0000004769329869, 21.000000000000000 },
{ 1.0000004151877719, 21.199999999999999 },
{ 1.0000003614367254, 21.399999999999999 },
{ 1.0000003146447527, 21.600000000000001 },
{ 1.0000002739108020, 21.800000000000001 },
{ 1.0000002384505029, 22.000000000000000 },
{ 1.0000002075810521, 22.199999999999999 },
{ 1.0000001807080625, 22.399999999999999 },
{ 1.0000001573141093, 22.600000000000001 },
{ 1.0000001369487659, 22.800000000000001 },
{ 1.0000001192199262, 23.000000000000000 },
{ 1.0000001037862520, 23.199999999999999 },
{ 1.0000000903506006, 23.399999999999999 },
{ 1.0000000786543011, 23.600000000000001 },
{ 1.0000000684721728, 23.800000000000001 },
{ 1.0000000596081891, 24.000000000000000 },
{ 1.0000000518917020, 24.199999999999999 },
{ 1.0000000451741575, 24.399999999999999 },
{ 1.0000000393262332, 24.600000000000001 },
{ 1.0000000342353501, 24.800000000000001 },
{ 1.0000000298035037, 25.000000000000000 },
{ 1.0000000259453767, 25.199999999999999 },
{ 1.0000000225866978, 25.399999999999999 },
{ 1.0000000196628109, 25.600000000000001 },
{ 1.0000000171174297, 25.800000000000001 },
{ 1.0000000149015549, 26.000000000000000 },
{ 1.0000000129725304, 26.199999999999999 },
{ 1.0000000112932221, 26.399999999999999 },
{ 1.0000000098313035, 26.600000000000001 },
{ 1.0000000085586331, 26.800000000000001 },
{ 1.0000000074507118, 27.000000000000000 },
{ 1.0000000064862125, 27.199999999999999 },
{ 1.0000000056465688, 27.399999999999999 },
{ 1.0000000049156179, 27.600000000000001 },
{ 1.0000000042792894, 27.800000000000001 },
{ 1.0000000037253340, 28.000000000000000 },
{ 1.0000000032430887, 28.199999999999999 },
{ 1.0000000028232703, 28.399999999999999 },
{ 1.0000000024577977, 28.600000000000001 },
{ 1.0000000021396356, 28.800000000000001 },
{ 1.0000000018626598, 29.000000000000000 },
{ 1.0000000016215385, 29.199999999999999 },
{ 1.0000000014116306, 29.399999999999999 },
{ 1.0000000012288952, 29.600000000000001 },
{ 1.0000000010698147, 29.800000000000001 },
{ 1.0000000009313275, 30.000000000000000 },
};
const double toler002 = 2.5000000000000020e-13;
template<typename Tp, unsigned int Num>
void
test(const testcase_riemann_zeta<Tp> (&data)[Num], Tp toler)
{
bool test __attribute__((unused)) = true;
const Tp eps = std::numeric_limits<Tp>::epsilon();
Tp max_abs_diff = -Tp(1);
Tp max_abs_frac = -Tp(1);
unsigned int num_datum = MAX_ITERATIONS;
for (unsigned int i = 0; i < num_datum; ++i)
{
const Tp f = std::riemann_zeta(data[i].s);
const Tp f0 = data[i].f0;
const Tp diff = f - f0;
if (std::abs(diff) > max_abs_diff)
max_abs_diff = std::abs(diff);
if (std::abs(f0) > Tp(10) * eps
&& std::abs(f) > Tp(10) * eps)
{
const Tp frac = diff / f0;
if (std::abs(frac) > max_abs_frac)
max_abs_frac = std::abs(frac);
}
}
VERIFY(max_abs_frac < toler);
}
int
main()
{
test(data001, toler001);
test(data002, toler002);
return 0;
}

View File

@ -0,0 +1,40 @@
// { dg-do compile }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.18 riemann_zeta
#include <cmath>
void
test01()
{
float xf = 0.5F;
double xd = 0.5;
long double xl = 0.5L;
std::riemann_zeta(xf);
std::riemann_zetaf(xf);
std::riemann_zeta(xd);
std::riemann_zeta(xl);
std::riemann_zetal(xl);
return;
}

View File

@ -0,0 +1,41 @@
// { dg-do compile { xfail *-*-* } }
// { dg-excess-errors "" }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.18 riemann_zeta
#include <math.h>
void
test01()
{
float xf = 0.5F;
double xd = 0.5;
long double xl = 0.5L;
riemann_zeta(xf);
riemann_zetaf(xf);
riemann_zeta(xd);
riemann_zeta(xl);
riemann_zetal(xl);
return;
}

View File

@ -0,0 +1,58 @@
// { dg-require-c-std "" }
// { dg-add-options ieee }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
// Copyright (C) 2016 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/>.
// 8.1.19 sph_bessel
#include <cmath>
#include <testsuite_hooks.h>
void
test01()
{
float xf = std::numeric_limits<float>::quiet_NaN();
double xd = std::numeric_limits<double>::quiet_NaN();
long double xl = std::numeric_limits<long double>::quiet_NaN();
unsigned int n = 0;
float a = std::sph_bessel(n, xf);
float b = std::sph_besself(n, xf);
double c = std::sph_bessel(n, xd);
long double d = std::sph_bessel(n, xl);
long double e = std::sph_bessell(n, xl);
bool test [[gnu::unused]] = true;
VERIFY(std::isnan(a));
VERIFY(std::isnan(b));
VERIFY(std::isnan(c));
VERIFY(std::isnan(d));
VERIFY(std::isnan(e));
return;
}
int
main()
{
test01();
return 0;
}

Some files were not shown because too many files have changed in this diff Show More