diff --git a/include/boost/math/special_functions/next.hpp b/include/boost/math/special_functions/next.hpp index 8cbdd86da..235f0c981 100644 --- a/include/boost/math/special_functions/next.hpp +++ b/include/boost/math/special_functions/next.hpp @@ -37,7 +37,7 @@ inline T get_smallest_value(mpl::false_ const&) template inline T get_smallest_value() { - return get_smallest_value(mpl::bool_::is_specialized && std::numeric_limits::has_denorm>()); + return get_smallest_value(mpl::bool_::is_specialized && (std::numeric_limits::has_denorm == std::denorm_present)>()); } } diff --git a/test/test_next.cpp b/test/test_next.cpp index 44618ab60..1427b537a 100644 --- a/test/test_next.cpp +++ b/test/test_next.cpp @@ -39,8 +39,11 @@ void test_value(const T& val, const char* name) BOOST_CHECK_EQUAL(float_distance(float_advance(val, 4), val), -4); BOOST_CHECK_EQUAL(float_distance(float_advance(val, -4), val), 4); - BOOST_CHECK_EQUAL(float_distance(float_advance(float_next(float_next(val)), 4), float_next(float_next(val))), -4); - BOOST_CHECK_EQUAL(float_distance(float_advance(float_next(float_next(val)), -4), float_next(float_next(val))), 4); + if(std::numeric_limits::is_specialized && (std::numeric_limits::has_denorm == std::denorm_present)) + { + BOOST_CHECK_EQUAL(float_distance(float_advance(float_next(float_next(val)), 4), float_next(float_next(val))), -4); + BOOST_CHECK_EQUAL(float_distance(float_advance(float_next(float_next(val)), -4), float_next(float_next(val))), 4); + } } template @@ -60,7 +63,7 @@ void test_values(const T& val, const char* name) test_value(-boost::math::tools::epsilon(), name); test_value(boost::math::tools::min_value(), name); test_value(-boost::math::tools::min_value(), name); - if(std::numeric_limits::is_specialized) + if(std::numeric_limits::is_specialized && (std::numeric_limits::has_denorm == std::denorm_present)) { test_value(z, name); test_value(-z, name); @@ -69,7 +72,7 @@ void test_values(const T& val, const char* name) test_value(-one, name); test_value(two, name); test_value(-two, name); - if(std::numeric_limits::is_specialized && std::numeric_limits::has_denorm) + if(std::numeric_limits::is_specialized && (std::numeric_limits::has_denorm == std::denorm_present)) { test_value(std::numeric_limits::denorm_min(), name); test_value(-std::numeric_limits::denorm_min(), name);