|
Boost-Commit : |
From: johnmaddock_at_[hidden]
Date: 2007-07-18 05:35:51
Author: johnmaddock
Date: 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
New Revision: 7464
URL: http://svn.boost.org/trac/boost/changeset/7464
Log:
Finished updating the special-functions to use policy-based framework, removed dead code.
Removed:
sandbox/math_toolkit/policy/boost/math/tools/error_handling.hpp
sandbox/math_toolkit/policy/boost/math/tools/evaluation_type.hpp
sandbox/math_toolkit/policy/libs/math/test/compile_test/tools_error_handling_inc_test.cpp
sandbox/math_toolkit/policy/libs/math/test/compile_test/tools_evaluation_type_inc_test.cpp
Text files modified:
sandbox/math_toolkit/policy/boost/math/concepts/real_concept.hpp | 14 -----
sandbox/math_toolkit/policy/boost/math/concepts/std_real_concept.hpp | 9 ---
sandbox/math_toolkit/policy/boost/math/distributions/binomial.hpp | 2
sandbox/math_toolkit/policy/boost/math/distributions/chi_squared.hpp | 2
sandbox/math_toolkit/policy/boost/math/distributions/detail/common_error_handling.hpp | 1
sandbox/math_toolkit/policy/boost/math/distributions/detail/inv_discrete_quantile.hpp | 6 +
sandbox/math_toolkit/policy/boost/math/distributions/poisson.hpp | 1
sandbox/math_toolkit/policy/boost/math/distributions/students_t.hpp | 2
sandbox/math_toolkit/policy/boost/math/policy/error_handling.hpp | 5 +
sandbox/math_toolkit/policy/boost/math/policy/policy.hpp | 25 +++++-----
sandbox/math_toolkit/policy/boost/math/special_functions/bessel.hpp | 1
sandbox/math_toolkit/policy/boost/math/special_functions/detail/igamma_inverse.hpp | 6 +-
sandbox/math_toolkit/policy/boost/math/special_functions/detail/t_distribution_inv.hpp | 2
sandbox/math_toolkit/policy/boost/math/special_functions/digamma.hpp | 1
sandbox/math_toolkit/policy/boost/math/special_functions/erf.hpp | 4
sandbox/math_toolkit/policy/boost/math/special_functions/expm1.hpp | 4
sandbox/math_toolkit/policy/boost/math/special_functions/gamma.hpp | 13 +++--
sandbox/math_toolkit/policy/boost/math/special_functions/hermite.hpp | 15 ++++-
sandbox/math_toolkit/policy/boost/math/special_functions/laguerre.hpp | 66 ++++++++++++++++++++++++----
sandbox/math_toolkit/policy/boost/math/special_functions/lanczos.hpp | 90 ----------------------------------------
sandbox/math_toolkit/policy/boost/math/special_functions/legendre.hpp | 79 ++++++++++++++++++++++------------
sandbox/math_toolkit/policy/boost/math/special_functions/log1p.hpp | 2
sandbox/math_toolkit/policy/boost/math/special_functions/sinhc.hpp | 5 ++
sandbox/math_toolkit/policy/boost/math/special_functions/spherical_harmonic.hpp | 64 +++++++++++++++++++---------
sandbox/math_toolkit/policy/boost/math/tools/config.hpp | 10 ----
sandbox/math_toolkit/policy/boost/math/tools/minima.hpp | 3
sandbox/math_toolkit/policy/boost/math/tools/ntl.hpp | 6 +-
sandbox/math_toolkit/policy/boost/math/tools/precision.hpp | 14 -----
sandbox/math_toolkit/policy/boost/math/tools/remez.hpp | 9 ++-
sandbox/math_toolkit/policy/boost/math/tools/roots.hpp | 5 +
sandbox/math_toolkit/policy/boost/math/tools/test.hpp | 1
sandbox/math_toolkit/policy/boost/math/tools/toms748_solve.hpp | 11 +++-
sandbox/math_toolkit/policy/libs/math/test/Jamfile.v2 | 5 +
sandbox/math_toolkit/policy/libs/math/test/test_bessel_i.cpp | 2
sandbox/math_toolkit/policy/libs/math/test/test_bessel_j.cpp | 2
sandbox/math_toolkit/policy/libs/math/test/test_bessel_k.cpp | 2
sandbox/math_toolkit/policy/libs/math/test/test_bessel_y.cpp | 2
sandbox/math_toolkit/policy/libs/math/test/test_binomial_coeff.cpp | 2
sandbox/math_toolkit/policy/libs/math/test/test_carlson.cpp | 4
sandbox/math_toolkit/policy/libs/math/test/test_ellint_1.cpp | 2
sandbox/math_toolkit/policy/libs/math/test/test_ellint_2.cpp | 2
sandbox/math_toolkit/policy/libs/math/test/test_ellint_3.cpp | 2
sandbox/math_toolkit/policy/libs/math/test/test_factorials.cpp | 2
sandbox/math_toolkit/policy/libs/math/test/test_gamma.cpp | 2
sandbox/math_toolkit/policy/libs/math/test/test_hermite.cpp | 2
sandbox/math_toolkit/policy/libs/math/test/test_ibeta.cpp | 2
sandbox/math_toolkit/policy/libs/math/test/test_ibeta_inv.cpp | 6 +-
sandbox/math_toolkit/policy/libs/math/test/test_ibeta_inv_ab.cpp | 6 +-
sandbox/math_toolkit/policy/libs/math/test/test_igamma.cpp | 2
sandbox/math_toolkit/policy/libs/math/test/test_igamma_inv.cpp | 6 +-
sandbox/math_toolkit/policy/libs/math/test/test_igamma_inva.cpp | 6 +-
sandbox/math_toolkit/policy/libs/math/test/test_laguerre.cpp | 2
sandbox/math_toolkit/policy/libs/math/test/test_legendre.cpp | 2
sandbox/math_toolkit/policy/libs/math/test/test_policy.cpp | 60 +++++++++++++-------------
sandbox/math_toolkit/policy/libs/math/test/test_rational.hpp | 1
sandbox/math_toolkit/policy/libs/math/test/test_rational_double.cpp | 1
sandbox/math_toolkit/policy/libs/math/test/test_rational_float.cpp | 1
sandbox/math_toolkit/policy/libs/math/test/test_rational_ldouble.cpp | 1
sandbox/math_toolkit/policy/libs/math/test/test_rationals.cpp | 1
sandbox/math_toolkit/policy/libs/math/test/test_remez.cpp | 6 ++
sandbox/math_toolkit/policy/libs/math/test/test_roots.cpp | 4
sandbox/math_toolkit/policy/libs/math/test/test_spherical_harmonic.cpp | 2
sandbox/math_toolkit/policy/libs/math/test/test_tgamma_ratio.cpp | 2
sandbox/math_toolkit/policy/libs/math/tools/ibeta_data.cpp | 2
64 files changed, 307 insertions(+), 315 deletions(-)
Modified: sandbox/math_toolkit/policy/boost/math/concepts/real_concept.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/concepts/real_concept.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/concepts/real_concept.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -323,18 +323,6 @@
return tools::epsilon<long double>();
}
-template <>
-inline int digits<concepts::real_concept>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
-{ // Assume number of significand bits is same as long double,
- // unless std::numeric_limits<T>::is_specialized to provide digits.
- return tools::digits<long double>();
- // Note that if numeric_limits real concept is NOT specialized to provide digits10
- // (or max_digits10) then the default precision of 6 decimal digits will be used
- // by Boost test (giving misleading error messages like
- // "difference between {9.79796} and {9.79796} exceeds 5.42101e-19%"
- // and by Boost lexical cast and serialization causing loss of accuracy.
-}
-
} // namespace tools
namespace policy{
@@ -343,7 +331,7 @@
inline int digits<concepts::real_concept, policy<> >(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
{ // Assume number of significand bits is same as long double,
// unless std::numeric_limits<T>::is_specialized to provide digits.
- return tools::digits<long double>();
+ return boost::math::policy::digits<long double, boost::math::policy::policy<> >();
// Note that if numeric_limits real concept is NOT specialized to provide digits10
// (or max_digits10) then the default precision of 6 decimal digits will be used
// by Boost test (giving misleading error messages like
Modified: sandbox/math_toolkit/policy/boost/math/concepts/std_real_concept.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/concepts/std_real_concept.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/concepts/std_real_concept.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -329,13 +329,6 @@
return tools::epsilon<long double>();
}
-template <>
-inline int digits<concepts::std_real_concept>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
-{ // Assume number of significand bits is same as long double,
- // unless std::numeric_limits<T>::is_specialized to provide digits.
- return tools::digits<long double>();
-}
-
} // namespace tools
namespace policy{
@@ -344,7 +337,7 @@
inline int digits<concepts::std_real_concept, boost::math::policy::policy<> >(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
{ // Assume number of significand bits is same as long double,
// unless std::numeric_limits<T>::is_specialized to provide digits.
- return tools::digits<long double>();
+ return digits<long double, policy<> >();
}
template <>
inline int digits<concepts::std_real_concept, policy<detail::forwarding_arg1, detail::forwarding_arg2 > >(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
Modified: sandbox/math_toolkit/policy/boost/math/distributions/binomial.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/distributions/binomial.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/distributions/binomial.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -523,7 +523,6 @@
// P = I[1-p]( n-k, k+1).
// = 1 - I[p](k + 1, n - k)
- using boost::math::tools::domain_error;
using namespace std; // for ADL of std functions
RealType n = dist.trials();
@@ -596,7 +595,6 @@
// Q = 1 -I[1-p]( n-k, k+1).
// = I[p](k + 1, n - k)
- using boost::math::tools::domain_error;
using namespace std; // for ADL of std functions
RealType const& k = c.param;
Modified: sandbox/math_toolkit/policy/boost/math/distributions/chi_squared.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/distributions/chi_squared.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/distributions/chi_squared.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -292,7 +292,7 @@
RealType error_result;
if(false == detail::check_probability(
function, alpha, &error_result, Policy())
- && detail::check_probability(BOOST_CURRENT_FUNCTION, beta, &error_result, Policy()))
+ && detail::check_probability(function, beta, &error_result, Policy()))
return error_result;
if(hint <= 0)
Modified: sandbox/math_toolkit/policy/boost/math/distributions/detail/common_error_handling.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/distributions/detail/common_error_handling.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/distributions/detail/common_error_handling.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -8,7 +8,6 @@
#ifndef BOOST_MATH_DISTRIBUTIONS_COMMON_ERROR_HANDLING_HPP
#define BOOST_MATH_DISTRIBUTIONS_COMMON_ERROR_HANDLING_HPP
-#include <boost/math/tools/error_handling.hpp>
#include <boost/math/policy/error_handling.hpp>
#include <boost/math/special_functions/fpclassify.hpp>
Modified: sandbox/math_toolkit/policy/boost/math/distributions/detail/inv_discrete_quantile.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/distributions/detail/inv_discrete_quantile.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/distributions/detail/inv_discrete_quantile.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -83,6 +83,8 @@
typedef typename Dist::value_type value_type;
typedef typename Dist::policy_type policy_type;
+ static const char* function = "boost::math::do_inverse_discrete_quantile<%1%>";
+
using namespace std;
distribution_quantile_finder<Dist> f(dist, p, q);
@@ -209,7 +211,7 @@
while(sign(fb) == sign(fa))
{
if(count == 0)
- policy::raise_evaluation_error(BOOST_CURRENT_FUNCTION, "Unable to bracket root, last nearest value was %1%", b, policy_type());
+ policy::raise_evaluation_error(function, "Unable to bracket root, last nearest value was %1%", b, policy_type());
a = b;
fa = fb;
b *= multiplier;
@@ -236,7 +238,7 @@
return 0;
}
if(count == 0)
- policy::raise_evaluation_error(BOOST_CURRENT_FUNCTION, "Unable to bracket root, last nearest value was %1%", a, policy_type());
+ policy::raise_evaluation_error(function, "Unable to bracket root, last nearest value was %1%", a, policy_type());
b = a;
fb = fa;
a /= multiplier;
Modified: sandbox/math_toolkit/policy/boost/math/distributions/poisson.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/distributions/poisson.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/distributions/poisson.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -321,7 +321,6 @@
// Probability that there are EXACTLY k occurrences (or arrivals).
BOOST_FPU_EXCEPTION_GUARD
- using boost::math::tools::domain_error;
using namespace std; // for ADL of std functions.
RealType mean = dist.mean();
Modified: sandbox/math_toolkit/policy/boost/math/distributions/students_t.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/distributions/students_t.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/distributions/students_t.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -186,7 +186,7 @@
RealType t, x, y;
x = ibeta_inv(degrees_of_freedom / 2, RealType(0.5), 2 * probability, &y);
if(degrees_of_freedom * y > tools::max_value<RealType>() * x)
- t = tools::overflow_error<RealType>(BOOST_CURRENT_FUNCTION);
+ t = tools::overflow_error<RealType>(function);
else
t = sqrt(degrees_of_freedom * y / x);
//
Modified: sandbox/math_toolkit/policy/boost/math/policy/error_handling.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/policy/error_handling.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/policy/error_handling.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -11,8 +11,11 @@
#include <string>
#include <cerrno>
#include <cmath>
+#include <stdexcept>
+#include <boost/math/tools/config.hpp>
#include <boost/math/policy/policy.hpp>
#include <boost/math/tools/precision.hpp>
+#include <boost/cstdint.hpp>
#ifdef BOOST_MSVC
# pragma warning(push) // Quiet warnings in boost/format.hpp
# pragma warning(disable: 4996) // _SCL_SECURE_NO_DEPRECATE
@@ -81,7 +84,7 @@
msg += ": ";
msg += message;
- int prec = 2 + (tools::digits<T>() * 30103UL) / 100000UL;
+ int prec = 2 + (boost::math::policy::digits<T, boost::math::policy::policy<> >() * 30103UL) / 100000UL;
msg = (boost::format(msg) % boost::io::group(std::setprecision(prec), val)).str();
E e(msg);
Modified: sandbox/math_toolkit/policy/boost/math/policy/policy.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/policy/policy.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/policy/policy.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -20,6 +20,7 @@
#include <boost/type_traits/is_same.hpp>
#include <boost/static_assert.hpp>
#include <boost/math/tools/config.hpp>
+#include <limits>
namespace boost{ namespace math{ namespace policy{
@@ -378,8 +379,8 @@
//
// Internal promotion:
//
- typedef typename detail::find_arg<arg_list, is_promote_float<mpl::_1>, promote_float<> >::type float_promote_type;
- typedef typename detail::find_arg<arg_list, is_promote_double<mpl::_1>, promote_double<> >::type double_promote_type;
+ typedef typename detail::find_arg<arg_list, is_promote_float<mpl::_1>, promote_float<> >::type promote_float_type;
+ typedef typename detail::find_arg<arg_list, is_promote_double<mpl::_1>, promote_double<> >::type promote_double_type;
//
// Discrete quantiles:
//
@@ -409,8 +410,8 @@
#else
typedef detail::precision<digits10<>, digits2<> >::type precision_type;
#endif
- typedef promote_float<> float_promote_type;
- typedef promote_double<> double_promote_type;
+ typedef promote_float<> promote_float_type;
+ typedef promote_double<> promote_double_type;
typedef discrete_quantile<> discrete_quantile_type;
typedef assert_undefined<> assert_undefined_type;
};
@@ -430,8 +431,8 @@
#else
typedef detail::precision<digits10<>, digits2<> >::type precision_type;
#endif
- typedef promote_float<false> float_promote_type;
- typedef promote_double<false> double_promote_type;
+ typedef promote_float<false> promote_float_type;
+ typedef promote_double<false> promote_double_type;
typedef discrete_quantile<> discrete_quantile_type;
typedef assert_undefined<> assert_undefined_type;
};
@@ -467,8 +468,8 @@
//
// Internal promotion:
//
- typedef typename detail::find_arg<arg_list, is_promote_float<mpl::_1>, typename Policy::float_promote_type >::type float_promote_type;
- typedef typename detail::find_arg<arg_list, is_promote_double<mpl::_1>, typename Policy::double_promote_type >::type double_promote_type;
+ typedef typename detail::find_arg<arg_list, is_promote_float<mpl::_1>, typename Policy::promote_float_type >::type promote_float_type;
+ typedef typename detail::find_arg<arg_list, is_promote_double<mpl::_1>, typename Policy::promote_double_type >::type promote_double_type;
//
// Discrete quantiles:
//
@@ -488,8 +489,8 @@
denorm_error_type,
evaluation_error_type,
precision_type,
- float_promote_type,
- double_promote_type,
+ promote_float_type,
+ promote_double_type,
discrete_quantile_type,
assert_undefined_type> result_list;
//
@@ -619,13 +620,13 @@
template <class Policy>
struct evaluation<float, Policy>
{
- typedef typename mpl::if_<typename Policy::float_promote_type, double, float>::type type;
+ typedef typename mpl::if_<typename Policy::promote_float_type, double, float>::type type;
};
template <class Policy>
struct evaluation<double, Policy>
{
- typedef typename mpl::if_<typename Policy::double_promote_type, long double, double>::type type;
+ typedef typename mpl::if_<typename Policy::promote_double_type, long double, double>::type type;
};
template <class Real, class Policy>
Modified: sandbox/math_toolkit/policy/boost/math/special_functions/bessel.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/special_functions/bessel.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/special_functions/bessel.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -20,7 +20,6 @@
#include <boost/math/special_functions/sin_pi.hpp>
#include <boost/math/special_functions/cos_pi.hpp>
#include <boost/math/special_functions/sinc.hpp>
-#include <boost/math/tools/evaluation_type.hpp>
#include <boost/math/tools/rational.hpp>
#include <boost/math/tools/promotion.hpp>
Modified: sandbox/math_toolkit/policy/boost/math/special_functions/detail/igamma_inverse.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/special_functions/detail/igamma_inverse.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/special_functions/detail/igamma_inverse.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -9,7 +9,7 @@
#include <boost/math/special_functions/gamma.hpp>
#include <boost/math/special_functions/sign.hpp>
#include <boost/math/tools/roots.hpp>
-#include <boost/math/tools/error_handling.hpp>
+#include <boost/math/policy/error_handling.hpp>
namespace boost{ namespace math{
@@ -404,9 +404,9 @@
// large convergence is slow, so we'll bump it up to full
// precision to prevent premature termination of the root-finding routine.
//
- unsigned digits = (tools::digits<T>() * 2) / 3;
+ unsigned digits = (policy::digits<T, Policy>() * 2) / 3;
if((a < 0.125) && (fabs(gamma_p_derivative(a, guess, pol)) > 1 / sqrt(tools::epsilon<T>())))
- digits = tools::digits<T>();
+ digits = policy::digits<T, Policy>();
//
// Go ahead and iterate:
//
Modified: sandbox/math_toolkit/policy/boost/math/special_functions/detail/t_distribution_inv.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/special_functions/detail/t_distribution_inv.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/special_functions/detail/t_distribution_inv.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -197,7 +197,7 @@
// we have integer degrees of freedom, try for the special
// cases first:
//
- T tolerance = ldexp(1.0f, (2 * tools::digits<T>()) / 3);
+ T tolerance = ldexp(1.0f, (2 * policy::digits<T, Policy>()) / 3);
switch(boost::math::tools::real_cast<int>(df))
{
Modified: sandbox/math_toolkit/policy/boost/math/special_functions/digamma.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/special_functions/digamma.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/special_functions/digamma.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -7,7 +7,6 @@
#define BOOST_MATH_SF_DIGAMMA_HPP
#include <boost/math/tools/rational.hpp>
-#include <boost/math/tools/evaluation_type.hpp>
#include <boost/math/tools/promotion.hpp>
#include <boost/math/policy/error_handling.hpp>
#include <boost/math/constants/constants.hpp>
Modified: sandbox/math_toolkit/policy/boost/math/special_functions/erf.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/special_functions/erf.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/special_functions/erf.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -10,7 +10,7 @@
#include <boost/math/tools/config.hpp>
#include <boost/math/special_functions/gamma.hpp>
#include <boost/math/tools/roots.hpp>
-#include <boost/math/tools/error_handling.hpp>
+#include <boost/math/policy/error_handling.hpp>
namespace boost{ namespace math{
@@ -128,7 +128,7 @@
detail::erf_asympt_series_t<T> s(z);
boost::uintmax_t max_iter = BOOST_MATH_MAX_ITER;
result = boost::math::tools::sum_series(s, policy::digits<T, Policy>(), max_iter, 1);
- tools::check_series_iterations("boost::math::erf<%1%>(%1%, %1%)", max_iter);
+ policy::check_series_iterations("boost::math::erf<%1%>(%1%, %1%)", max_iter, pol);
}
else
{
Modified: sandbox/math_toolkit/policy/boost/math/special_functions/expm1.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/special_functions/expm1.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/special_functions/expm1.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -83,7 +83,7 @@
T zero = 0;
T result = tools::sum_series(s, policy::digits<T, Policy>(), max_iter, zero);
#endif
- policy::check_series_iterations(BOOST_CURRENT_FUNCTION, max_iter, pol);
+ policy::check_series_iterations("boost::math::expm1<%1%>(%1%)", max_iter, pol);
return result;
}
@@ -218,7 +218,7 @@
return policy::checked_narrowing_cast<result_type, forwarding_policy>(detail::expm1_imp(
static_cast<value_type>(x),
- tag_type(), forwarding_policy()), BOOST_CURRENT_FUNCTION);
+ tag_type(), forwarding_policy()), "boost::math::expm1<%1%>(%1%)");
}
#ifdef expm1
Modified: sandbox/math_toolkit/policy/boost/math/special_functions/gamma.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/special_functions/gamma.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/special_functions/gamma.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -23,7 +23,7 @@
#include <boost/math/tools/precision.hpp>
#include <boost/math/tools/real_cast.hpp>
#include <boost/math/tools/promotion.hpp>
-#include <boost/math/tools/error_handling.hpp>
+#include <boost/math/policy/error_handling.hpp>
#include <boost/math/constants/constants.hpp>
#include <boost/math/special_functions/math_fwd.hpp>
#include <boost/math/special_functions/log1p.hpp>
@@ -474,7 +474,7 @@
// more bits from our most precise lgamma rational approximation,
// then use that instead:
//
- if((dz > -0.5) && (dz < 2) && (ldexp(1.0, boost::math::tools::digits<T>()) * fabs(result) < 1e34))
+ if((dz > -0.5) && (dz < 2) && (ldexp(1.0, boost::math::policy::digits<T, Policy>()) * fabs(result) < 1e34))
{
result = tgammap1m1_imp(dz, pol, boost::math::lanczos::lanczos24m113());
}
@@ -776,10 +776,11 @@
T gamma_incomplete_imp(T a, T x, bool normalised, bool invert,
const Policy& pol, T* p_derivative)
{
+ static const char* function = "boost::math::gamma_p<%1%>(%1%, %1%)";
if(a <= 0)
- tools::domain_error<T>(BOOST_CURRENT_FUNCTION, "Argument a to the incomplete gamma function must be greater than zero (got a=%1%).", a);
+ policy::raise_domain_error<T>(function, "Argument a to the incomplete gamma function must be greater than zero (got a=%1%).", a, pol);
if(x < 0)
- tools::domain_error<T>(BOOST_CURRENT_FUNCTION, "Argument x to the incomplete gamma function must be >= 0 (got x=%1%).", x);
+ policy::raise_domain_error<T>(function, "Argument x to the incomplete gamma function must be >= 0 (got x=%1%).", x, pol);
using namespace std;
@@ -875,7 +876,7 @@
if(normalised && std::numeric_limits<T>::is_specialized && (a > 20))
{
T sigma = fabs((x-a)/a);
- if((a > 200) && (tools::digits<T>() <= 113))
+ if((a > 200) && (policy::digits<T, Policy>() <= 113))
{
//
// This limit is chosen so that we use Temme's expansion
@@ -888,7 +889,7 @@
if(20 / a > sigma * sigma)
use_temme = true;
}
- else if(tools::digits<T>() <= 64)
+ else if(policy::digits<T, Policy>() <= 64)
{
// Note in this zone we can't use Temme's expansion for
// types longer than an 80-bit real:
Modified: sandbox/math_toolkit/policy/boost/math/special_functions/hermite.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/special_functions/hermite.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/special_functions/hermite.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -9,7 +9,7 @@
#include <boost/math/special_functions/math_fwd.hpp>
#include <boost/math/tools/config.hpp>
-#include <boost/math/tools/evaluation_type.hpp>
+#include <boost/math/policy/error_handling.hpp>
namespace boost{
namespace math{
@@ -47,13 +47,20 @@
} // namespace detail
+template <class T, class Policy>
+inline typename tools::promote_args<T>::type
+ hermite(unsigned n, T x, const Policy&)
+{
+ typedef typename tools::promote_args<T>::type result_type;
+ typedef typename policy::evaluation<result_type, Policy>::type value_type;
+ return policy::checked_narrowing_cast<result_type, Policy>(detail::hermite_imp(n, static_cast<value_type>(x)), "boost::math::hermite<%1%>(unsigned, %1%)");
+}
+
template <class T>
inline typename tools::promote_args<T>::type
hermite(unsigned n, T x)
{
- typedef typename tools::promote_args<T>::type result_type;
- typedef typename tools::evaluation<result_type>::type value_type;
- return tools::checked_narrowing_cast<result_type>(detail::hermite_imp(n, static_cast<value_type>(x)), BOOST_CURRENT_FUNCTION);
+ return boost::math::hermite(n, x, policy::policy<>());
}
} // namespace math
Modified: sandbox/math_toolkit/policy/boost/math/special_functions/laguerre.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/special_functions/laguerre.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/special_functions/laguerre.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -9,11 +9,33 @@
#include <boost/math/special_functions/math_fwd.hpp>
#include <boost/math/tools/config.hpp>
-#include <boost/math/tools/evaluation_type.hpp>
+#include <boost/math/policy/error_handling.hpp>
namespace boost{
namespace math{
+//
+// Some forward declarations:
+//
+template <class T, class Policy>
+typename tools::promote_args<T>::type
+ laguerre(unsigned n, unsigned m, T x, const Policy&);
+
+
+template <class T1, class T2>
+struct laguerre_result
+{
+ typedef typename mpl::if_<
+ policy::is_policy<T2>,
+ typename tools::promote_args<T1>::type,
+ typename tools::promote_args<T2>::type
+ >::type type;
+};
+
+template <class T1, class T2>
+typename laguerre_result<T1, T2>::type
+ laguerre(unsigned n, T1 m, T2 x);
+
// Recurrance relation for Laguerre polynomials:
template <class T1, class T2, class T3>
inline typename tools::promote_args<T1, T2, T3>::type
@@ -46,15 +68,29 @@
return p1;
}
+template <class T, class Policy>
+inline typename tools::promote_args<T>::type
+laguerre(unsigned n, T x, const Policy&, const mpl::true_&)
+{
+ typedef typename tools::promote_args<T>::type result_type;
+ typedef typename policy::evaluation<result_type, Policy>::type value_type;
+ return policy::checked_narrowing_cast<result_type, Policy>(detail::laguerre_imp(n, static_cast<value_type>(x)), "boost::math::laguerre<%1%>(unsigned, %1%)");
+}
+
+template <class T>
+inline typename tools::promote_args<T>::type
+ laguerre(unsigned n, unsigned m, T x, const mpl::false_&)
+{
+ return boost::math::laguerre(n, m, x, policy::policy<>());
+}
+
} // namespace detail
template <class T>
inline typename tools::promote_args<T>::type
laguerre(unsigned n, T x)
{
- typedef typename tools::promote_args<T>::type result_type;
- typedef typename tools::evaluation<result_type>::type value_type;
- return tools::checked_narrowing_cast<result_type>(detail::laguerre_imp(n, static_cast<value_type>(x)), BOOST_CURRENT_FUNCTION);
+ return laguerre(n, x, policy::policy<>());
}
// Recurrence for associated polynomials:
@@ -68,12 +104,12 @@
namespace detail{
// Laguerre Associated Polynomial:
-template <class T>
-T laguerre_imp(unsigned n, unsigned m, T x)
+template <class T, class Policy>
+T laguerre_imp(unsigned n, unsigned m, T x, const Policy& pol)
{
// Special cases:
if(m == 0)
- return laguerre(n, x);
+ return boost::math::laguerre(n, x, pol);
T p0 = 1;
@@ -95,13 +131,21 @@
}
-template <class T>
+template <class T, class Policy>
inline typename tools::promote_args<T>::type
- laguerre(unsigned n, unsigned m, T x)
+ laguerre(unsigned n, unsigned m, T x, const Policy& pol)
{
typedef typename tools::promote_args<T>::type result_type;
- typedef typename tools::evaluation<result_type>::type value_type;
- return tools::checked_narrowing_cast<result_type>(detail::laguerre_imp(n, m, static_cast<value_type>(x)), BOOST_CURRENT_FUNCTION);
+ typedef typename policy::evaluation<result_type, Policy>::type value_type;
+ return policy::checked_narrowing_cast<result_type, Policy>(detail::laguerre_imp(n, m, static_cast<value_type>(x), pol), "boost::math::laguerre<%1%>(unsigned, unsigned, %1%)");
+}
+
+template <class T1, class T2>
+inline typename laguerre_result<T1, T2>::type
+ laguerre(unsigned n, T1 m, T2 x)
+{
+ typedef typename policy::is_policy<T2>::type tag_type;
+ return detail::laguerre(n, m, x, tag_type());
}
} // namespace math
Modified: sandbox/math_toolkit/policy/boost/math/special_functions/lanczos.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/special_functions/lanczos.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/special_functions/lanczos.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -10,7 +10,6 @@
#include <boost/mpl/if.hpp>
#include <boost/limits.hpp>
#include <boost/cstdint.hpp>
-#include <boost/math/tools/evaluation_type.hpp>
#include <boost/math/tools/rational.hpp>
#include <boost/math/policy/policy.hpp>
#include <boost/mpl/less_equal.hpp>
@@ -1183,34 +1182,6 @@
//
struct undefined_lanczos : public mpl::int_<INT_MAX - 1> { };
-//
-// lanczos_traits, specialise this to point tgamma etc to
-// the necessary data for type T:
-//
-template <class T>
-struct lanczos_traits
-{
- typedef T value_type;
- // typedef undefined_lanczos evaluation_type;
- typedef typename mpl::if_c<
- (std::numeric_limits<T>::is_specialized == 0)
- || (std::numeric_limits<T>::digits > 113),
- undefined_lanczos,
- typename mpl::if_c<
- std::numeric_limits<T>::digits <= 24,
- lanczos6m24,
- typename mpl::if_c<
- std::numeric_limits<T>::digits <= 53,
- lanczos13m53,
- typename mpl::if_c<
- std::numeric_limits<T>::digits <= 64,
- lanczos17m64,
- lanczos24m113
- >::type
- >::type
- >::type
- >::type evaluation_type;
-};
#if 0
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
#define BOOST_MATH_FLT_DIGITS ::std::numeric_limits<float>::digits
@@ -1222,67 +1193,6 @@
#define BOOST_MATH_LDBL_DIGITS LDBL_MANT_DIG
#endif
#endif
-template<>
-struct lanczos_traits<float>
-{
- typedef boost::math::tools::evaluation<float>::type value_type;
- typedef boost::mpl::if_c<
- BOOST_MATH_DBL_DIGITS >= 40,
- lanczos6, lanczos6m24>::type evaluation_type;
-};
-
-template<>
-struct lanczos_traits<double>
-{
- typedef boost::math::tools::evaluation<double>::type value_type;
-#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
- typedef boost::mpl::if_c<
- BOOST_MATH_DBL_DIGITS >= 100,
- lanczos13,
- boost::mpl::if_c<
- BOOST_MATH_DBL_DIGITS >= 64,
- lanczos17m64,
- boost::mpl::if_c<
- BOOST_MATH_DBL_DIGITS >= 53,
- lanczos13m53,
- lanczos6m24>::type
- >::type
- >::type evaluation_type;
-#else
- typedef boost::mpl::if_c<
- BOOST_MATH_LDBL_DIGITS >= 100,
- lanczos13,
- boost::mpl::if_c<
- BOOST_MATH_LDBL_DIGITS >= 64,
- lanczos17m64,
- boost::mpl::if_c<
- BOOST_MATH_DBL_DIGITS >= 53,
- lanczos13m53,
- lanczos6m24>::type
- >::type
- >::type evaluation_type;
-#endif
-};
-
-template<>
-struct lanczos_traits<long double>
-{
- typedef long double value_type;
- typedef
- boost::mpl::if_c<
- (BOOST_MATH_LDBL_DIGITS < 52),
- lanczos6m24,
- boost::mpl::if_c<
- (BOOST_MATH_LDBL_DIGITS < 55),
- lanczos13m53,
- boost::mpl::if_c<
- (BOOST_MATH_LDBL_DIGITS < 65),
- lanczos17m64,
- lanczos24m113
- >::type
- >::type
- >::type evaluation_type;
-};
typedef mpl::list<
lanczos6m24,
Modified: sandbox/math_toolkit/policy/boost/math/special_functions/legendre.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/special_functions/legendre.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/special_functions/legendre.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -26,21 +26,22 @@
namespace detail{
// Implement Legendre P and Q polynomials via recurrance:
-template <class T>
-T legendre_imp(unsigned l, T x, bool second = false)
+template <class T, class Policy>
+T legendre_imp(unsigned l, T x, const Policy& pol, bool second = false)
{
+ static const char* function = "boost::math::legrendre_p<%1%>(unsigned, %1%)";
// Error handling:
if((x < -1) || (x > 1))
- return tools::domain_error<T>(
- BOOST_CURRENT_FUNCTION,
+ return policy::raise_domain_error<T>(
+ function,
"The Legendre Polynomial is defined for"
- " -1 <= x <= 1, but got x = %1%.", x);
+ " -1 <= x <= 1, but got x = %1%.", x, pol);
T p0, p1;
if(second)
{
// A solution of the second kind (Q):
- p0 = (boost::math::log1p(x) - boost::math::log1p(-x)) / 2;
+ p0 = (boost::math::log1p(x, pol) - boost::math::log1p(-x, pol)) / 2;
p1 = x * p0 - 1;
}
else
@@ -65,24 +66,39 @@
} // namespace detail
+template <class T, class Policy>
+inline typename tools::promote_args<T>::type
+ legendre_p(int l, T x, const Policy& pol)
+{
+ typedef typename tools::promote_args<T>::type result_type;
+ typedef typename policy::evaluation<result_type, Policy>::type value_type;
+ static const char* function = "boost::math::legendre_p<%1%>(unsigned, %1%)";
+ if(l < 0)
+ return policy::checked_narrowing_cast<result_type, Policy>(detail::legendre_imp(-l-1, static_cast<value_type>(x), pol, false), function);
+ return policy::checked_narrowing_cast<result_type, Policy>(detail::legendre_imp(l, static_cast<value_type>(x), pol, false), function);
+}
+
template <class T>
inline typename tools::promote_args<T>::type
legendre_p(int l, T x)
{
+ return boost::math::legendre_p(l, x, policy::policy<>());
+}
+
+template <class T, class Policy>
+inline typename tools::promote_args<T>::type
+ legendre_q(unsigned l, T x, const Policy& pol)
+{
typedef typename tools::promote_args<T>::type result_type;
- typedef typename tools::evaluation<result_type>::type value_type;
- if(l < 0)
- return tools::checked_narrowing_cast<result_type>(detail::legendre_imp(-l-1, static_cast<value_type>(x), false), BOOST_CURRENT_FUNCTION);
- return tools::checked_narrowing_cast<result_type>(detail::legendre_imp(l, static_cast<value_type>(x), false), BOOST_CURRENT_FUNCTION);
+ typedef typename policy::evaluation<result_type, Policy>::type value_type;
+ return policy::checked_narrowing_cast<result_type, Policy>(detail::legendre_imp(l, static_cast<value_type>(x), pol, true), "boost::math::legendre_q<%1%>(unsigned, %1%)");
}
template <class T>
inline typename tools::promote_args<T>::type
legendre_q(unsigned l, T x)
{
- typedef typename tools::promote_args<T>::type result_type;
- typedef typename tools::evaluation<result_type>::type value_type;
- return tools::checked_narrowing_cast<result_type>(detail::legendre_imp(l, static_cast<value_type>(x), true), BOOST_CURRENT_FUNCTION);
+ return boost::math::legendre_q(l, x, policy::policy<>());
}
// Recurrence for associated polynomials:
@@ -96,30 +112,30 @@
namespace detail{
// Legendre P associated polynomial:
-template <class T>
-T legendre_p_imp(int l, int m, T x, T sin_theta_power)
+template <class T, class Policy>
+T legendre_p_imp(int l, int m, T x, T sin_theta_power, const Policy& pol)
{
// Error handling:
if((x < -1) || (x > 1))
- return tools::domain_error<T>(
- BOOST_CURRENT_FUNCTION,
+ return policy::raise_domain_error<T>(
+ "boost::math::legendre_p<%1%>(int, int, %1%)",
"The associated Legendre Polynomial is defined for"
- " -1 <= x <= 1, but got x = %1%.", x);
+ " -1 <= x <= 1, but got x = %1%.", x, pol);
// Handle negative arguments first:
if(l < 0)
- return legendre_p_imp(-l-1, m, x, sin_theta_power);
+ return legendre_p_imp(-l-1, m, x, sin_theta_power, pol);
if(m < 0)
{
int sign = (m&1) ? -1 : 1;
- return sign * tgamma_ratio(static_cast<T>(l+m+1), static_cast<T>(l+1-m)) * legendre_p_imp(l, -m, x, sin_theta_power);
+ return sign * tgamma_ratio(static_cast<T>(l+m+1), static_cast<T>(l+1-m), pol) * legendre_p_imp(l, -m, x, sin_theta_power, pol);
}
// Special cases:
if(m > l)
return 0;
if(m == 0)
- return legendre_p(l, x);
+ return legendre_p(l, x, pol);
- T p0 = boost::math::double_factorial<T>(2 * m - 1) * sin_theta_power;
+ T p0 = boost::math::double_factorial<T>(2 * m - 1, pol) * sin_theta_power;
if(m&1)
p0 *= -1;
@@ -139,23 +155,30 @@
return p1;
}
-template <class T>
-inline T legendre_p_imp(int l, int m, T x)
+template <class T, class Policy>
+inline T legendre_p_imp(int l, int m, T x, const Policy& pol)
{
using namespace std;
// TODO: we really could use that mythical "pow1p" function here:
- return legendre_p_imp(l, m, x, pow(1 - x*x, T(abs(m))/2));
+ return legendre_p_imp(l, m, x, pow(1 - x*x, T(abs(m))/2), pol);
+}
+
}
+template <class T, class Policy>
+inline typename tools::promote_args<T>::type
+ legendre_p(int l, int m, T x, const Policy& pol)
+{
+ typedef typename tools::promote_args<T>::type result_type;
+ typedef typename policy::evaluation<result_type, Policy>::type value_type;
+ return policy::checked_narrowing_cast<result_type, Policy>(detail::legendre_p_imp(l, m, static_cast<value_type>(x), pol), "bost::math::legendre_p<%1%>(int, int, %1%)");
}
template <class T>
inline typename tools::promote_args<T>::type
legendre_p(int l, int m, T x)
{
- typedef typename tools::promote_args<T>::type result_type;
- typedef typename tools::evaluation<result_type>::type value_type;
- return tools::checked_narrowing_cast<result_type>(detail::legendre_p_imp(l, m, static_cast<value_type>(x)), BOOST_CURRENT_FUNCTION);
+ return boost::math::legendre_p(l, m, x, policy::policy<>());
}
} // namespace math
Modified: sandbox/math_toolkit/policy/boost/math/special_functions/log1p.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/special_functions/log1p.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/special_functions/log1p.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -256,7 +256,7 @@
#else
T result = boost::math::tools::sum_series(s, policy::digits<T, Policy>(), max_iter);
#endif
- tools::check_series_iterations(function, max_iter);
+ policy::check_series_iterations(function, max_iter, pol);
return result;
}
Modified: sandbox/math_toolkit/policy/boost/math/special_functions/sinhc.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/special_functions/sinhc.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/special_functions/sinhc.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -97,6 +97,11 @@
return detail::sinhc_pi_imp(static_cast<result_type>(x));
}
+ template <class T, class Policy>
+ inline typename tools::promote_args<T>::type sinhc_pi(T x, const Policy&)
+ {
+ return boost::math::sinhc_pi(x);
+ }
#ifdef BOOST_NO_TEMPLATE_TEMPLATES
#else /* BOOST_NO_TEMPLATE_TEMPLATES */
Modified: sandbox/math_toolkit/policy/boost/math/special_functions/spherical_harmonic.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/special_functions/spherical_harmonic.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/special_functions/spherical_harmonic.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -20,8 +20,8 @@
// and imaginary parts. Does *not* fix up the sign of the result
// though.
//
-template <class T>
-inline T spherical_harmonic_prefix(unsigned n, unsigned m, T theta)
+template <class T, class Policy>
+inline T spherical_harmonic_prefix(unsigned n, unsigned m, T theta, const Policy& pol)
{
using namespace std;
@@ -31,9 +31,9 @@
T sin_theta = sin(theta);
T x = cos(theta);
- T leg = detail::legendre_p_imp(n, m, x, pow(fabs(sin_theta), T(m)));
+ T leg = detail::legendre_p_imp(n, m, x, pow(fabs(sin_theta), T(m)), pol);
- T prefix = tgamma_delta_ratio(static_cast<T>(n - m + 1), static_cast<T>(2 * m));
+ T prefix = tgamma_delta_ratio(static_cast<T>(n - m + 1), static_cast<T>(2 * m), pol);
prefix *= (2 * n + 1) / (4 * constants::pi<T>());
prefix = sqrt(prefix);
return prefix * leg;
@@ -41,8 +41,8 @@
//
// Real Part:
//
-template <class T>
-T spherical_harmonic_r(unsigned n, int m, T theta, T phi)
+template <class T, class Policy>
+T spherical_harmonic_r(unsigned n, int m, T theta, T phi, const Policy& pol)
{
using namespace std; // ADL of std functions
@@ -63,13 +63,13 @@
sign = !sign;
}
// Get the value and adjust sign as required:
- T prefix = spherical_harmonic_prefix(n, m, theta);
+ T prefix = spherical_harmonic_prefix(n, m, theta, pol);
prefix *= cos(m * phi);
return sign ? -prefix : prefix;
}
-template <class T>
-T spherical_harmonic_i(unsigned n, int m, T theta, T phi)
+template <class T, class Policy>
+T spherical_harmonic_i(unsigned n, int m, T theta, T phi, const Policy& pol)
{
using namespace std; // ADL of std functions
@@ -90,13 +90,13 @@
sign = !sign;
}
// Get the value and adjust sign as required:
- T prefix = spherical_harmonic_prefix(n, m, theta);
+ T prefix = spherical_harmonic_prefix(n, m, theta, pol);
prefix *= sin(m * phi);
return sign ? -prefix : prefix;
}
-template <class T, class U>
-std::complex<T> spherical_harmonic(unsigned n, int m, U theta, U phi)
+template <class T, class U, class Policy>
+std::complex<T> spherical_harmonic(unsigned n, int m, U theta, U phi, const Policy& pol)
{
using namespace std;
//
@@ -126,7 +126,7 @@
//
// Calculate the value:
//
- U prefix = spherical_harmonic_prefix(n, m, theta);
+ U prefix = spherical_harmonic_prefix(n, m, theta, pol);
U r = prefix * cos(m * phi);
U i = prefix * sin(m * phi);
//
@@ -136,36 +136,58 @@
r = -r;
if(i_sign)
i = -i;
- return std::complex<T>(tools::checked_narrowing_cast<T>(r, BOOST_CURRENT_FUNCTION), tools::checked_narrowing_cast<T>(i, BOOST_CURRENT_FUNCTION));
+ static const char* function = "boost::math::spherical_harmonic<%1%>(int, int, %1%, %1%)";
+ return std::complex<T>(policy::checked_narrowing_cast<T, Policy>(r, function), policy::checked_narrowing_cast<T, Policy>(i, function));
}
} // namespace detail
+template <class T1, class T2, class Policy>
+inline std::complex<typename tools::promote_args<T1, T2>::type>
+ spherical_harmonic(unsigned n, int m, T1 theta, T2 phi, const Policy& pol)
+{
+ typedef typename tools::promote_args<T1, T2>::type result_type;
+ typedef typename policy::evaluation<result_type, Policy>::type value_type;
+ return detail::spherical_harmonic<result_type, value_type>(n, m, static_cast<value_type>(theta), static_cast<value_type>(phi), pol);
+}
+
template <class T1, class T2>
inline std::complex<typename tools::promote_args<T1, T2>::type>
spherical_harmonic(unsigned n, int m, T1 theta, T2 phi)
{
+ return boost::math::spherical_harmonic(n, m, theta, phi, policy::policy<>());
+}
+
+template <class T1, class T2, class Policy>
+inline typename tools::promote_args<T1, T2>::type
+ spherical_harmonic_r(unsigned n, int m, T1 theta, T2 phi, const Policy& pol)
+{
typedef typename tools::promote_args<T1, T2>::type result_type;
- typedef typename tools::evaluation<result_type>::type value_type;
- return detail::spherical_harmonic<result_type, value_type>(n, m, static_cast<value_type>(theta), static_cast<value_type>(phi));
+ typedef typename policy::evaluation<result_type, Policy>::type value_type;
+ return policy::checked_narrowing_cast<result_type, Policy>(detail::spherical_harmonic_r(n, m, static_cast<value_type>(theta), static_cast<value_type>(phi), pol), "bost::math::spherical_harmonic_r<%1%>(unsigned, int, %1%, %1%)");
}
template <class T1, class T2>
inline typename tools::promote_args<T1, T2>::type
spherical_harmonic_r(unsigned n, int m, T1 theta, T2 phi)
{
+ return boost::math::spherical_harmonic_r(n, m, theta, phi, policy::policy<>());
+}
+
+template <class T1, class T2, class Policy>
+inline typename tools::promote_args<T1, T2>::type
+ spherical_harmonic_i(unsigned n, int m, T1 theta, T2 phi, const Policy& pol)
+{
typedef typename tools::promote_args<T1, T2>::type result_type;
- typedef typename tools::evaluation<result_type>::type value_type;
- return tools::checked_narrowing_cast<result_type>(detail::spherical_harmonic_r(n, m, static_cast<value_type>(theta), static_cast<value_type>(phi)), BOOST_CURRENT_FUNCTION);
+ typedef typename policy::evaluation<result_type, Policy>::type value_type;
+ return policy::checked_narrowing_cast<result_type, Policy>(detail::spherical_harmonic_i(n, m, static_cast<value_type>(theta), static_cast<value_type>(phi), pol), "boost::math::spherical_harmonic_i<%1%>(unsigned, int, %1%, %1%)");
}
template <class T1, class T2>
inline typename tools::promote_args<T1, T2>::type
spherical_harmonic_i(unsigned n, int m, T1 theta, T2 phi)
{
- typedef typename tools::promote_args<T1, T2>::type result_type;
- typedef typename tools::evaluation<result_type>::type value_type;
- return tools::checked_narrowing_cast<result_type>(detail::spherical_harmonic_i(n, m, static_cast<value_type>(theta), static_cast<value_type>(phi)), BOOST_CURRENT_FUNCTION);
+ return boost::math::spherical_harmonic_i(n, m, theta, phi, policy::policy<>());
}
} // namespace math
Modified: sandbox/math_toolkit/policy/boost/math/tools/config.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/tools/config.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/tools/config.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -1,9 +1,9 @@
#ifndef BOOST_MATH_TOOLS_CONFIG_HPP
#define BOOST_MATH_TOOLS_CONFIG_HPP
-#include <boost/math/tools/error_handling.hpp>
#include <boost/cstdint.hpp> // for boost::uintmax_t
#include <boost/config.hpp>
+#include <algorithm> // for min and max
#define BOOST_MATH_MAX_ITER 1000000
@@ -64,14 +64,6 @@
return (std::max)((std::max)(a, b), (std::max)(c, d));
}
-inline void check_series_iterations(const char* function, boost::uintmax_t max_iter)
-{
- if(max_iter >= BOOST_MATH_MAX_ITER)
- tools::logic_error<boost::uintmax_t>(
- function,
- "Series evaluation exceeded %1% iterations, giving up now.", max_iter);
-}
-
} // namespace tools
}} // namespace boost namespace math
Deleted: sandbox/math_toolkit/policy/boost/math/tools/error_handling.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/tools/error_handling.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
+++ (empty file)
@@ -1,251 +0,0 @@
-// Copyright John Maddock 2006.
-// Use, modification and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_MATH_TOOLS_ERROR_HANDLING_HPP
-#define BOOST_MATH_TOOLS_ERROR_HANDLING_HPP
-
-// Boost
-#include <boost/throw_exception.hpp>
-#include <boost/limits.hpp>
-#include <boost/type_traits/is_same.hpp>
-#include <boost/math/tools/precision.hpp>
-#ifdef BOOST_MSVC
-# pragma warning(push) // Quiet warnings in boost/format.hpp
-# pragma warning(disable: 4996) // _SCL_SECURE_NO_DEPRECATE
-# pragma warning(disable: 4512) // assignment operator could not be generated.
-#endif
-#include <boost/format.hpp>
-#ifdef BOOST_MSVC
-# pragma warning(pop)
-#endif
-#ifdef BOOST_MSVC
-# pragma warning(push) // Quiet warnings in error_handling
-// May also need to quiet warnings within distributions like binomial, etc
-// depending on definition, or not, of macro BOOST_MATH_THROW_ON_DOMAIN_ERROR
-// that controls if error_handling throws, or not,
-// that, in turn, determines if code is reachable, or not.
-# pragma warning(disable: 4702) // unreachable code in domain_error_imp etc
-#endif
-
-// We don't use this one directly,
-// but our clients will use it for BOOST_CURRENT_FUNCTION.
-#include <boost/current_function.hpp>
-
-// std
-#include <limits> // for numeric_limits
-#include <stdexcept>
-#include <cmath>
-#include <cerrno> // for errno
-
-namespace boost{ namespace math
-{
- namespace tools
- {
- namespace detail
- {
- template <class E>
- void raise_error(const char* function, const char* message)
- {
- if(function == 0)
- function = "Unknown function";
- if(message == 0)
- message = "Cause unknown";
-
- std::string msg("Error in function ");
- msg += function;
- msg += ": ";
- msg += message;
-
- E e(msg);
- boost::throw_exception(e);
- }
-
- template <class E, class T>
- void raise_error(const char* function, const char* message, const T& val)
- {
- if(function == 0)
- function = "Unknown function";
- if(message == 0)
- message = "Cause unknown";
-
- std::string msg("Error in function ");
- msg += function;
- msg += ": ";
- msg += message;
-
- int prec = 2 + (tools::digits<T>() * 30103UL) / 100000UL;
- msg = (boost::format(msg) % boost::io::group(std::setprecision(prec), val)).str();
-
- E e(msg);
- boost::throw_exception(e);
- }
-
- #ifndef BOOST_MATH_THROW_ON_DOMAIN_ERROR
- template <class T>
- inline T domain_error_imp(const char* /*function*/, const char* /*message*/, const T&, const mpl::true_*)
- { // No throw case.
- errno = ERANGE;
- return std::numeric_limits<T>::quiet_NaN();
- }
- #endif // BOOST_MATH_THROW_ON_DOMAIN_ERROR
- template <class T>
- inline T domain_error_imp(const char* function, const char* message, const T& val, const void*)
- { // Throw case.
- errno = ERANGE;
- detail::raise_error<std::domain_error>(function, message ? message : "Domain Error on value %1%", val);
- // We don't get here: (and may get warning C4702: unreachable code)
- return 0;
- }
-
- #ifndef BOOST_MATH_THROW_ON_OVERFLOW_ERROR
- template <class T>
- inline T overflow_error_imp(const char* /*function*/, const char* /*message*/, mpl::bool_<true> const*)
- { // No throw case.
- errno = ERANGE;
- return std::numeric_limits<T>::infinity();
- }
- #endif // BOOST_MATH_THROW_ON_OVERFLOW_ERROR
- template <class T>
- inline T overflow_error_imp(const char* function, const char* message, const void*)
- { // Throw case.
- errno = ERANGE;
- detail::raise_error<std::overflow_error>(function, message ? message : "Overflow");
- // We don't get here: (and may get warning C4702: unreachable code)
- return 0;
- }
- } // namespace detail
-
-// boost::math::tools:: Error handling functions:
-// domain_error, pole_error, overflow_error, underflow_error, denorm_error, logic_error
-// & checked_narrowing_cast.
-
-// An argument is outside its allowed range:
-// so show message & return a NaN.
-template <class T>
-inline T domain_error(const char* function, const char* message, const T& val)
-{ // returns std::numeric_limits<T>::quiet_NaN(), or as near as possible.
-#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
- if(std::numeric_limits<T>::has_quiet_NaN)
- return detail::domain_error_imp<T>(function, message, val, static_cast<mpl::true_*>(0));
- return detail::domain_error_imp<T>(function, message, val, static_cast<mpl::false_*>(0));
-#else
- typedef boost::mpl::bool_< ::std::numeric_limits<T>::has_quiet_NaN> tag_type;
- return detail::domain_error_imp<T>(function, message, val, static_cast<tag_type*>(0));
-#endif
-} // domain_error
-
-// Evaluation at a pole, this is currently treated the same as a domain error:
-template <class T>
-inline T pole_error(const char* function, const char* message, const T& val)
-{
- return domain_error<T>(function, message ? message : "Evaluation at pole %1%", val);
-}
-//
-// Result too large to be represented in type T:
-// so show message & return an infinity.
-template <class T>
-inline T overflow_error(const char* function, const char* message = 0)
-{ // returns std::numeric_limits<T>::infinity(), or as near as possible.
-#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
- if(std::numeric_limits<T>::has_infinity)
- return detail::overflow_error_imp<T>(function, message, static_cast<mpl::true_*>(0));
- return detail::overflow_error_imp<T>(function, message, static_cast<mpl::false_*>(0));
-#else
- typedef boost::mpl::bool_< ::std::numeric_limits<T>::has_infinity> tag_type;
- return detail::overflow_error_imp<T>(function, message, static_cast<tag_type*>(0));
-#endif
-} // overflow_error
-
-// Result too small to be represented in type T,
-// called only when we know the result is not actually zero:
-// but show message & return true zero.
-template <class T>
-#ifdef BOOST_MATH_THROW_ON_UNDERFLOW_ERROR
- inline T underflow_error(const char* function, const char* message)
-#else
- inline T underflow_error(const char*, const char*) // Warning suppressed version.
-#endif
-{
- errno = ERANGE;
-#ifdef BOOST_MATH_THROW_ON_UNDERFLOW_ERROR
- detail::raise_error<std::underflow_error>(function, message ? message : "Underflow");
-#endif
- return 0;
-} // underflow_error
-
-// Result is denormalised:
-// so use domain_error to show message & return unchanged denormalised value.
-template <class T>
-#ifdef BOOST_MATH_THROW_ON_DENORM_ERROR
- inline T denorm_error(T const& t, const char* function, const char* message)
-#else
- inline T denorm_error(T const& t, const char*, const char*) // Warning suppressed version.
-#endif
-{
- // Don't set errno if denormalized.
-#ifdef BOOST_MATH_THROW_ON_DENORM_ERROR
- // We don't have a std exception type for this, but this feels about right:
- detail::raise_error<std::underflow_error>(function, message ? message : "Denormalized value");
-#endif
- return t; // Unchanged denormalised value.
-} // denorm_error
-//
-// Computed result is garbage / internal error:
-template <class T>
-inline T logic_error(const char* function, const char* message, const T& val)
-{
- errno = EDOM;
- detail::raise_error<std::logic_error>(function, message ? message : "Internal logic error, computed value was %1%", val);
- return 0; // We don't get here:
-} // logic_error
-
-namespace detail
-{
- template <class T, class U>
- inline T checked_narrowing_cast(U const& val, const char* , const boost::mpl::true_*)
- {
- return val;
- }
-
- template <class T, class U>
- inline T checked_narrowing_cast(U const& val, const char* function, const boost::mpl::false_*)
- {
- if(val > tools::max_value<T>())
- return tools::overflow_error<T>(function);
- T result = static_cast<T>(val);
- if((result == 0) && (val != 0))
- return tools::underflow_error<T>(function, 0);
- if((fabs(result) < tools::min_value<T>()) && (fabs(val) >= tools::min_value<U>()))
- return tools::denorm_error<T>(result, function, 0);
- return result;
- }
-} // namespace detail
-
-template <class T, class U>
-inline T checked_narrowing_cast(U const& val, const char* function)
-{
-#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
- typedef boost::mpl::bool_<
- ::boost::is_same<T, U>::value
- || (std::numeric_limits<T>::digits >= std::numeric_limits<U>::digits
- && std::numeric_limits<T>::min_exponent <= std::numeric_limits<U>::min_exponent
- && std::numeric_limits<T>::max_exponent >= std::numeric_limits<U>::max_exponent) > select_type;
-#else
- typedef boost::mpl::bool_<
- ::boost::is_same<T, U>::value> select_type;
-#endif
- return detail::checked_narrowing_cast<T>(val, function, static_cast<const select_type*>(0));
-} // checked_narrowing_cast
-
-} // namespace tools
-} // namespace math
-} // namespace boost
-
-#ifdef BOOST_MSVC
-# pragma warning(pop)
-#endif
-
-#endif // BOOST_MATH_TOOLS_ERROR_HANDLING_HPP
-
Deleted: sandbox/math_toolkit/policy/boost/math/tools/evaluation_type.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/tools/evaluation_type.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
+++ (empty file)
@@ -1,65 +0,0 @@
-// (C) Copyright John Maddock 2006.
-// Use, modification and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_MATH_TOOLS_EVALUATION_TYPE_HPP
-#define BOOST_MATH_TOOLS_EVALUATION_TYPE_HPP
-
-#include <boost/mpl/if.hpp>
-#include <limits>
-
-namespace boost{ namespace math{ namespace tools{
-
-template <class T>
-struct evaluation
-{
- typedef T type;
-};
-
-#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
-#define BOOST_MATH_FLT_DIGITS std::numeric_limits<float>::digits
-#define BOOST_MATH_DBL_DIGITS std::numeric_limits<double>::digits
-#define BOOST_MATH_LDBL_DIGITS std::numeric_limits<long double>::digits
-#else
-#define BOOST_MATH_FLT_DIGITS FLT_MANT_DIG
-#define BOOST_MATH_DBL_DIGITS DBL_MANT_DIG
-#define BOOST_MATH_LDBL_DIGITS LDBL_MANT_DIG
-#endif
-
-template<>
-struct evaluation<float>
-{
- typedef boost::mpl::if_c<
- BOOST_MATH_DBL_DIGITS >= 40,
- double, float>::type type;
-};
-
-//
-// We don't promote to long double precision if the platform
-// doesn't have long double versions of the C std lib functions.
-//
-// If we did promote in this case we could pass out-of-range values
-// to the C std lib without realising that we were doing so,
-// as numeric_limits<long double> would give us no clue that we were
-// about to go out of range for a double.
-//
-#if !defined(__CYGWIN__) && !defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS)
-template<>
-struct evaluation<double>
-{
- typedef boost::mpl::if_c<
- BOOST_MATH_LDBL_DIGITS >= 64,
- long double,
- double>::type type;
-};
-#endif
-
-} // namespace tools
-} // namespace math
-} // namespace boost
-
-#endif // BOOST_MATH_TOOLS_EVALUATION_TYPE_HPP
-
-
-
Modified: sandbox/math_toolkit/policy/boost/math/tools/minima.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/tools/minima.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/tools/minima.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -10,6 +10,7 @@
#include <utility>
#include <cmath>
#include <boost/math/tools/precision.hpp>
+#include <boost/math/policy/policy.hpp>
#include <boost/cstdint.hpp>
namespace boost{ namespace math{ namespace tools{
@@ -18,7 +19,7 @@
std::pair<T, T> brent_find_minima(F f, T min, T max, int bits, boost::uintmax_t& max_iter)
{
using namespace std;
- bits = (std::min)(tools::digits<T>() / 2, bits);
+ bits = (std::min)(policy::digits<T, policy::policy<> >() / 2, bits);
T tolerance = static_cast<T>(ldexp(1.0, 1-bits));
T x; // minima so far
T w; // second best point
Modified: sandbox/math_toolkit/policy/boost/math/tools/ntl.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/tools/ntl.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/tools/ntl.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -314,7 +314,7 @@
NTL::RR(std::asin(boost::math::tools::real_cast<double>(z))),
NTL::RR(-boost::math::constants::pi<NTL::RR>()/2),
NTL::RR(boost::math::constants::pi<NTL::RR>()/2),
- boost::math::tools::digits<NTL::RR>());
+ boost::math::policy::digits<NTL::RR, policy::policy<> >());
}
struct acos_root
@@ -340,7 +340,7 @@
NTL::RR(std::acos(boost::math::tools::real_cast<double>(z))),
NTL::RR(-boost::math::constants::pi<NTL::RR>()/2),
NTL::RR(boost::math::constants::pi<NTL::RR>()/2),
- boost::math::tools::digits<NTL::RR>());
+ boost::math::policy::digits<NTL::RR, policy::policy<> >());
}
struct atan_root
@@ -367,7 +367,7 @@
NTL::RR(std::atan(boost::math::tools::real_cast<double>(z))),
-boost::math::constants::pi<NTL::RR>()/2,
boost::math::constants::pi<NTL::RR>()/2,
- boost::math::tools::digits<NTL::RR>());
+ boost::math::policy::digits<NTL::RR, policy::policy<> >());
}
inline NTL::RR sinh(NTL::RR z)
Modified: sandbox/math_toolkit/policy/boost/math/tools/precision.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/tools/precision.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/tools/precision.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -12,6 +12,7 @@
#include <boost/mpl/int.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
+#include <boost/math/policy/policy.hpp>
#include <iostream>
#include <iomanip>
@@ -33,17 +34,6 @@
// See Conceptual Requirements for Real Number Types.
template <class T>
-inline int digits(BOOST_EXPLICIT_TEMPLATE_TYPE(T))
-{
-#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
- BOOST_STATIC_ASSERT( ::std::numeric_limits<T>::is_specialized);
-#else
- BOOST_ASSERT(::std::numeric_limits<T>::is_specialized);
-#endif
- return std::numeric_limits<T>::digits;
-}
-
-template <class T>
inline T max_value(BOOST_EXPLICIT_TEMPLATE_TYPE(T))
{
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
@@ -163,7 +153,7 @@
inline T epsilon(const mpl::false_& BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
{
using namespace std; // for ADL of std names
- static const T eps = ldexp(static_cast<T>(1), 1-tools::digits<T>());
+ static const T eps = ldexp(static_cast<T>(1), 1-policy::digits<T, policy::policy<> >());
return eps;
}
Modified: sandbox/math_toolkit/policy/boost/math/tools/remez.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/tools/remez.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/tools/remez.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -13,6 +13,7 @@
#include <boost/function/function1.hpp>
#include <boost/scoped_array.hpp>
#include <boost/math/constants/constants.hpp>
+#include <boost/math/policy/policy.hpp>
namespace boost{ namespace math{ namespace tools{
@@ -310,12 +311,12 @@
if(bits == 0)
{
// don't bother about more than float precision:
- m_precision = (std::min)(24, (digits<T>() / 2) - 2);
+ m_precision = (std::min)(24, (boost::math::policy::digits<T, boost::math::policy::policy<> >() / 2) - 2);
}
else
{
// can't be more accurate than half the bits of T:
- m_precision = (std::min)(bits, (digits<T>() / 2) - 2);
+ m_precision = (std::min)(bits, (boost::math::policy::digits<T, boost::math::policy::policy<> >() / 2) - 2);
}
m_max_change_history[0] = m_max_change_history[1] = 1;
init_chebyshev();
@@ -371,12 +372,12 @@
if(bits == 0)
{
// don't bother about more than float precision:
- m_precision = (std::min)(24, (digits<T>() / 2) - 2);
+ m_precision = (std::min)(24, (boost::math::policy::digits<T, boost::math::policy::policy<> >() / 2) - 2);
}
else
{
// can't be more accurate than half the bits of T:
- m_precision = (std::min)(bits, (digits<T>() / 2) - 2);
+ m_precision = (std::min)(bits, (boost::math::policy::digits<T, boost::math::policy::policy<> >() / 2) - 2);
}
m_max_change_history[0] = m_max_change_history[1] = 1;
// do one iteration whatever:
Modified: sandbox/math_toolkit/policy/boost/math/tools/roots.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/tools/roots.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/tools/roots.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -96,14 +96,15 @@
//
// Error checking:
//
+ static const char* function = "boost::math::tools::bisect<%1%>";
if(min >= max)
{
- policy::raise_evaluation_error(BOOST_CURRENT_FUNCTION,
+ policy::raise_evaluation_error(function,
"Arguments in wrong order in boost::math::tools::bisect (first arg=%1%)", min, pol);
}
if(fmin * fmax >= 0)
{
- policy::raise_evaluation_error(BOOST_CURRENT_FUNCTION,
+ policy::raise_evaluation_error(function,
"No change of sign in boost::math::tools::bisect, either there is no root to find, or there are multiple roots in the interval (f(min) = %1%).", fmin, pol);
}
Modified: sandbox/math_toolkit/policy/boost/math/tools/test.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/tools/test.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/tools/test.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -10,6 +10,7 @@
#include <boost/math/tools/stats.hpp>
#include <boost/math/special_functions/fpclassify.hpp>
#include <boost/test/test_tools.hpp>
+#include <stdexcept>
namespace boost{ namespace math{ namespace tools{
Modified: sandbox/math_toolkit/policy/boost/math/tools/toms748_solve.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/tools/toms748_solve.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/tools/toms748_solve.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -273,6 +273,8 @@
//
using namespace std; // For ADL of std math functions
+ static const char* function = "boost::math::tools::toms748_solve<%1%>";
+
boost::uintmax_t count = max_iter;
T a, b, fa, fb, c, u, fu, a0, b0, d, fd, e, fe;
static const T mu = 0.5f;
@@ -282,7 +284,7 @@
b = bx;
if(a >= b)
policy::raise_domain_error(
- BOOST_CURRENT_FUNCTION,
+ function,
"Parameters a and b out of order: a=%1%", a, pol);
fa = fax;
fb = fbx;
@@ -299,7 +301,7 @@
if(boost::math::sign(fa) * boost::math::sign(fb) > 0)
policy::raise_domain_error(
- BOOST_CURRENT_FUNCTION,
+ function,
"Parameters a and b do not bracket the root: a=%1%", a, pol);
// dummy value for fd, e and fe:
fe = e = fd = 1e5F;
@@ -461,6 +463,7 @@
std::pair<T, T> bracket_and_solve_root(F f, const T& guess, const T& factor, bool rising, Tol tol, boost::uintmax_t& max_iter, const Policy& pol)
{
using namespace std;
+ static const char* function = "boost::math::tools::bracket_and_solve_root<%1%>";
//
// Set up inital brackets:
//
@@ -482,7 +485,7 @@
while(sign(fb) == sign(fa))
{
if(count == 0)
- policy::raise_evaluation_error(BOOST_CURRENT_FUNCTION, "Unable to bracket root, last nearest value was %1%", b, pol);
+ policy::raise_evaluation_error(function, "Unable to bracket root, last nearest value was %1%", b, pol);
a = b;
fa = fb;
b *= factor;
@@ -507,7 +510,7 @@
return a > 0 ? std::make_pair(T(0), T(a)) : std::make_pair(T(a), T(0));
}
if(count == 0)
- policy::raise_evaluation_error(BOOST_CURRENT_FUNCTION, "Unable to bracket root, last nearest value was %1%", a, pol);
+ policy::raise_evaluation_error(function, "Unable to bracket root, last nearest value was %1%", a, pol);
b = a;
fb = fa;
a /= factor;
Modified: sandbox/math_toolkit/policy/libs/math/test/Jamfile.v2
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/Jamfile.v2 (original)
+++ sandbox/math_toolkit/policy/libs/math/test/Jamfile.v2 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -69,6 +69,7 @@
run test_triangular.cpp ;
run test_uniform.cpp ;
run test_weibull.cpp ;
+run test_policy.cpp ;
run test_bessel_j.cpp ;
run test_bessel_y.cpp ;
@@ -128,8 +129,6 @@
compile compile_test/sf_sqrt1pm1_incl_test.cpp ;
compile compile_test/std_real_concept_check.cpp ;
compile compile_test/tools_config_inc_test.cpp ;
-compile compile_test/tools_error_handling_inc_test.cpp ;
-compile compile_test/tools_evaluation_type_inc_test.cpp ;
compile compile_test/tools_fraction_inc_test.cpp ;
compile compile_test/tools_minima_inc_test.cpp ;
compile compile_test/tools_polynomial_inc_test.cpp ;
@@ -164,3 +163,5 @@
+
+
Deleted: sandbox/math_toolkit/policy/libs/math/test/compile_test/tools_error_handling_inc_test.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/compile_test/tools_error_handling_inc_test.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
+++ (empty file)
@@ -1,10 +0,0 @@
-// Copyright John Maddock 2006.
-// Use, modification and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-// Basic sanity check that header <boost/math/tools/error_handling.hpp>
-// #includes all the files that it needs to.
-//
-#include <boost/math/tools/error_handling.hpp>
-
Deleted: sandbox/math_toolkit/policy/libs/math/test/compile_test/tools_evaluation_type_inc_test.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/compile_test/tools_evaluation_type_inc_test.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
+++ (empty file)
@@ -1,10 +0,0 @@
-// Copyright John Maddock 2006.
-// Use, modification and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-// Basic sanity check that header <boost/math/tools/evaluation_type.hpp>
-// #includes all the files that it needs to.
-//
-#include <boost/math/tools/evaluation_type.hpp>
-
Modified: sandbox/math_toolkit/policy/libs/math/test/test_bessel_i.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_bessel_i.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_bessel_i.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -47,7 +47,7 @@
//
const char* largest_type;
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
- if(boost::math::tools::digits<double>() == boost::math::tools::digits<long double>())
+ if(boost::math::policy::digits<double, boost::math::policy::policy<> >() == boost::math::policy::digits<long double, boost::math::policy::policy<> >())
{
largest_type = "(long\\s+)?double";
}
Modified: sandbox/math_toolkit/policy/libs/math/test/test_bessel_j.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_bessel_j.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_bessel_j.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -46,7 +46,7 @@
//
const char* largest_type;
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
- if(boost::math::tools::digits<double>() == boost::math::tools::digits<long double>())
+ if(boost::math::policy::digits<double, boost::math::policy::policy<> >() == boost::math::policy::digits<long double, boost::math::policy::policy<> >())
{
largest_type = "(long\\s+)?double|real_concept";
}
Modified: sandbox/math_toolkit/policy/libs/math/test/test_bessel_k.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_bessel_k.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_bessel_k.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -47,7 +47,7 @@
//
const char* largest_type;
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
- if(boost::math::tools::digits<double>() == boost::math::tools::digits<long double>())
+ if(boost::math::policy::digits<double, boost::math::policy::policy<> >() == boost::math::policy::digits<long double, boost::math::policy::policy<> >())
{
largest_type = "(long\\s+)?double";
}
Modified: sandbox/math_toolkit/policy/libs/math/test/test_bessel_y.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_bessel_y.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_bessel_y.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -47,7 +47,7 @@
//
const char* largest_type;
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
- if(boost::math::tools::digits<double>() == boost::math::tools::digits<long double>())
+ if(boost::math::policy::digits<double, boost::math::policy::policy<> >() == boost::math::policy::digits<long double, boost::math::policy::policy<> >())
{
largest_type = "(long\\s+)?double|real_concept";
}
Modified: sandbox/math_toolkit/policy/libs/math/test/test_binomial_coeff.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_binomial_coeff.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_binomial_coeff.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -43,7 +43,7 @@
//
const char* largest_type;
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
- if(boost::math::tools::digits<double>() == boost::math::tools::digits<long double>())
+ if(boost::math::policy::digits<double, boost::math::policy::policy<> >() == boost::math::policy::digits<long double, boost::math::policy::policy<> >())
{
largest_type = "(long\\s+)?double";
}
Modified: sandbox/math_toolkit/policy/libs/math/test/test_carlson.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_carlson.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_carlson.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -53,7 +53,7 @@
//
const char* largest_type;
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
- if(boost::math::tools::digits<double>() == boost::math::tools::digits<long double>())
+ if(boost::math::policy::digits<double, boost::math::policy::policy<> >() == boost::math::policy::digits<long double, boost::math::policy::policy<> >())
{
largest_type = "(long\\s+)?double";
}
@@ -67,7 +67,7 @@
//
// real long doubles:
//
- if(boost::math::tools::digits<long double>() > 53)
+ if(boost::math::policy::digits<long double, boost::math::policy::policy<> >() > 53)
{
add_expected_result(
".*", // compiler
Modified: sandbox/math_toolkit/policy/libs/math/test/test_ellint_1.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_ellint_1.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_ellint_1.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -46,7 +46,7 @@
//
const char* largest_type;
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
- if(boost::math::tools::digits<double>() == boost::math::tools::digits<long double>())
+ if(boost::math::policy::digits<double, boost::math::policy::policy<> >() == boost::math::policy::digits<long double, boost::math::policy::policy<> >())
{
largest_type = "(long\\s+)?double";
}
Modified: sandbox/math_toolkit/policy/libs/math/test/test_ellint_2.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_ellint_2.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_ellint_2.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -45,7 +45,7 @@
//
const char* largest_type;
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
- if(boost::math::tools::digits<double>() == boost::math::tools::digits<long double>())
+ if(boost::math::policy::digits<double, boost::math::policy::policy<> >() == boost::math::policy::digits<long double, boost::math::policy::policy<> >())
{
largest_type = "(long\\s+)?double";
}
Modified: sandbox/math_toolkit/policy/libs/math/test/test_ellint_3.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_ellint_3.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_ellint_3.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -48,7 +48,7 @@
//
const char* largest_type;
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
- if(boost::math::tools::digits<double>() == boost::math::tools::digits<long double>())
+ if(boost::math::policy::digits<double, boost::math::policy::policy<> >() == boost::math::policy::digits<long double, boost::math::policy::policy<> >())
{
largest_type = "(long\\s+)?double";
}
Modified: sandbox/math_toolkit/policy/libs/math/test/test_factorials.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_factorials.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_factorials.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -210,7 +210,7 @@
::boost::math::falling_factorial(static_cast<T>(30.75), 30),
static_cast<T>(naive_falling_factorial(30.75L, 30)),
tolerance * 3);
- if(boost::math::tools::digits<T>() > 50)
+ if(boost::math::policy::digits<T, boost::math::policy::policy<> >() > 50)
{
BOOST_CHECK_CLOSE(
::boost::math::falling_factorial(static_cast<T>(-30.75L), 30),
Modified: sandbox/math_toolkit/policy/libs/math/test/test_gamma.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_gamma.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_gamma.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -54,7 +54,7 @@
//
const char* largest_type;
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
- if(boost::math::tools::digits<double>() == boost::math::tools::digits<long double>())
+ if(boost::math::policy::digits<double, boost::math::policy::policy<> >() == boost::math::policy::digits<long double, boost::math::policy::policy<> >())
{
largest_type = "(long\\s+)?double";
}
Modified: sandbox/math_toolkit/policy/libs/math/test/test_hermite.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_hermite.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_hermite.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -47,7 +47,7 @@
//
const char* largest_type;
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
- if(boost::math::tools::digits<double>() == boost::math::tools::digits<long double>())
+ if(boost::math::policy::digits<double, boost::math::policy::policy<> >() == boost::math::policy::digits<long double, boost::math::policy::policy<> >())
{
largest_type = "(long\\s+)?double";
}
Modified: sandbox/math_toolkit/policy/libs/math/test/test_ibeta.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_ibeta.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_ibeta.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -52,7 +52,7 @@
//
const char* largest_type;
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
- if(boost::math::tools::digits<double>() == boost::math::tools::digits<long double>())
+ if(boost::math::policy::digits<double, boost::math::policy::policy<> >() == boost::math::policy::digits<long double, boost::math::policy::policy<> >())
{
largest_type = "(long\\s+)?double";
}
Modified: sandbox/math_toolkit/policy/libs/math/test/test_ibeta_inv.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_ibeta_inv.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_ibeta_inv.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -61,7 +61,7 @@
//
const char* largest_type;
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
- if(boost::math::tools::digits<double>() == boost::math::tools::digits<long double>())
+ if(boost::math::policy::digits<double, boost::math::policy::policy<> >() == boost::math::policy::digits<long double, boost::math::policy::policy<> >())
{
largest_type = "(long\\s+)?double";
}
@@ -164,8 +164,8 @@
typedef typename T::value_type row_type;
typedef typename row_type::value_type value_type;
- value_type precision = static_cast<value_type>(ldexp(1.0, 1-boost::math::tools::digits<value_type>()/2)) * 100;
- if(boost::math::tools::digits<value_type>() < 50)
+ value_type precision = static_cast<value_type>(ldexp(1.0, 1-boost::math::policy::digits<value_type, boost::math::policy::policy<> >()/2)) * 100;
+ if(boost::math::policy::digits<value_type, boost::math::policy::policy<> >() < 50)
precision = 1; // 1% or two decimal digits, all we can hope for when the input is truncated
for(unsigned i = 0; i < data.size(); ++i)
Modified: sandbox/math_toolkit/policy/libs/math/test/test_ibeta_inv_ab.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_ibeta_inv_ab.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_ibeta_inv_ab.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -54,7 +54,7 @@
//
const char* largest_type;
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
- if(boost::math::tools::digits<double>() == boost::math::tools::digits<long double>())
+ if(boost::math::policy::digits<double, boost::math::policy::policy<> >() == boost::math::policy::digits<long double, boost::math::policy::policy<> >())
{
largest_type = "(long\\s+)?double";
}
@@ -115,8 +115,8 @@
typedef typename T::value_type row_type;
typedef typename row_type::value_type value_type;
- value_type precision = static_cast<value_type>(ldexp(1.0, 1-boost::math::tools::digits<value_type>()/2)) * 100;
- if(boost::math::tools::digits<value_type>() < 50)
+ value_type precision = static_cast<value_type>(ldexp(1.0, 1-boost::math::policy::digits<value_type, boost::math::policy::policy<> >()/2)) * 100;
+ if(boost::math::policy::digits<value_type, boost::math::policy::policy<> >() < 50)
precision = 1; // 1% or two decimal digits, all we can hope for when the input is truncated
for(unsigned i = 0; i < data.size(); ++i)
Modified: sandbox/math_toolkit/policy/libs/math/test/test_igamma.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_igamma.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_igamma.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -54,7 +54,7 @@
//
const char* largest_type;
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
- if(boost::math::tools::digits<double>() == boost::math::tools::digits<long double>())
+ if(boost::math::policy::digits<double, boost::math::policy::policy<> >() == boost::math::policy::digits<long double, boost::math::policy::policy<> >())
{
largest_type = "(long\\s+)?double";
}
Modified: sandbox/math_toolkit/policy/libs/math/test/test_igamma_inv.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_igamma_inv.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_igamma_inv.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -55,7 +55,7 @@
//
const char* largest_type;
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
- if(boost::math::tools::digits<double>() == boost::math::tools::digits<long double>())
+ if(boost::math::policy::digits<double, boost::math::policy::policy<> >() == boost::math::policy::digits<long double, boost::math::policy::policy<> >())
{
largest_type = "(long\\s+)?double";
}
@@ -204,8 +204,8 @@
// and also demonstrates that you can't in general round-trip these functions.
// It is however a useful sanity check.
//
- value_type precision = static_cast<value_type>(ldexp(1.0, 1-boost::math::tools::digits<value_type>()/2)) * 100;
- if(boost::math::tools::digits<value_type>() < 50)
+ value_type precision = static_cast<value_type>(ldexp(1.0, 1-boost::math::policy::digits<value_type, boost::math::policy::policy<> >()/2)) * 100;
+ if(boost::math::policy::digits<value_type, boost::math::policy::policy<> >() < 50)
precision = 1; // 1% or two decimal digits, all we can hope for when the input is truncated to float
for(unsigned i = 0; i < data.size(); ++i)
Modified: sandbox/math_toolkit/policy/libs/math/test/test_igamma_inva.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_igamma_inva.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_igamma_inva.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -51,7 +51,7 @@
//
const char* largest_type;
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
- if(boost::math::tools::digits<double>() == boost::math::tools::digits<long double>())
+ if(boost::math::policy::digits<double, boost::math::policy::policy<> >() == boost::math::policy::digits<long double, boost::math::policy::policy<> >())
{
largest_type = "(long\\s+)?double";
}
@@ -130,8 +130,8 @@
// and also demonstrates that you can't in general round-trip these functions.
// It is however a useful sanity check.
//
- value_type precision = static_cast<value_type>(ldexp(1.0, 1-boost::math::tools::digits<value_type>()/2)) * 100;
- if(boost::math::tools::digits<value_type>() < 50)
+ value_type precision = static_cast<value_type>(ldexp(1.0, 1-boost::math::policy::digits<value_type, boost::math::policy::policy<> >()/2)) * 100;
+ if(boost::math::policy::digits<value_type, boost::math::policy::policy<> >() < 50)
precision = 1; // 1% or two decimal digits, all we can hope for when the input is truncated to float
for(unsigned i = 0; i < data.size(); ++i)
Modified: sandbox/math_toolkit/policy/libs/math/test/test_laguerre.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_laguerre.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_laguerre.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -47,7 +47,7 @@
//
const char* largest_type;
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
- if(boost::math::tools::digits<double>() == boost::math::tools::digits<long double>())
+ if(boost::math::policy::digits<double, boost::math::policy::policy<> >() == boost::math::policy::digits<long double, boost::math::policy::policy<> >())
{
largest_type = "(long\\s+)?double";
}
Modified: sandbox/math_toolkit/policy/libs/math/test/test_legendre.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_legendre.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_legendre.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -47,7 +47,7 @@
//
const char* largest_type;
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
- if(boost::math::tools::digits<double>() == boost::math::tools::digits<long double>())
+ if(boost::math::policy::digits<double, boost::math::policy::policy<> >() == boost::math::policy::digits<long double, boost::math::policy::policy<> >())
{
largest_type = "(long\\s+)?double";
}
Modified: sandbox/math_toolkit/policy/libs/math/test/test_policy.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_policy.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_policy.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -43,8 +43,8 @@
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> >::precision_type, policy<>::precision_type>::value));
- BOOST_CHECK((is_same<policy<domain_error<ignore_error> >::float_promote_type, policy<>::float_promote_type>::value));
- BOOST_CHECK((is_same<policy<domain_error<ignore_error> >::double_promote_type, policy<>::double_promote_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));
@@ -54,8 +54,8 @@
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> >::precision_type, policy<>::precision_type>::value));
- BOOST_CHECK((is_same<policy<pole_error<user_error> >::float_promote_type, policy<>::float_promote_type>::value));
- BOOST_CHECK((is_same<policy<pole_error<user_error> >::double_promote_type, policy<>::double_promote_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));
@@ -65,8 +65,8 @@
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> >::precision_type, policy<>::precision_type>::value));
- BOOST_CHECK((is_same<policy<overflow_error<errno_on_error> >::float_promote_type, policy<>::float_promote_type>::value));
- BOOST_CHECK((is_same<policy<overflow_error<errno_on_error> >::double_promote_type, policy<>::double_promote_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));
@@ -76,8 +76,8 @@
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> >::precision_type, policy<>::precision_type>::value));
- BOOST_CHECK((is_same<policy<underflow_error<errno_on_error> >::float_promote_type, policy<>::float_promote_type>::value));
- BOOST_CHECK((is_same<policy<underflow_error<errno_on_error> >::double_promote_type, policy<>::double_promote_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));
@@ -87,8 +87,8 @@
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> >::precision_type, policy<>::precision_type>::value));
- BOOST_CHECK((is_same<policy<denorm_error<errno_on_error> >::float_promote_type, policy<>::float_promote_type>::value));
- BOOST_CHECK((is_same<policy<denorm_error<errno_on_error> >::double_promote_type, policy<>::double_promote_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));
@@ -98,8 +98,8 @@
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> >::precision_type, policy<>::precision_type>::value));
- BOOST_CHECK((is_same<policy<evaluation_error<errno_on_error> >::float_promote_type, policy<>::float_promote_type>::value));
- BOOST_CHECK((is_same<policy<evaluation_error<errno_on_error> >::double_promote_type, policy<>::double_promote_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<digits2<20> >::domain_error_type, policy<>::domain_error_type >::value));
@@ -109,8 +109,8 @@
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> >::precision_type, digits2<20> >::value));
- BOOST_CHECK((is_same<policy<digits2<20> >::float_promote_type, policy<>::float_promote_type>::value));
- BOOST_CHECK((is_same<policy<digits2<20> >::double_promote_type, policy<>::double_promote_type>::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));
@@ -120,8 +120,8 @@
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> >::precision_type, policy<>::precision_type >::value));
- BOOST_CHECK((is_same<policy<promote_float<false> >::float_promote_type, promote_float<false> >::value));
- BOOST_CHECK((is_same<policy<promote_float<false> >::double_promote_type, policy<>::double_promote_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));
@@ -131,8 +131,8 @@
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> >::precision_type, policy<>::precision_type >::value));
- BOOST_CHECK((is_same<policy<promote_double<false> >::float_promote_type, policy<>::float_promote_type>::value));
- BOOST_CHECK((is_same<policy<promote_double<false> >::double_promote_type, promote_double<false> >::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_above> >::domain_error_type, policy<>::domain_error_type >::value));
@@ -142,8 +142,8 @@
BOOST_CHECK((is_same<policy<discrete_quantile<integer_above> >::denorm_error_type, policy<>::denorm_error_type >::value));
BOOST_CHECK((is_same<policy<discrete_quantile<integer_above> >::evaluation_error_type, policy<>::evaluation_error_type >::value));
BOOST_CHECK((is_same<policy<discrete_quantile<integer_above> >::precision_type, policy<>::precision_type >::value));
- BOOST_CHECK((is_same<policy<discrete_quantile<integer_above> >::float_promote_type, policy<>::float_promote_type>::value));
- BOOST_CHECK((is_same<policy<discrete_quantile<integer_above> >::double_promote_type, policy<>::double_promote_type>::value));
+ BOOST_CHECK((is_same<policy<discrete_quantile<integer_above> >::promote_float_type, policy<>::promote_float_type>::value));
+ BOOST_CHECK((is_same<policy<discrete_quantile<integer_above> >::promote_double_type, policy<>::promote_double_type>::value));
BOOST_CHECK((is_same<policy<discrete_quantile<integer_above> >::discrete_quantile_type, discrete_quantile<integer_above> >::value));
//
@@ -156,8 +156,8 @@
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> >::precision_type, policy<>::precision_type>::value));
- BOOST_CHECK((is_same<policy<domain_error<ignore_error>, overflow_error<ignore_error> >::float_promote_type, policy<>::float_promote_type>::value));
- BOOST_CHECK((is_same<policy<domain_error<ignore_error>, overflow_error<ignore_error> >::double_promote_type, policy<>::double_promote_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));
@@ -167,8 +167,8 @@
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> >::precision_type, policy<>::precision_type>::value));
- BOOST_CHECK((is_same<policy<denorm_error<throw_on_error>, domain_error<ignore_error> >::float_promote_type, policy<>::float_promote_type>::value));
- BOOST_CHECK((is_same<policy<denorm_error<throw_on_error>, domain_error<ignore_error> >::double_promote_type, policy<>::double_promote_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_below>, denorm_error<throw_on_error>, domain_error<ignore_error> >::domain_error_type, domain_error<ignore_error> >::value));
@@ -178,8 +178,8 @@
BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_below>, 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_below>, 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_below>, 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_below>, denorm_error<throw_on_error>, domain_error<ignore_error> >::float_promote_type, promote_float<false> >::value));
- BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> >::double_promote_type, policy<>::double_promote_type>::value));
+ BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_below>, 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_below>, 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_below>, denorm_error<throw_on_error>, domain_error<ignore_error> >::discrete_quantile_type, discrete_quantile<integer_below> >::value));
BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::domain_error_type, domain_error<ignore_error> >::value));
@@ -189,8 +189,8 @@
BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_below>, 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_below>, 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_below>, 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_below>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::float_promote_type, promote_float<false> >::value));
- BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::double_promote_type, policy<>::double_promote_type>::value));
+ BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_below>, 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_below>, 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_below>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::discrete_quantile_type, discrete_quantile<integer_below> >::value));
BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::domain_error_type, domain_error<ignore_error> >::value));
@@ -200,8 +200,8 @@
BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_below>, 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_below>, 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_below>, 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_below>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::float_promote_type, promote_float<false> >::value));
- BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::double_promote_type, policy<>::double_promote_type>::value));
+ BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_below>, 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_below>, 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_below>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::discrete_quantile_type, discrete_quantile<integer_below> >::value));
BOOST_CHECK(check_same(make_policy(), policy<>()));
Modified: sandbox/math_toolkit/policy/libs/math/test/test_rational.hpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_rational.hpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_rational.hpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -3,6 +3,7 @@
#define BOOST_MATH_TEST_RATIONAL_HPP
#include <boost/math/tools/rational.hpp>
+#include <boost/math/tools/precision.hpp>
template <class T, class U>
void do_test_spots(T, U)
Modified: sandbox/math_toolkit/policy/libs/math/test/test_rational_double.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_rational_double.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_rational_double.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -3,6 +3,7 @@
#include <boost/test/test_exec_monitor.hpp>
#include <boost/array.hpp>
#include <boost/math/tools/rational.hpp>
+#include <iostream>
#include "test_rational.hpp"
Modified: sandbox/math_toolkit/policy/libs/math/test/test_rational_float.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_rational_float.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_rational_float.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -3,6 +3,7 @@
#include <boost/test/test_exec_monitor.hpp>
#include <boost/array.hpp>
#include <boost/math/tools/rational.hpp>
+#include <iostream>
#include "test_rational.hpp"
Modified: sandbox/math_toolkit/policy/libs/math/test/test_rational_ldouble.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_rational_ldouble.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_rational_ldouble.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -3,6 +3,7 @@
#include <boost/test/test_exec_monitor.hpp>
#include <boost/array.hpp>
#include <boost/math/tools/rational.hpp>
+#include <iostream>
#include "test_rational.hpp"
Modified: sandbox/math_toolkit/policy/libs/math/test/test_rationals.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_rationals.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_rationals.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -8,6 +8,7 @@
#include <boost/test/floating_point_comparison.hpp>
#include <boost/array.hpp>
#include <boost/math/tools/rational.hpp>
+#include <iostream>
#include "test_rational.hpp"
Modified: sandbox/math_toolkit/policy/libs/math/test/test_remez.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_remez.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_remez.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -100,6 +100,10 @@
std::cout << approx1.error_term() << " " << approx1.max_error() << " " << approx1.max_change() << std::endl;
}
std::cout << "~~~~~~~~~~~~~~~~~~~~~~~~~" << std::endl;
+#if 0
+ //
+ // This one causes UBLAS to fail on some systems, so disabled for now.
+ //
std::cout << "Testing expm1 approximation, pinned to origin, relative error, 3+3 term rational\n";
boost::math::tools::remez_minimax<double> approx2(f, 3, 3, -1, 1, true, true);
std::cout << "Interpolation Error: " << approx1.max_error() << std::endl;
@@ -109,7 +113,7 @@
std::cout << approx2.error_term() << " " << approx2.max_error() << " " << approx2.max_change() << std::endl;
}
std::cout << "~~~~~~~~~~~~~~~~~~~~~~~~~" << std::endl;
-
+#endif
f = std::exp;
std::cout << "Testing exp approximation, not pinned to origin, abolute error, 3+3 term rational\n";
boost::math::tools::remez_minimax<double> approx3(f, 3, 3, -1, 1, false, false);
Modified: sandbox/math_toolkit/policy/libs/math/test/test_roots.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_roots.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_roots.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -225,8 +225,8 @@
typedef typename T::value_type row_type;
typedef typename row_type::value_type value_type;
- value_type precision = static_cast<value_type>(ldexp(1.0, 1-boost::math::tools::digits<value_type>()/2)) * 100;
- if(boost::math::tools::digits<value_type>() < 50)
+ value_type precision = static_cast<value_type>(ldexp(1.0, 1-boost::math::policy::digits<value_type, boost::math::policy::policy<> >()/2)) * 100;
+ if(boost::math::policy::digits<value_type, boost::math::policy::policy<> >() < 50)
precision = 1; // 1% or two decimal digits, all we can hope for when the input is truncated
for(unsigned i = 0; i < data.size(); ++i)
Modified: sandbox/math_toolkit/policy/libs/math/test/test_spherical_harmonic.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_spherical_harmonic.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_spherical_harmonic.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -46,7 +46,7 @@
//
const char* largest_type;
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
- if(boost::math::tools::digits<double>() == boost::math::tools::digits<long double>())
+ if(boost::math::policy::digits<double, boost::math::policy::policy<> >() == boost::math::policy::digits<long double, boost::math::policy::policy<> >())
{
largest_type = "(long\\s+)?double";
}
Modified: sandbox/math_toolkit/policy/libs/math/test/test_tgamma_ratio.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_tgamma_ratio.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_tgamma_ratio.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -48,7 +48,7 @@
//
const char* largest_type;
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
- if(boost::math::tools::digits<double>() == boost::math::tools::digits<long double>())
+ if(boost::math::policy::digits<double, boost::math::policy::policy<> >() == boost::math::policy::digits<long double, boost::math::policy::policy<> >())
{
largest_type = "(long\\s+)?double";
}
Modified: sandbox/math_toolkit/policy/libs/math/tools/ibeta_data.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/tools/ibeta_data.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/tools/ibeta_data.cpp 2007-07-18 05:35:44 EDT (Wed, 18 Jul 2007)
@@ -87,7 +87,7 @@
T get_ibeta_fraction1(T a, T b, T x)
{
ibeta_fraction1_t<T> f(a, b, x);
- T fract = boost::math::tools::continued_fraction_a(f, boost::math::tools::digits<T>());
+ T fract = boost::math::tools::continued_fraction_a(f, boost::math::policy::digits<T, boost::math::policy<> >());
T denom = (a * (fract + 1));
T num = pow(x, a) * pow(1 - x, b);
if(num == 0)
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