|
Boost-Commit : |
From: bruno.lalande_at_[hidden]
Date: 2008-06-05 18:03:28
Author: bruno.lalande
Date: 2008-06-05 18:03:27 EDT (Thu, 05 Jun 2008)
New Revision: 46182
URL: http://svn.boost.org/trac/boost/changeset/46182
Log:
Added undeterminate_result_error, and used it for the pow<0>(0) case.
Text files modified:
sandbox/math_toolkit/boost/math/policies/error_handling.hpp | 62 ++++++++++++++++++++++++++++++++++++++++
sandbox/math_toolkit/boost/math/policies/policy.hpp | 9 +++++
sandbox/math_toolkit/boost/math/special_functions/pow.hpp | 30 ++++++++++++++-----
sandbox/math_toolkit/libs/math/test/pow_test.cpp | 15 ++++++++-
sandbox/math_toolkit/libs/math/test/test_error_handling.cpp | 33 +++++++++++++++++++-
sandbox/math_toolkit/libs/math/test/test_policy.cpp | 42 ++++++++++++++++++++------
sandbox/math_toolkit/libs/math/test/test_policy_2.cpp | 14 ++++++--
7 files changed, 178 insertions(+), 27 deletions(-)
Modified: sandbox/math_toolkit/boost/math/policies/error_handling.hpp
==============================================================================
--- sandbox/math_toolkit/boost/math/policies/error_handling.hpp (original)
+++ sandbox/math_toolkit/boost/math/policies/error_handling.hpp 2008-06-05 18:03:27 EDT (Thu, 05 Jun 2008)
@@ -62,6 +62,8 @@
T user_evaluation_error(const char* function, const char* message, const T& val);
template <class T>
T user_rounding_error(const char* function, const char* message, const T& val);
+template <class T>
+T user_undeterminate_result_error(const char* function, const char* message, const T& val);
namespace detail
{
@@ -426,6 +428,57 @@
return user_rounding_error(function, message, val);
}
+template <class T, class R>
+inline T raise_undeterminate_result_error(
+ const char* function,
+ const char* message,
+ const T& val,
+ const R& ,
+ const ::boost::math::policies::undeterminate_result_error< ::boost::math::policies::throw_on_error>&)
+{
+ raise_error<std::domain_error, T>(function, message, val);
+ // we never get here:
+ return std::numeric_limits<T>::quiet_NaN();
+}
+
+template <class T, class R>
+inline T raise_undeterminate_result_error(
+ const char* ,
+ const char* ,
+ const T& ,
+ const R& result,
+ const ::boost::math::policies::undeterminate_result_error< ::boost::math::policies::ignore_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:
+ return result;
+}
+
+template <class T, class R>
+inline T raise_undeterminate_result_error(
+ const char* ,
+ const char* ,
+ const T& ,
+ const R& result,
+ const ::boost::math::policies::undeterminate_result_error< ::boost::math::policies::errno_on_error>&)
+{
+ errno = EDOM;
+ // 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 result;
+}
+
+template <class T, class R>
+inline T raise_undeterminate_result_error(
+ const char* function,
+ const char* message,
+ const T& val,
+ const R& ,
+ const ::boost::math::policies::undeterminate_result_error< ::boost::math::policies::user_error>&)
+{
+ return user_undeterminate_result_error(function, message, val);
+}
+
} // namespace detail
template <class T, class Policy>
@@ -492,6 +545,15 @@
val, policy_type());
}
+template <class T, class R, class Policy>
+inline T raise_undeterminate_result_error(const char* function, const char* message, const T& val, const R& result, const Policy&)
+{
+ typedef typename Policy::undeterminate_result_error_type policy_type;
+ return detail::raise_undeterminate_result_error(
+ function, message ? message : "Undeterminate result with value %1%",
+ val, result, policy_type());
+}
+
//
// checked_narrowing_cast:
//
Modified: sandbox/math_toolkit/boost/math/policies/policy.hpp
==============================================================================
--- sandbox/math_toolkit/boost/math/policies/policy.hpp (original)
+++ sandbox/math_toolkit/boost/math/policies/policy.hpp 2008-06-05 18:03:27 EDT (Thu, 05 Jun 2008)
@@ -63,6 +63,9 @@
#ifndef BOOST_MATH_DENORM_ERROR_POLICY
#define BOOST_MATH_DENORM_ERROR_POLICY ignore_error
#endif
+#ifndef BOOST_MATH_UNDETERMINATE_RESULT_ERROR_POLICY
+#define BOOST_MATH_UNDETERMINATE_RESULT_ERROR_POLICY ignore_error
+#endif
#ifndef BOOST_MATH_DIGITS10_POLICY
#define BOOST_MATH_DIGITS10_POLICY 0
#endif
@@ -182,6 +185,7 @@
BOOST_MATH_META_INT(error_policy_type, denorm_error, BOOST_MATH_DENORM_ERROR_POLICY)
BOOST_MATH_META_INT(error_policy_type, evaluation_error, BOOST_MATH_EVALUATION_ERROR_POLICY)
BOOST_MATH_META_INT(error_policy_type, rounding_error, BOOST_MATH_ROUNDING_ERROR_POLICY)
+BOOST_MATH_META_INT(error_policy_type, undeterminate_result_error, BOOST_MATH_UNDETERMINATE_RESULT_ERROR_POLICY)
//
// Policy types for internal promotion:
@@ -403,6 +407,7 @@
typedef typename detail::find_arg<arg_list, is_denorm_error<mpl::_1>, denorm_error<> >::type denorm_error_type;
typedef typename detail::find_arg<arg_list, is_evaluation_error<mpl::_1>, evaluation_error<> >::type evaluation_error_type;
typedef typename detail::find_arg<arg_list, is_rounding_error<mpl::_1>, rounding_error<> >::type rounding_error_type;
+ typedef typename detail::find_arg<arg_list, is_undeterminate_result_error<mpl::_1>, undeterminate_result_error<> >::type undeterminate_result_error_type;
private:
//
// Now work out the precision:
@@ -446,6 +451,7 @@
typedef denorm_error<> denorm_error_type;
typedef evaluation_error<> evaluation_error_type;
typedef rounding_error<> rounding_error_type;
+ typedef undeterminate_result_error<> undeterminate_result_error_type;
#if BOOST_MATH_DIGITS10_POLICY == 0
typedef digits2<> precision_type;
#else
@@ -470,6 +476,7 @@
typedef denorm_error<> denorm_error_type;
typedef evaluation_error<> evaluation_error_type;
typedef rounding_error<> rounding_error_type;
+ typedef undeterminate_result_error<> undeterminate_result_error_type;
#if BOOST_MATH_DIGITS10_POLICY == 0
typedef digits2<> precision_type;
#else
@@ -508,6 +515,7 @@
typedef typename detail::find_arg<arg_list, is_denorm_error<mpl::_1>, typename Policy::denorm_error_type >::type denorm_error_type;
typedef typename detail::find_arg<arg_list, is_evaluation_error<mpl::_1>, typename Policy::evaluation_error_type >::type evaluation_error_type;
typedef typename detail::find_arg<arg_list, is_rounding_error<mpl::_1>, typename Policy::rounding_error_type >::type rounding_error_type;
+ typedef typename detail::find_arg<arg_list, is_undeterminate_result_error<mpl::_1>, typename Policy::undeterminate_result_error_type >::type undeterminate_result_error_type;
//
// Now work out the precision:
//
@@ -543,6 +551,7 @@
denorm_error_type,
evaluation_error_type,
rounding_error_type,
+ undeterminate_result_error_type,
precision_type,
promote_float_type,
promote_double_type,
Modified: sandbox/math_toolkit/boost/math/special_functions/pow.hpp
==============================================================================
--- sandbox/math_toolkit/boost/math/special_functions/pow.hpp (original)
+++ sandbox/math_toolkit/boost/math/special_functions/pow.hpp 2008-06-05 18:03:27 EDT (Thu, 05 Jun 2008)
@@ -51,14 +51,6 @@
};
template <>
-struct positive_power<0, 0>
-{
- template <typename T>
- static typename tools::promote_args<T>::type result(T)
- { return T(1); }
-};
-
-template <>
struct positive_power<1, 1>
{
template <typename T>
@@ -95,6 +87,28 @@
}
};
+template <>
+struct power_if_positive<0, true>
+{
+ template <typename T, class Policy>
+ static typename tools::promote_args<T>::type
+ result(T base, const Policy& policy)
+ {
+ if (base == 0)
+ {
+ return policies::raise_undeterminate_result_error<T>(
+ "boost::math::pow(%1%)",
+ "The result of pow<0>(%1%) is undetermined",
+ base,
+ T(1),
+ policy
+ );
+ }
+
+ return T(1);
+ }
+};
+
template <int N>
struct select_power_if_positive
Modified: sandbox/math_toolkit/libs/math/test/pow_test.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/test/pow_test.cpp (original)
+++ sandbox/math_toolkit/libs/math/test/pow_test.cpp 2008-06-05 18:03:27 EDT (Thu, 05 Jun 2008)
@@ -115,7 +115,13 @@
namespace boost { namespace math { namespace policies {
template <class T>
T user_overflow_error(const char*, const char*, const T&)
-{ return 123.456; }
+{ return T(123.456); }
+}}}
+
+namespace boost { namespace math { namespace policies {
+template <class T>
+T user_undeterminate_result_error(const char*, const char*, const T&)
+{ return T(456.789); }
}}}
@@ -128,6 +134,12 @@
policy< ::boost::math::policies::overflow_error<user_error> >()
)
== 123.456);
+
+ BOOST_CHECK(pow<0>(
+ 0.0,
+ policy< ::boost::math::policies::undeterminate_result_error<user_error> >()
+ )
+ == 456.789);
}
int test_main(int, char* [])
@@ -187,4 +199,3 @@
return 0;
}
-
Modified: sandbox/math_toolkit/libs/math/test/test_error_handling.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/test/test_error_handling.cpp (original)
+++ sandbox/math_toolkit/libs/math/test/test_error_handling.cpp 2008-06-05 18:03:27 EDT (Thu, 05 Jun 2008)
@@ -53,6 +53,12 @@
throw user_defined_error();
}
+template <class T>
+T user_undeterminate_result_error(const char* , const char* , const T& )
+{
+ throw user_defined_error();
+}
+
}}} // namespaces
#include <boost/math/concepts/real_concept.hpp>
@@ -69,21 +75,32 @@
overflow_error<throw_on_error>,
underflow_error<throw_on_error>,
denorm_error<throw_on_error>,
- evaluation_error<throw_on_error> > throw_policy;
+ evaluation_error<throw_on_error>,
+ undeterminate_result_error<throw_on_error> > throw_policy;
policy<
domain_error<errno_on_error>,
pole_error<errno_on_error>,
overflow_error<errno_on_error>,
underflow_error<errno_on_error>,
denorm_error<errno_on_error>,
- evaluation_error<errno_on_error> > errno_policy;
+ evaluation_error<errno_on_error>,
+ undeterminate_result_error<errno_on_error> > errno_policy;
+policy<
+ domain_error<ignore_error>,
+ pole_error<ignore_error>,
+ overflow_error<ignore_error>,
+ underflow_error<ignore_error>,
+ denorm_error<ignore_error>,
+ evaluation_error<ignore_error>,
+ undeterminate_result_error<ignore_error> > ignore_policy;
policy<
domain_error<user_error>,
pole_error<user_error>,
overflow_error<user_error>,
underflow_error<user_error>,
denorm_error<user_error>,
- evaluation_error<user_error> > user_policy;
+ evaluation_error<user_error>,
+ undeterminate_result_error<user_error> > user_policy;
policy<> default_policy;
#define TEST_EXCEPTION(expression, exception)\
@@ -112,6 +129,8 @@
TEST_EXCEPTION(boost::math::policies::raise_denorm_error<T>(func, 0, T(0), throw_policy), std::underflow_error);
TEST_EXCEPTION(boost::math::policies::raise_evaluation_error(func, msg1, T(1.25), throw_policy), boost::math::evaluation_error);
TEST_EXCEPTION(boost::math::policies::raise_evaluation_error(func, 0, T(1.25), throw_policy), boost::math::evaluation_error);
+ TEST_EXCEPTION(boost::math::policies::raise_undeterminate_result_error(func, msg1, T(1.25), T(12.34), throw_policy), std::domain_error);
+ TEST_EXCEPTION(boost::math::policies::raise_undeterminate_result_error(func, 0, T(1.25), T(12.34), throw_policy), std::domain_error);
//
// Now try user error handlers: these should all throw user_error():
// - because by design these are undefined and must be defined by the user ;-)
@@ -121,7 +140,15 @@
BOOST_CHECK_THROW(boost::math::policies::raise_underflow_error<T>(func, msg2, user_policy), user_defined_error);
BOOST_CHECK_THROW(boost::math::policies::raise_denorm_error<T>(func, msg2, T(0), user_policy), user_defined_error);
BOOST_CHECK_THROW(boost::math::policies::raise_evaluation_error(func, msg1, T(0.0), user_policy), user_defined_error);
+ BOOST_CHECK_THROW(boost::math::policies::raise_undeterminate_result_error(func, msg1, T(0.0), T(0.0), user_policy), user_defined_error);
+
+ // Test with ignore_error
+ BOOST_CHECK(boost::math::policies::raise_undeterminate_result_error(func, 0, T(0.0), T(12.34), ignore_policy) == T(12.34));
+ // Test with errno_on_error
+ errno = 0;
+ BOOST_CHECK(boost::math::policies::raise_undeterminate_result_error(func, 0, T(0.0), T(12.34), errno_policy) == T(12.34));
+ BOOST_CHECK(errno == EDOM);
}
int test_main(int, char* [])
Modified: sandbox/math_toolkit/libs/math/test/test_policy.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/test/test_policy.cpp (original)
+++ sandbox/math_toolkit/libs/math/test/test_policy.cpp 2008-06-05 18:03:27 EDT (Thu, 05 Jun 2008)
@@ -35,112 +35,134 @@
BOOST_CHECK((is_same<policy<>::domain_error_type, domain_error<BOOST_MATH_DOMAIN_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<policy<>::evaluation_error_type, evaluation_error<BOOST_MATH_EVALUATION_ERROR_POLICY> >::value));
-
+
BOOST_CHECK((is_same<policy<domain_error<ignore_error> >::domain_error_type, domain_error<ignore_error> >::value));
BOOST_CHECK((is_same<policy<domain_error<ignore_error> >::pole_error_type, pole_error<BOOST_MATH_POLE_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<policy<domain_error<ignore_error> >::overflow_error_type, overflow_error<BOOST_MATH_OVERFLOW_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<policy<domain_error<ignore_error> >::underflow_error_type, underflow_error<BOOST_MATH_UNDERFLOW_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<policy<domain_error<ignore_error> >::denorm_error_type, denorm_error<BOOST_MATH_DENORM_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<policy<domain_error<ignore_error> >::evaluation_error_type, evaluation_error<BOOST_MATH_EVALUATION_ERROR_POLICY> >::value));
+ BOOST_CHECK((is_same<policy<domain_error<ignore_error> >::undeterminate_result_error_type, undeterminate_result_error<BOOST_MATH_UNDETERMINATE_RESULT_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<policy<domain_error<ignore_error> >::precision_type, policy<>::precision_type>::value));
BOOST_CHECK((is_same<policy<domain_error<ignore_error> >::promote_float_type, policy<>::promote_float_type>::value));
BOOST_CHECK((is_same<policy<domain_error<ignore_error> >::promote_double_type, policy<>::promote_double_type>::value));
BOOST_CHECK((is_same<policy<domain_error<ignore_error> >::discrete_quantile_type, policy<>::discrete_quantile_type>::value));
-
+
BOOST_CHECK((is_same<policy<pole_error<user_error> >::domain_error_type, policy<>::domain_error_type >::value));
BOOST_CHECK((is_same<policy<pole_error<user_error> >::pole_error_type, pole_error<user_error> >::value));
BOOST_CHECK((is_same<policy<pole_error<user_error> >::overflow_error_type, overflow_error<BOOST_MATH_OVERFLOW_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<policy<pole_error<user_error> >::underflow_error_type, underflow_error<BOOST_MATH_UNDERFLOW_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<policy<pole_error<user_error> >::denorm_error_type, denorm_error<BOOST_MATH_DENORM_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<policy<pole_error<user_error> >::evaluation_error_type, evaluation_error<BOOST_MATH_EVALUATION_ERROR_POLICY> >::value));
+ BOOST_CHECK((is_same<policy<pole_error<user_error> >::undeterminate_result_error_type, undeterminate_result_error<BOOST_MATH_UNDETERMINATE_RESULT_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<policy<pole_error<user_error> >::precision_type, policy<>::precision_type>::value));
BOOST_CHECK((is_same<policy<pole_error<user_error> >::promote_float_type, policy<>::promote_float_type>::value));
BOOST_CHECK((is_same<policy<pole_error<user_error> >::promote_double_type, policy<>::promote_double_type>::value));
BOOST_CHECK((is_same<policy<pole_error<user_error> >::discrete_quantile_type, policy<>::discrete_quantile_type>::value));
-
+
BOOST_CHECK((is_same<policy<overflow_error<errno_on_error> >::domain_error_type, policy<>::domain_error_type >::value));
BOOST_CHECK((is_same<policy<overflow_error<errno_on_error> >::pole_error_type, policy<>::pole_error_type >::value));
BOOST_CHECK((is_same<policy<overflow_error<errno_on_error> >::overflow_error_type, overflow_error<errno_on_error> >::value));
BOOST_CHECK((is_same<policy<overflow_error<errno_on_error> >::underflow_error_type, underflow_error<BOOST_MATH_UNDERFLOW_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<policy<overflow_error<errno_on_error> >::denorm_error_type, denorm_error<BOOST_MATH_DENORM_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<policy<overflow_error<errno_on_error> >::evaluation_error_type, evaluation_error<BOOST_MATH_EVALUATION_ERROR_POLICY> >::value));
+ BOOST_CHECK((is_same<policy<overflow_error<errno_on_error> >::undeterminate_result_error_type, undeterminate_result_error<BOOST_MATH_UNDETERMINATE_RESULT_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<policy<overflow_error<errno_on_error> >::precision_type, policy<>::precision_type>::value));
BOOST_CHECK((is_same<policy<overflow_error<errno_on_error> >::promote_float_type, policy<>::promote_float_type>::value));
BOOST_CHECK((is_same<policy<overflow_error<errno_on_error> >::promote_double_type, policy<>::promote_double_type>::value));
BOOST_CHECK((is_same<policy<overflow_error<errno_on_error> >::discrete_quantile_type, policy<>::discrete_quantile_type>::value));
-
+
BOOST_CHECK((is_same<policy<underflow_error<errno_on_error> >::domain_error_type, policy<>::domain_error_type >::value));
BOOST_CHECK((is_same<policy<underflow_error<errno_on_error> >::pole_error_type, policy<>::pole_error_type >::value));
BOOST_CHECK((is_same<policy<underflow_error<errno_on_error> >::overflow_error_type, policy<>::overflow_error_type >::value));
BOOST_CHECK((is_same<policy<underflow_error<errno_on_error> >::underflow_error_type, underflow_error<errno_on_error> >::value));
BOOST_CHECK((is_same<policy<underflow_error<errno_on_error> >::denorm_error_type, denorm_error<BOOST_MATH_DENORM_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<policy<underflow_error<errno_on_error> >::evaluation_error_type, evaluation_error<BOOST_MATH_EVALUATION_ERROR_POLICY> >::value));
+ BOOST_CHECK((is_same<policy<underflow_error<errno_on_error> >::undeterminate_result_error_type, undeterminate_result_error<BOOST_MATH_UNDETERMINATE_RESULT_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<policy<underflow_error<errno_on_error> >::precision_type, policy<>::precision_type>::value));
BOOST_CHECK((is_same<policy<underflow_error<errno_on_error> >::promote_float_type, policy<>::promote_float_type>::value));
BOOST_CHECK((is_same<policy<underflow_error<errno_on_error> >::promote_double_type, policy<>::promote_double_type>::value));
BOOST_CHECK((is_same<policy<underflow_error<errno_on_error> >::discrete_quantile_type, policy<>::discrete_quantile_type>::value));
-
+
BOOST_CHECK((is_same<policy<denorm_error<errno_on_error> >::domain_error_type, policy<>::domain_error_type >::value));
BOOST_CHECK((is_same<policy<denorm_error<errno_on_error> >::pole_error_type, policy<>::pole_error_type >::value));
BOOST_CHECK((is_same<policy<denorm_error<errno_on_error> >::overflow_error_type, policy<>::overflow_error_type >::value));
BOOST_CHECK((is_same<policy<denorm_error<errno_on_error> >::underflow_error_type, policy<>::underflow_error_type >::value));
BOOST_CHECK((is_same<policy<denorm_error<errno_on_error> >::denorm_error_type, denorm_error<errno_on_error> >::value));
BOOST_CHECK((is_same<policy<denorm_error<errno_on_error> >::evaluation_error_type, evaluation_error<BOOST_MATH_EVALUATION_ERROR_POLICY> >::value));
+ BOOST_CHECK((is_same<policy<denorm_error<errno_on_error> >::undeterminate_result_error_type, undeterminate_result_error<BOOST_MATH_UNDETERMINATE_RESULT_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<policy<denorm_error<errno_on_error> >::precision_type, policy<>::precision_type>::value));
BOOST_CHECK((is_same<policy<denorm_error<errno_on_error> >::promote_float_type, policy<>::promote_float_type>::value));
BOOST_CHECK((is_same<policy<denorm_error<errno_on_error> >::promote_double_type, policy<>::promote_double_type>::value));
BOOST_CHECK((is_same<policy<denorm_error<errno_on_error> >::discrete_quantile_type, policy<>::discrete_quantile_type>::value));
-
+
BOOST_CHECK((is_same<policy<evaluation_error<errno_on_error> >::domain_error_type, policy<>::domain_error_type >::value));
BOOST_CHECK((is_same<policy<evaluation_error<errno_on_error> >::pole_error_type, policy<>::pole_error_type >::value));
BOOST_CHECK((is_same<policy<evaluation_error<errno_on_error> >::overflow_error_type, policy<>::overflow_error_type >::value));
BOOST_CHECK((is_same<policy<evaluation_error<errno_on_error> >::underflow_error_type, policy<>::underflow_error_type >::value));
BOOST_CHECK((is_same<policy<evaluation_error<errno_on_error> >::denorm_error_type, policy<>::denorm_error_type >::value));
BOOST_CHECK((is_same<policy<evaluation_error<errno_on_error> >::evaluation_error_type, evaluation_error<errno_on_error> >::value));
+ BOOST_CHECK((is_same<policy<evaluation_error<errno_on_error> >::undeterminate_result_error_type, policy<>::undeterminate_result_error_type >::value));
BOOST_CHECK((is_same<policy<evaluation_error<errno_on_error> >::precision_type, policy<>::precision_type>::value));
BOOST_CHECK((is_same<policy<evaluation_error<errno_on_error> >::promote_float_type, policy<>::promote_float_type>::value));
BOOST_CHECK((is_same<policy<evaluation_error<errno_on_error> >::promote_double_type, policy<>::promote_double_type>::value));
BOOST_CHECK((is_same<policy<evaluation_error<errno_on_error> >::discrete_quantile_type, policy<>::discrete_quantile_type>::value));
-
+
+ BOOST_CHECK((is_same<policy<undeterminate_result_error<ignore_error> >::domain_error_type, policy<>::domain_error_type >::value));
+ BOOST_CHECK((is_same<policy<undeterminate_result_error<ignore_error> >::pole_error_type, policy<>::pole_error_type >::value));
+ BOOST_CHECK((is_same<policy<undeterminate_result_error<ignore_error> >::overflow_error_type, policy<>::overflow_error_type >::value));
+ BOOST_CHECK((is_same<policy<undeterminate_result_error<ignore_error> >::underflow_error_type, policy<>::underflow_error_type >::value));
+ BOOST_CHECK((is_same<policy<undeterminate_result_error<ignore_error> >::denorm_error_type, policy<>::denorm_error_type >::value));
+ BOOST_CHECK((is_same<policy<undeterminate_result_error<ignore_error> >::evaluation_error_type, policy<>::evaluation_error_type >::value));
+ BOOST_CHECK((is_same<policy<undeterminate_result_error<ignore_error> >::undeterminate_result_error_type, undeterminate_result_error<ignore_error> >::value));
+ BOOST_CHECK((is_same<policy<undeterminate_result_error<ignore_error> >::precision_type, policy<>::precision_type>::value));
+ BOOST_CHECK((is_same<policy<undeterminate_result_error<ignore_error> >::promote_float_type, policy<>::promote_float_type>::value));
+ BOOST_CHECK((is_same<policy<undeterminate_result_error<ignore_error> >::promote_double_type, policy<>::promote_double_type>::value));
+ BOOST_CHECK((is_same<policy<undeterminate_result_error<ignore_error> >::discrete_quantile_type, policy<>::discrete_quantile_type>::value));
+
BOOST_CHECK((is_same<policy<digits2<20> >::domain_error_type, policy<>::domain_error_type >::value));
BOOST_CHECK((is_same<policy<digits2<20> >::pole_error_type, policy<>::pole_error_type >::value));
BOOST_CHECK((is_same<policy<digits2<20> >::overflow_error_type, policy<>::overflow_error_type >::value));
BOOST_CHECK((is_same<policy<digits2<20> >::underflow_error_type, policy<>::underflow_error_type >::value));
BOOST_CHECK((is_same<policy<digits2<20> >::denorm_error_type, policy<>::denorm_error_type >::value));
BOOST_CHECK((is_same<policy<digits2<20> >::evaluation_error_type, policy<>::evaluation_error_type >::value));
+ BOOST_CHECK((is_same<policy<digits2<20> >::undeterminate_result_error_type, policy<>::undeterminate_result_error_type >::value));
BOOST_CHECK((is_same<policy<digits2<20> >::precision_type, digits2<20> >::value));
BOOST_CHECK((is_same<policy<digits2<20> >::promote_float_type, policy<>::promote_float_type>::value));
BOOST_CHECK((is_same<policy<digits2<20> >::promote_double_type, policy<>::promote_double_type>::value));
BOOST_CHECK((is_same<policy<digits2<20> >::discrete_quantile_type, policy<>::discrete_quantile_type>::value));
-
+
BOOST_CHECK((is_same<policy<promote_float<false> >::domain_error_type, policy<>::domain_error_type >::value));
BOOST_CHECK((is_same<policy<promote_float<false> >::pole_error_type, policy<>::pole_error_type >::value));
BOOST_CHECK((is_same<policy<promote_float<false> >::overflow_error_type, policy<>::overflow_error_type >::value));
BOOST_CHECK((is_same<policy<promote_float<false> >::underflow_error_type, policy<>::underflow_error_type >::value));
BOOST_CHECK((is_same<policy<promote_float<false> >::denorm_error_type, policy<>::denorm_error_type >::value));
BOOST_CHECK((is_same<policy<promote_float<false> >::evaluation_error_type, policy<>::evaluation_error_type >::value));
+ BOOST_CHECK((is_same<policy<promote_float<false> >::undeterminate_result_error_type, policy<>::undeterminate_result_error_type >::value));
BOOST_CHECK((is_same<policy<promote_float<false> >::precision_type, policy<>::precision_type >::value));
BOOST_CHECK((is_same<policy<promote_float<false> >::promote_float_type, promote_float<false> >::value));
BOOST_CHECK((is_same<policy<promote_float<false> >::promote_double_type, policy<>::promote_double_type>::value));
BOOST_CHECK((is_same<policy<promote_float<false> >::discrete_quantile_type, policy<>::discrete_quantile_type>::value));
-
+
BOOST_CHECK((is_same<policy<promote_double<false> >::domain_error_type, policy<>::domain_error_type >::value));
BOOST_CHECK((is_same<policy<promote_double<false> >::pole_error_type, policy<>::pole_error_type >::value));
BOOST_CHECK((is_same<policy<promote_double<false> >::overflow_error_type, policy<>::overflow_error_type >::value));
BOOST_CHECK((is_same<policy<promote_double<false> >::underflow_error_type, policy<>::underflow_error_type >::value));
BOOST_CHECK((is_same<policy<promote_double<false> >::denorm_error_type, policy<>::denorm_error_type >::value));
BOOST_CHECK((is_same<policy<promote_double<false> >::evaluation_error_type, policy<>::evaluation_error_type >::value));
+ BOOST_CHECK((is_same<policy<promote_double<false> >::undeterminate_result_error_type, policy<>::undeterminate_result_error_type >::value));
BOOST_CHECK((is_same<policy<promote_double<false> >::precision_type, policy<>::precision_type >::value));
BOOST_CHECK((is_same<policy<promote_double<false> >::promote_float_type, policy<>::promote_float_type>::value));
BOOST_CHECK((is_same<policy<promote_double<false> >::promote_double_type, promote_double<false> >::value));
BOOST_CHECK((is_same<policy<promote_double<false> >::discrete_quantile_type, policy<>::discrete_quantile_type>::value));
-
+
BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::domain_error_type, policy<>::domain_error_type >::value));
BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::pole_error_type, policy<>::pole_error_type >::value));
BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::overflow_error_type, policy<>::overflow_error_type >::value));
BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::underflow_error_type, policy<>::underflow_error_type >::value));
BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::denorm_error_type, policy<>::denorm_error_type >::value));
BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::evaluation_error_type, policy<>::evaluation_error_type >::value));
+ BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::undeterminate_result_error_type, policy<>::undeterminate_result_error_type >::value));
BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::precision_type, policy<>::precision_type >::value));
BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::promote_float_type, policy<>::promote_float_type>::value));
BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::promote_double_type, policy<>::promote_double_type>::value));
Modified: sandbox/math_toolkit/libs/math/test/test_policy_2.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/test/test_policy_2.cpp (original)
+++ sandbox/math_toolkit/libs/math/test/test_policy_2.cpp 2008-06-05 18:03:27 EDT (Thu, 05 Jun 2008)
@@ -33,50 +33,55 @@
BOOST_CHECK((is_same<policy<domain_error<ignore_error>, overflow_error<ignore_error> >::underflow_error_type, underflow_error<BOOST_MATH_UNDERFLOW_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<policy<domain_error<ignore_error>, overflow_error<ignore_error> >::denorm_error_type, denorm_error<BOOST_MATH_DENORM_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<policy<domain_error<ignore_error>, overflow_error<ignore_error> >::evaluation_error_type, evaluation_error<BOOST_MATH_EVALUATION_ERROR_POLICY> >::value));
+ BOOST_CHECK((is_same<policy<domain_error<ignore_error>, overflow_error<ignore_error> >::undeterminate_result_error_type, undeterminate_result_error<BOOST_MATH_UNDETERMINATE_RESULT_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<policy<domain_error<ignore_error>, overflow_error<ignore_error> >::precision_type, policy<>::precision_type>::value));
BOOST_CHECK((is_same<policy<domain_error<ignore_error>, overflow_error<ignore_error> >::promote_float_type, policy<>::promote_float_type>::value));
BOOST_CHECK((is_same<policy<domain_error<ignore_error>, overflow_error<ignore_error> >::promote_double_type, policy<>::promote_double_type>::value));
BOOST_CHECK((is_same<policy<domain_error<ignore_error>, overflow_error<ignore_error> >::discrete_quantile_type, policy<>::discrete_quantile_type>::value));
-
+
BOOST_CHECK((is_same<policy<denorm_error<throw_on_error>, domain_error<ignore_error> >::domain_error_type, domain_error<ignore_error> >::value));
BOOST_CHECK((is_same<policy<denorm_error<throw_on_error>, domain_error<ignore_error> >::pole_error_type, pole_error<BOOST_MATH_POLE_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<policy<denorm_error<throw_on_error>, domain_error<ignore_error> >::overflow_error_type, overflow_error<BOOST_MATH_OVERFLOW_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<policy<denorm_error<throw_on_error>, domain_error<ignore_error> >::underflow_error_type, underflow_error<BOOST_MATH_UNDERFLOW_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<policy<denorm_error<throw_on_error>, domain_error<ignore_error> >::denorm_error_type, denorm_error<throw_on_error> >::value));
BOOST_CHECK((is_same<policy<denorm_error<throw_on_error>, domain_error<ignore_error> >::evaluation_error_type, evaluation_error<BOOST_MATH_EVALUATION_ERROR_POLICY> >::value));
+ BOOST_CHECK((is_same<policy<denorm_error<throw_on_error>, domain_error<ignore_error> >::undeterminate_result_error_type, undeterminate_result_error<BOOST_MATH_UNDETERMINATE_RESULT_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<policy<denorm_error<throw_on_error>, domain_error<ignore_error> >::precision_type, policy<>::precision_type>::value));
BOOST_CHECK((is_same<policy<denorm_error<throw_on_error>, domain_error<ignore_error> >::promote_float_type, policy<>::promote_float_type>::value));
BOOST_CHECK((is_same<policy<denorm_error<throw_on_error>, domain_error<ignore_error> >::promote_double_type, policy<>::promote_double_type>::value));
BOOST_CHECK((is_same<policy<denorm_error<throw_on_error>, domain_error<ignore_error> >::discrete_quantile_type, policy<>::discrete_quantile_type>::value));
-
+
BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::domain_error_type, domain_error<ignore_error> >::value));
BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::pole_error_type, pole_error<BOOST_MATH_POLE_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::overflow_error_type, overflow_error<BOOST_MATH_OVERFLOW_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::underflow_error_type, underflow_error<BOOST_MATH_UNDERFLOW_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::denorm_error_type, denorm_error<throw_on_error> >::value));
BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::evaluation_error_type, evaluation_error<BOOST_MATH_EVALUATION_ERROR_POLICY> >::value));
+ BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::undeterminate_result_error_type, undeterminate_result_error<BOOST_MATH_UNDETERMINATE_RESULT_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::precision_type, digits2<20> >::value));
BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::promote_float_type, promote_float<false> >::value));
BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::promote_double_type, policy<>::promote_double_type>::value));
BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::discrete_quantile_type, discrete_quantile<integer_round_down> >::value));
-
+
BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::domain_error_type, domain_error<ignore_error> >::value));
BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::pole_error_type, pole_error<BOOST_MATH_POLE_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::overflow_error_type, overflow_error<BOOST_MATH_OVERFLOW_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::underflow_error_type, underflow_error<BOOST_MATH_UNDERFLOW_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::denorm_error_type, denorm_error<throw_on_error> >::value));
BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::evaluation_error_type, evaluation_error<BOOST_MATH_EVALUATION_ERROR_POLICY> >::value));
+ BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::undeterminate_result_error_type, undeterminate_result_error<BOOST_MATH_UNDETERMINATE_RESULT_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::precision_type, digits2<20> >::value));
BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::promote_float_type, promote_float<false> >::value));
BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::promote_double_type, policy<>::promote_double_type>::value));
BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::discrete_quantile_type, discrete_quantile<integer_round_down> >::value));
-
+
BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::domain_error_type, domain_error<ignore_error> >::value));
BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::pole_error_type, pole_error<BOOST_MATH_POLE_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::overflow_error_type, overflow_error<BOOST_MATH_OVERFLOW_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::underflow_error_type, underflow_error<BOOST_MATH_UNDERFLOW_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::denorm_error_type, denorm_error<throw_on_error> >::value));
BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::evaluation_error_type, evaluation_error<BOOST_MATH_EVALUATION_ERROR_POLICY> >::value));
+ BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::undeterminate_result_error_type, undeterminate_result_error<BOOST_MATH_UNDETERMINATE_RESULT_ERROR_POLICY> >::value));
BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::precision_type, digits2<20> >::value));
BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::promote_float_type, promote_float<false> >::value));
BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::promote_double_type, policy<>::promote_double_type>::value));
@@ -88,6 +93,7 @@
BOOST_CHECK(check_same(make_policy(promote_float<false>()), normalise<policy<promote_float<false> > >::type()));
BOOST_CHECK(check_same(make_policy(domain_error<ignore_error>()), normalise<policy<domain_error<ignore_error> > >::type()));
BOOST_CHECK(check_same(make_policy(pole_error<ignore_error>()), normalise<policy<pole_error<ignore_error> > >::type()));
+ BOOST_CHECK(check_same(make_policy(undeterminate_result_error<ignore_error>()), normalise<policy<undeterminate_result_error<ignore_error> > >::type()));
BOOST_CHECK(check_same(make_policy(domain_error<ignore_error>()), policy<domain_error<ignore_error> >()));
BOOST_CHECK(check_same(make_policy(domain_error<ignore_error>(), pole_error<ignore_error>()), policy<domain_error<ignore_error>, pole_error<ignore_error> >()));
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk