diff --git a/include/boost/math/special_functions/airy.hpp b/include/boost/math/special_functions/airy.hpp index 275f5decc..2457512b6 100644 --- a/include/boost/math/special_functions/airy.hpp +++ b/include/boost/math/special_functions/airy.hpp @@ -7,6 +7,7 @@ #ifndef BOOST_MATH_AIRY_HPP #define BOOST_MATH_AIRY_HPP +#include #include #include #include @@ -359,7 +360,12 @@ inline T airy_ai_zero(int m, const Policy& /*pol*/) policies::promote_double, policies::discrete_quantile<>, policies::assert_undefined<> >::type forwarding_policy; - BOOST_STATIC_ASSERT_MSG(false == std::numeric_limits::is_integer, "Airy return type must be a floating-point type."); + + BOOST_STATIC_ASSERT_MSG( false == std::numeric_limits::is_specialized + || ( true == std::numeric_limits::is_specialized + && false == std::numeric_limits::is_integer), + "Airy value type must be a floating-point type."); + return policies::checked_narrowing_cast(detail::airy_ai_zero_imp(m, forwarding_policy()), "boost::math::airy_ai_zero<%1%>(unsigned)"); } @@ -377,7 +383,11 @@ inline OutputIterator airy_ai_zero( const Policy& pol) { typedef T result_type; - BOOST_STATIC_ASSERT_MSG(false == std::numeric_limits::is_integer, "Airy return type must be a floating-point type."); + + BOOST_STATIC_ASSERT_MSG( false == std::numeric_limits::is_specialized + || ( true == std::numeric_limits::is_specialized + && false == std::numeric_limits::is_integer), + "Airy value type must be a floating-point type."); for(unsigned i = 0; i < static_cast(number_of_zeros); ++i) { @@ -407,7 +417,12 @@ inline T airy_bi_zero(int m, const Policy& /*pol*/) policies::promote_double, policies::discrete_quantile<>, policies::assert_undefined<> >::type forwarding_policy; - BOOST_STATIC_ASSERT_MSG(false == std::numeric_limits::is_integer, "Airy return type must be a floating-point type."); + + BOOST_STATIC_ASSERT_MSG( false == std::numeric_limits::is_specialized + || ( true == std::numeric_limits::is_specialized + && false == std::numeric_limits::is_integer), + "Airy value type must be a floating-point type."); + return policies::checked_narrowing_cast(detail::airy_bi_zero_imp(m, forwarding_policy()), "boost::math::airy_bi_zero<%1%>(unsigned)"); } @@ -425,7 +440,11 @@ inline OutputIterator airy_bi_zero( const Policy& pol) { typedef T result_type; - BOOST_STATIC_ASSERT_MSG(false == std::numeric_limits::is_integer, "Airy return type must be a floating-point type."); + + BOOST_STATIC_ASSERT_MSG( false == std::numeric_limits::is_specialized + || ( true == std::numeric_limits::is_specialized + && false == std::numeric_limits::is_integer), + "Airy value type must be a floating-point type."); for(int i = 0; i < static_cast(number_of_zeros); ++i) { diff --git a/include/boost/math/special_functions/bessel.hpp b/include/boost/math/special_functions/bessel.hpp index 2668f8d11..85e26b132 100644 --- a/include/boost/math/special_functions/bessel.hpp +++ b/include/boost/math/special_functions/bessel.hpp @@ -15,6 +15,7 @@ # pragma once #endif +#include #include #include #include @@ -666,14 +667,23 @@ inline typename detail::bessel_traits::result_type cyl_bessel_j_ze policies::promote_double, policies::discrete_quantile<>, policies::assert_undefined<> >::type forwarding_policy; - BOOST_STATIC_ASSERT_MSG(false == std::numeric_limits::is_integer, "Order must be a floating-point type."); + + BOOST_STATIC_ASSERT_MSG( false == std::numeric_limits::is_specialized + || ( true == std::numeric_limits::is_specialized + && false == std::numeric_limits::is_integer), + "Order must be a floating-point type."); + return policies::checked_narrowing_cast(detail::cyl_bessel_j_zero_imp(v, m, forwarding_policy()), "boost::math::cyl_bessel_j_zero<%1%>(%1%,%1%)"); } template inline typename detail::bessel_traits >::result_type cyl_bessel_j_zero(T v, int m) { - BOOST_STATIC_ASSERT_MSG(false == std::numeric_limits::is_integer, "Order must be a floating-point type."); + BOOST_STATIC_ASSERT_MSG( false == std::numeric_limits::is_specialized + || ( true == std::numeric_limits::is_specialized + && false == std::numeric_limits::is_integer), + "Order must be a floating-point type."); + return cyl_bessel_j_zero >(v, m, policies::policy<>()); } @@ -684,7 +694,11 @@ inline OutputIterator cyl_bessel_j_zero(T v, OutputIterator out_it, const Policy& pol) { - BOOST_STATIC_ASSERT_MSG(false == std::numeric_limits::is_integer, "Order must be a floating-point type."); + BOOST_STATIC_ASSERT_MSG( false == std::numeric_limits::is_specialized + || ( true == std::numeric_limits::is_specialized + && false == std::numeric_limits::is_integer), + "Order must be a floating-point type."); + for(int i = 0; i < static_cast(number_of_zeros); ++i) { *out_it = boost::math::cyl_bessel_j_zero(v, start_index + i, pol); @@ -714,14 +728,23 @@ inline typename detail::bessel_traits::result_type cyl_neumann_zer policies::promote_double, policies::discrete_quantile<>, policies::assert_undefined<> >::type forwarding_policy; - BOOST_STATIC_ASSERT_MSG(false == std::numeric_limits::is_integer, "Order must be a floating-point type."); + + BOOST_STATIC_ASSERT_MSG( false == std::numeric_limits::is_specialized + || ( true == std::numeric_limits::is_specialized + && false == std::numeric_limits::is_integer), + "Order must be a floating-point type."); + return policies::checked_narrowing_cast(detail::cyl_neumann_zero_imp(v, m, forwarding_policy()), "boost::math::cyl_neumann_zero<%1%>(%1%,%1%)"); } template inline typename detail::bessel_traits >::result_type cyl_neumann_zero(T v, int m) { - BOOST_STATIC_ASSERT_MSG(false == std::numeric_limits::is_integer, "Order must be a floating-point type."); + BOOST_STATIC_ASSERT_MSG( false == std::numeric_limits::is_specialized + || ( true == std::numeric_limits::is_specialized + && false == std::numeric_limits::is_integer), + "Order must be a floating-point type."); + return cyl_neumann_zero >(v, m, policies::policy<>()); } @@ -732,7 +755,11 @@ inline OutputIterator cyl_neumann_zero(T v, OutputIterator out_it, const Policy& pol) { - BOOST_STATIC_ASSERT_MSG(false == std::numeric_limits::is_integer, "Order must be a floating-point type."); + BOOST_STATIC_ASSERT_MSG( false == std::numeric_limits::is_specialized + || ( true == std::numeric_limits::is_specialized + && false == std::numeric_limits::is_integer), + "Order must be a floating-point type."); + for(int i = 0; i < static_cast(number_of_zeros); ++i) { *out_it = boost::math::cyl_neumann_zero(v, start_index + i, pol);