diff --git a/doc/policies/policy.qbk b/doc/policies/policy.qbk index 73c15f6dd..984e6281e 100644 --- a/doc/policies/policy.qbk +++ b/doc/policies/policy.qbk @@ -107,8 +107,8 @@ must be provided by the user: template T user_rounding_error(const char* function, const char* message, const T& val); - template - T user_evaluation_error(const char* function, const char* message, const T& val); + template + TargetType user_rounding_error(const char* function, const char* message, const T& val, const TargetType& t); template T user_indeterminate_result_error(const char* function, const char* message, const T& val); diff --git a/example/policy_eg_8.cpp b/example/policy_eg_8.cpp index 775f042e2..a0801d13a 100644 --- a/example/policy_eg_8.cpp +++ b/example/policy_eg_8.cpp @@ -39,7 +39,7 @@ boost/math/policies/error_handling.hpp like this: template T user_evaluation_error(const char* function, const char* message, const T& val); template - T user_rounding_error(const char* function, const char* message, const T& val, const TargetType& t); + TargetType user_rounding_error(const char* function, const char* message, const T& val, const TargetType& t); template T user_indeterminate_result_error(const char* function, const char* message, const T& val); diff --git a/include/boost/math/policies/error_handling.hpp b/include/boost/math/policies/error_handling.hpp index 38fd949e4..b4106b868 100644 --- a/include/boost/math/policies/error_handling.hpp +++ b/include/boost/math/policies/error_handling.hpp @@ -74,7 +74,7 @@ T user_denorm_error(const char* function, const char* message, const T& val); template T user_evaluation_error(const char* function, const char* message, const T& val); template -T user_rounding_error(const char* function, const char* message, const T& val, const TargetType& t); +TargetType user_rounding_error(const char* function, const char* message, const T& val, const TargetType& t); template T user_indeterminate_result_error(const char* function, const char* message, const T& val); @@ -561,7 +561,7 @@ inline constexpr TargetType raise_rounding_error( { // This may or may not do the right thing, but the user asked for the error // to be ignored so here we go anyway: - static_assert(std::numeric_limits::is_specialized, "The target type must be specialized."); + static_assert(std::numeric_limits::is_specialized, "The target type must have std::numeric_limits specialized."); return val > 0 ? (std::numeric_limits::max)() : (std::numeric_limits::is_integer ? (std::numeric_limits::min)() : -(std::numeric_limits::max)()); } @@ -576,24 +576,9 @@ inline TargetType raise_rounding_error( errno = ERANGE; // This may or may not do the right thing, but the user asked for the error // to be silent so here we go anyway: - static_assert(std::numeric_limits::is_specialized, "The target type must be specialized."); + static_assert(std::numeric_limits::is_specialized, "The target type must have std::numeric_limits specialized."); return val > 0 ? (std::numeric_limits::max)() : (std::numeric_limits::is_integer ? (std::numeric_limits::min)() : -(std::numeric_limits::max)()); } - -template -inline T raise_rounding_error( - const char* , - const char* , - const T& val, - const T&, - const ::boost::math::policies::rounding_error< ::boost::math::policies::errno_on_error>&) BOOST_MATH_NOEXCEPT(T) -{ - errno = ERANGE; - // This may or may not do the right thing, but the user asked for the error - // to be silent so here we go anyway: - return val > 0 ? boost::math::tools::max_value() : -boost::math::tools::max_value(); -} - template inline TargetType raise_rounding_error( const char* function,