|
Boost-Commit : |
From: johnmaddock_at_[hidden]
Date: 2007-06-21 12:21:18
Author: johnmaddock
Date: 2007-06-21 12:21:16 EDT (Thu, 21 Jun 2007)
New Revision: 7121
URL: http://svn.boost.org/trac/boost/changeset/7121
Log:
Added policy interface to erf/erfc, gamma-inverses and root-finding functions.
Text files modified:
sandbox/math_toolkit/policy/boost/math/distributions/binomial.hpp | 6
sandbox/math_toolkit/policy/boost/math/distributions/chi_squared.hpp | 2
sandbox/math_toolkit/policy/boost/math/distributions/students_t.hpp | 2
sandbox/math_toolkit/policy/boost/math/policy/policy.hpp | 4
sandbox/math_toolkit/policy/boost/math/special_functions/detail/erf_inv.hpp | 93 +++++++++--------
sandbox/math_toolkit/policy/boost/math/special_functions/detail/gamma_inva.hpp | 2
sandbox/math_toolkit/policy/boost/math/special_functions/detail/ibeta_inv_ab.hpp | 2
sandbox/math_toolkit/policy/boost/math/special_functions/detail/igamma_inverse.hpp | 4
sandbox/math_toolkit/policy/boost/math/special_functions/erf.hpp | 205 +++++++++++++++++++++++----------------
sandbox/math_toolkit/policy/boost/math/tools/roots.hpp | 21 ++-
sandbox/math_toolkit/policy/boost/math/tools/toms748_solve.hpp | 42 +++++--
sandbox/math_toolkit/policy/libs/math/performance/main.cpp | 1
sandbox/math_toolkit/policy/libs/math/test/Jamfile.v2 | 2
sandbox/math_toolkit/policy/libs/math/test/test_erf.cpp | 12 ++
14 files changed, 238 insertions(+), 160 deletions(-)
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-06-21 12:21:16 EDT (Thu, 21 Jun 2007)
@@ -662,7 +662,8 @@
factor,
true,
tol,
- max_iter);
+ max_iter,
+ policy::policy<>());
if(max_iter >= 1000)
tools::logic_error<RealType>(BOOST_CURRENT_FUNCTION, "Unable to locate the root within a reasonable number of iterations, closest approximation so far was %1%", r.first);
// return centre point of range found:
@@ -749,7 +750,8 @@
factor,
true,
tol,
- max_iter);
+ max_iter,
+ policy::policy<>());
if(max_iter >= 1000)
tools::logic_error<RealType>(BOOST_CURRENT_FUNCTION, "Unable to locate the root within a reasonable number of iterations, closest approximation so far was %1%", r.first);
// return centre point of range found:
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-06-21 12:21:16 EDT (Thu, 21 Jun 2007)
@@ -290,7 +290,7 @@
detail::df_estimator<RealType> f(alpha, beta, variance, difference_from_variance);
tools::eps_tolerance<RealType> tol(tools::digits<RealType>());
boost::uintmax_t max_iter = 10000;
- std::pair<RealType, RealType> r = tools::bracket_and_solve_root(f, hint, RealType(2), false, tol, max_iter);
+ std::pair<RealType, RealType> r = tools::bracket_and_solve_root(f, hint, RealType(2), false, tol, max_iter, policy::policy<>());
RealType result = r.first + (r.second - r.first) / 2;
if(max_iter == 10000)
{
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-06-21 12:21:16 EDT (Thu, 21 Jun 2007)
@@ -284,7 +284,7 @@
detail::sample_size_func<RealType> f(alpha, beta, sd, difference_from_mean);
tools::eps_tolerance<RealType> tol(tools::digits<RealType>());
boost::uintmax_t max_iter = 10000;
- std::pair<RealType, RealType> r = tools::bracket_and_solve_root(f, hint, RealType(2), false, tol, max_iter);
+ std::pair<RealType, RealType> r = tools::bracket_and_solve_root(f, hint, RealType(2), false, tol, max_iter, policy::policy<>());
RealType result = r.first + (r.second - r.first) / 2;
if(max_iter == 10000)
{
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-06-21 12:21:16 EDT (Thu, 21 Jun 2007)
@@ -394,7 +394,7 @@
#if BOOST_MATH_DIGITS10_POLICY == 0
typedef digits2<> precision_type;
#else
- typedef typename detail::precision<digits10<>, digits2<> >::type precision_type;
+ typedef detail::precision<digits10<>, digits2<> >::type precision_type;
#endif
typedef promote_float<> float_promote_type;
typedef promote_double<> double_promote_type;
@@ -414,7 +414,7 @@
#if BOOST_MATH_DIGITS10_POLICY == 0
typedef digits2<> precision_type;
#else
- typedef typename detail::precision<digits10<>, digits2<> >::type precision_type;
+ typedef detail::precision<digits10<>, digits2<> >::type precision_type;
#endif
typedef promote_float<false> float_promote_type;
typedef promote_double<false> double_promote_type;
Modified: sandbox/math_toolkit/policy/boost/math/special_functions/detail/erf_inv.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/special_functions/detail/erf_inv.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/special_functions/detail/erf_inv.hpp 2007-06-21 12:21:16 EDT (Thu, 21 Jun 2007)
@@ -13,8 +13,8 @@
// The inverse erf and erfc functions share a common implementation,
// this version is for 80-bit long double's and smaller:
//
-template <class T>
-T erf_inv_imp(const T& p, const T& q, const boost::mpl::int_<64>*)
+template <class T, class Policy>
+T erf_inv_imp(const T& p, const T& q, const Policy&, const boost::mpl::int_<64>*)
{
using namespace std; // for ADL of std names.
@@ -270,7 +270,7 @@
return result;
}
-template <class T>
+template <class T, class Policy>
struct erf_roots
{
std::tr1::tuple<T,T,T> operator()(const T& guess)
@@ -278,7 +278,7 @@
using namespace std;
T derivative = sign * (2 / sqrt(constants::pi<T>())) * exp(-(guess * guess));
T derivative2 = -2 * guess * derivative;
- return std::tr1::make_tuple(((sign > 0) ? boost::math::erf(guess) : boost::math::erfc(guess)) - target, derivative, derivative2);
+ return std::tr1::make_tuple(((sign > 0) ? boost::math::erf(guess, Policy()) : boost::math::erfc(guess, Policy())) - target, derivative, derivative2);
}
erf_roots(T z, int s) : target(z), sign(s) {}
private:
@@ -286,27 +286,27 @@
int sign;
};
-template <class T>
-T erf_inv_imp(const T& p, const T& q, const boost::mpl::int_<0>*)
+template <class T, class Policy>
+T erf_inv_imp(const T& p, const T& q, const Policy& pol, const boost::mpl::int_<0>*)
{
//
// Generic version, get a guess that's accurate to 64-bits (10^-19)
//
- T guess = erf_inv_imp(p, q, static_cast<mpl::int_<64> const*>(0));
+ T guess = erf_inv_imp(p, q, pol, static_cast<mpl::int_<64> const*>(0));
T result;
//
// If T has more bit's than 64 in it's mantissa then we need to iterate,
// otherwise we can just return the result:
//
- if(tools::digits<T>() > 64)
+ if(policy::digits<T, Policy>() > 64)
{
if(p <= 0.5)
{
- result = tools::halley_iterate(detail::erf_roots<typename remove_cv<T>::type>(p, 1), guess, static_cast<T>(0), tools::max_value<T>(), (tools::digits<T>() * 2) / 3);
+ result = tools::halley_iterate(detail::erf_roots<typename remove_cv<T>::type, Policy>(p, 1), guess, static_cast<T>(0), tools::max_value<T>(), (policy::digits<T, Policy>() * 2) / 3);
}
else
{
- result = tools::halley_iterate(detail::erf_roots<typename remove_cv<T>::type>(q, -1), guess, static_cast<T>(0), tools::max_value<T>(), (tools::digits<T>() * 2) / 3);
+ result = tools::halley_iterate(detail::erf_roots<typename remove_cv<T>::type, Policy>(q, -1), guess, static_cast<T>(0), tools::max_value<T>(), (policy::digits<T, Policy>() * 2) / 3);
}
}
else
@@ -318,19 +318,20 @@
} // namespace detail
-template <class T>
-typename tools::promote_args<T>::type erfc_inv(T z)
+template <class T, class Policy>
+typename tools::promote_args<T>::type erfc_inv(T z, const Policy& pol)
{
typedef typename tools::promote_args<T>::type result_type;
//
// Begin by testing for domain errors, and other special cases:
//
+ static const char* function = "boost::math::erfc_inv<%1%>(%1%, %1%)";
if((z < 0) || (z > 2))
- tools::domain_error<result_type>(BOOST_CURRENT_FUNCTION, "Argument outside range [0,2] in inverse erfc function (got p=%1%).", z);
+ policy::raise_domain_error<result_type>(function, "Argument outside range [0,2] in inverse erfc function (got p=%1%).", z, pol);
if(z == 0)
- return tools::overflow_error<result_type>(BOOST_CURRENT_FUNCTION);
+ return policy::raise_overflow_error<result_type>(function, 0, pol);
if(z == 2)
- return -tools::overflow_error<result_type>(BOOST_CURRENT_FUNCTION);
+ return -policy::raise_overflow_error<result_type>(function, 0, pol);
//
// Normalise the input, so it's in the range [0,1], we will
// negate the result if z is outside that range. This is a simple
@@ -353,38 +354,38 @@
// A bit of meta-programming to figure out which implementation
// to use, based on the number of bits in the mantissa of T:
//
- typedef typename mpl::if_c<
- std::numeric_limits<result_type>::is_specialized
- &&
- (std::numeric_limits<result_type>::digits <= 64),
- mpl::int_<64>,
- mpl::int_<0>
+ typedef typename policy::precision<result_type, Policy>::type precision_type;
+ typedef typename mpl::if_<
+ mpl::or_<mpl::less_equal<precision_type, mpl::int_<0> >, mpl::greater<precision_type, mpl::int_<64> > >,
+ mpl::int_<0>,
+ mpl::int_<64>
>::type tag_type;
//
// Likewise use internal promotion, so we evaluate at a higher
// precision internally if it's appropriate:
//
- typedef typename tools::evaluation<result_type>::type eval_type;
+ typedef typename policy::evaluation<result_type, Policy>::type eval_type;
//
// And get the result, negating where required:
//
- return s * tools::checked_narrowing_cast<result_type>(
- detail::erf_inv_imp(static_cast<eval_type>(p), static_cast<eval_type>(q), static_cast<tag_type const*>(0)), BOOST_CURRENT_FUNCTION);
+ return s * policy::checked_narrowing_cast<result_type, Policy>(
+ detail::erf_inv_imp(static_cast<eval_type>(p), static_cast<eval_type>(q), pol, static_cast<tag_type const*>(0)), function);
}
-template <class T>
-typename tools::promote_args<T>::type erf_inv(T z)
+template <class T, class Policy>
+typename tools::promote_args<T>::type erf_inv(T z, const Policy& pol)
{
typedef typename tools::promote_args<T>::type result_type;
//
// Begin by testing for domain errors, and other special cases:
//
+ static const char* function = "boost::math::erf_inv<%1%>(%1%, %1%)";
if((z < -1) || (z > 1))
- tools::domain_error<result_type>(BOOST_CURRENT_FUNCTION, "Argument outside range [-1, 1] in inverse erf function (got p=%1%).", z);
+ policy::raise_domain_error<result_type>(function, "Argument outside range [-1, 1] in inverse erf function (got p=%1%).", z, pol);
if(z == 1)
- return tools::overflow_error<result_type>(BOOST_CURRENT_FUNCTION);
+ return policy::raise_overflow_error<result_type>(function, 0, pol);
if(z == -1)
- return -tools::overflow_error<result_type>(BOOST_CURRENT_FUNCTION);
+ return -policy::raise_overflow_error<result_type>(function, 0, pol);
if(z == 0)
return 0;
//
@@ -409,35 +410,39 @@
// A bit of meta-programming to figure out which implementation
// to use, based on the number of bits in the mantissa of T:
//
- typedef typename mpl::if_c<
- std::numeric_limits<result_type>::is_specialized
- &&
- (std::numeric_limits<result_type>::digits <= 64),
- mpl::int_<64>,
- mpl::int_<0>
+ typedef typename policy::precision<result_type, Policy>::type precision_type;
+ typedef typename mpl::if_<
+ mpl::or_<mpl::less_equal<precision_type, mpl::int_<0> >, mpl::greater<precision_type, mpl::int_<64> > >,
+ mpl::int_<0>,
+ mpl::int_<64>
>::type tag_type;
//
// Likewise use internal promotion, so we evaluate at a higher
// precision internally if it's appropriate:
//
- typedef typename tools::evaluation<result_type>::type eval_type;
+ typedef typename policy::evaluation<result_type, Policy>::type eval_type;
+ //
+ // Likewise use internal promotion, so we evaluate at a higher
+ // precision internally if it's appropriate:
+ //
+ typedef typename policy::evaluation<result_type, Policy>::type eval_type;
//
// And get the result, negating where required:
//
- return s * tools::checked_narrowing_cast<result_type>(
- detail::erf_inv_imp(static_cast<eval_type>(p), static_cast<eval_type>(q), static_cast<tag_type const*>(0)), BOOST_CURRENT_FUNCTION);
+ return s * policy::checked_narrowing_cast<result_type, Policy>(
+ detail::erf_inv_imp(static_cast<eval_type>(p), static_cast<eval_type>(q), pol, static_cast<tag_type const*>(0)), function);
}
-template <class T, class Policy>
-inline typename tools::promote_args<T>::type erfc_inv(T z, const Policy&)
+template <class T>
+inline typename tools::promote_args<T>::type erfc_inv(T z)
{
- return erfc_inv(z);
+ return erfc_inv(z, policy::policy<>());
}
-template <class T, class Policy>
-inline typename tools::promote_args<T>::type erf_inv(T z, const Policy&)
+template <class T>
+inline typename tools::promote_args<T>::type erf_inv(T z)
{
- return erf_inv(z);
+ return erf_inv(z, policy::policy<>());
}
} // namespace math
Modified: sandbox/math_toolkit/policy/boost/math/special_functions/detail/gamma_inva.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/special_functions/detail/gamma_inva.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/special_functions/detail/gamma_inva.hpp 2007-06-21 12:21:16 EDT (Thu, 21 Jun 2007)
@@ -138,7 +138,7 @@
// Poisson distribution as our derivative, but that's
// even worse performance-wise than the generic method :-(
//
- std::pair<T, T> r = bracket_and_solve_root(f, guess, factor, false, tol, max_iter);
+ std::pair<T, T> r = bracket_and_solve_root(f, guess, factor, false, tol, max_iter, pol);
if(max_iter >= 200)
policy::raise_evaluation_error<T>("boost::math::gamma_p_inva<%1%>(%1%, %1%)", "Unable to locate the root within a reasonable number of iterations, closest approximation so far was %1%", r.first, pol);
return (r.first + r.second) / 2;
Modified: sandbox/math_toolkit/policy/boost/math/special_functions/detail/ibeta_inv_ab.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/special_functions/detail/ibeta_inv_ab.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/special_functions/detail/ibeta_inv_ab.hpp 2007-06-21 12:21:16 EDT (Thu, 21 Jun 2007)
@@ -147,7 +147,7 @@
// Max iterations permitted:
//
boost::uintmax_t max_iter = 200;
- std::pair<T, T> r = bracket_and_solve_root(f, guess, factor, swap_ab ? true : false, tol, max_iter);
+ std::pair<T, T> r = bracket_and_solve_root(f, guess, factor, swap_ab ? true : false, tol, max_iter, policy::policy<>());
if(max_iter >= 200)
tools::logic_error<T>(BOOST_CURRENT_FUNCTION, "Unable to locate the root within a reasonable number of iterations, closest approximation so far was %1%", r.first);
return (r.first + r.second) / 2;
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-06-21 12:21:16 EDT (Thu, 21 Jun 2007)
@@ -356,9 +356,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>() - 2;
+ digits = policy::digits<T, Policy>() - 2;
//
// Go ahead and iterate:
//
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-06-21 12:21:16 EDT (Thu, 21 Jun 2007)
@@ -55,54 +55,80 @@
{
return (std::numeric_limits<float>::max)();
}
-inline float erf_asymptotic_limit_N(const boost::integral_constant<int, 24>&)
+inline float erf_asymptotic_limit_N(const mpl::int_<24>&)
{
return 2.8F;
}
-inline float erf_asymptotic_limit_N(const boost::integral_constant<int, 53>&)
+inline float erf_asymptotic_limit_N(const mpl::int_<53>&)
{
return 4.3F;
}
-inline float erf_asymptotic_limit_N(const boost::integral_constant<int, 64>&)
+inline float erf_asymptotic_limit_N(const mpl::int_<64>&)
{
return 4.8F;
}
-inline float erf_asymptotic_limit_N(const boost::integral_constant<int, 106>&)
+inline float erf_asymptotic_limit_N(const mpl::int_<106>&)
{
return 6.5F;
}
-inline float erf_asymptotic_limit_N(const boost::integral_constant<int, 113>&)
+inline float erf_asymptotic_limit_N(const mpl::int_<113>&)
{
return 6.8F;
}
-template <class T>
+template <class T, class Policy>
inline T erf_asymptotic_limit()
{
- return erf_asymptotic_limit_N(boost::integral_constant<int, std::numeric_limits<T>::digits>());
+ typedef typename policy::precision<T, Policy>::type precision_type;
+ typedef typename mpl::if_<
+ mpl::less_equal<precision_type, mpl::int_<24> >,
+ typename mpl::if_<
+ mpl::less_equal<precision_type, mpl::int_<0> >,
+ mpl::int_<0>,
+ mpl::int_<24>
+ >::type,
+ typename mpl::if_<
+ mpl::less_equal<precision_type, mpl::int_<53> >,
+ mpl::int_<53>,
+ typename mpl::if_<
+ mpl::less_equal<precision_type, mpl::int_<64> >,
+ mpl::int_<64>,
+ typename mpl::if_<
+ mpl::less_equal<precision_type, mpl::int_<106> >,
+ mpl::int_<106>,
+ typename mpl::if_<
+ mpl::less_equal<precision_type, mpl::int_<113> >,
+ mpl::int_<113>,
+ mpl::int_<0>
+ >::type
+ >::type
+ >::type
+ >::type
+ >::type tag_type;
+ return erf_asymptotic_limit_N(tag_type());
}
-template <class T, class L, class Tag>
-T erf_imp(T z, bool invert, const L& l, const Tag& t)
+template <class T, class Policy, class Tag>
+T erf_imp(T z, bool invert, const Policy& pol, const Tag& t)
{
using namespace std;
if(z < 0)
{
if(!invert)
- return -erf_imp(-z, invert, l, t);
+ return -erf_imp(-z, invert, pol, t);
else
- return 1 + erf_imp(-z, false, l, t);
+ return 1 + erf_imp(-z, false, pol, t);
}
T result;
- if(!invert && (z > detail::erf_asymptotic_limit<T>()))
+ if(!invert && (z > detail::erf_asymptotic_limit<T, Policy>()))
{
detail::erf_asympt_series_t<T> s(z);
boost::uintmax_t max_iter = BOOST_MATH_MAX_ITER;
- result = boost::math::tools::sum_series(s, boost::math::tools::digits<T>(), max_iter, 1);
- tools::check_series_iterations(BOOST_CURRENT_FUNCTION, 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);
}
else
{
@@ -113,13 +139,13 @@
result = z * exp(-x);
result /= sqrt(boost::math::constants::pi<T>());
if(result != 0)
- result *= 2 * detail::lower_gamma_series(T(0.5f), x, policy::policy<>());
+ result *= 2 * detail::lower_gamma_series(T(0.5f), x, pol);
}
else if(x < 1.1f)
{
// Compute Q:
invert = !invert;
- result = tgamma_small_upper_part(T(0.5f), x, policy::policy<>());
+ result = tgamma_small_upper_part(T(0.5f), x, pol);
result /= sqrt(boost::math::constants::pi<T>());
}
else
@@ -128,7 +154,7 @@
invert = !invert;
result = z * exp(-x);
result /= sqrt(boost::math::constants::pi<T>());
- result *= upper_gamma_fraction(T(0.5f), x, tools::digits<T>());
+ result *= upper_gamma_fraction(T(0.5f), x, policy::digits<T, Policy>());
}
}
if(invert)
@@ -136,19 +162,19 @@
return result;
}
-template <class T, class L>
-T erf_imp(T z, bool invert, const L& l, const mpl::int_<53>& t)
+template <class T, class Policy>
+T erf_imp(T z, bool invert, const Policy& pol, const mpl::int_<53>& t)
{
using namespace std;
if(z < 0)
{
if(!invert)
- return -erf_imp(-z, invert, l, t);
+ return -erf_imp(-z, invert, pol, t);
else if(z < -0.5)
- return 2 - erf_imp(-z, invert, l, t);
+ return 2 - erf_imp(-z, invert, pol, t);
else
- return 1 + erf_imp(-z, false, l, t);
+ return 1 + erf_imp(-z, false, pol, t);
}
T result;
@@ -169,12 +195,12 @@
}
else if(z < 1e-10)
{
- result = z * 1.125 + z * 0.003379167095512573896158903121545171688;
+ result = z * 1.125 + z * 0.003379167095512573896158903121545171688L;
}
else
{
- static const T n[7] = { 0.00337916709551257778174, -0.000147024115786688745475, -0.37463022236812520164, 0.0163061594494816999803, -0.0534354147807331748737, 0.00161898096813581982844, -0.0059528010489182840404 };
- static const T d[7] = { 1, -0.0435089806536379531594, 0.442761965043509204727, -0.017375974533016704678, 0.0772756490303260060769, -0.00210552465858669941879, 0.00544772980263244037286 };
+ static const T n[7] = { 0.00337916709551257778174L, -0.000147024115786688745475L, -0.37463022236812520164L, 0.0163061594494816999803L, -0.0534354147807331748737L, 0.00161898096813581982844L, -0.0059528010489182840404L };
+ static const T d[7] = { 1, -0.0435089806536379531594L, 0.442761965043509204727L, -0.017375974533016704678L, 0.0772756490303260060769L, -0.00210552465858669941879L, 0.00544772980263244037286L };
result = z * 1.125 + z * tools::evaluate_polynomial(n, z) / tools::evaluate_polynomial(d, z);
}
}
@@ -188,8 +214,8 @@
if(z < 0.75)
{
// Worst case absolute error found: 8.554649561e-018
- static const T n[5] = { -0.0361790390718262468222, 0.301888464724047222196, 0.201731143672633894981, 0.0659353268087389983319, 0.00721876720062364930761 };
- static const T d[6] = { 1, 1.58814245739127341535, 0.99354580430196422336, 0.291753007176902027213, 0.033994791234913855515, -0.000104234653166533504303 };
+ static const T n[5] = { -0.0361790390718262468222L, 0.301888464724047222196L, 0.201731143672633894981L, 0.0659353268087389983319L, 0.00721876720062364930761L };
+ static const T d[6] = { 1, 1.58814245739127341535L, 0.99354580430196422336L, 0.291753007176902027213L, 0.033994791234913855515L, -0.000104234653166533504303L };
static const float f0 = 0.3440242112F;
r = tools::evaluate_polynomial(n, z - 0.5) / tools::evaluate_polynomial(d, z - 0.5);
b = f0;
@@ -197,8 +223,8 @@
else if(z < 1.25)
{
// Worst case absolute error found: 6.50251514e-018
- static const T n[6] = { -0.039787689261113685983, 0.160309168830518003303, 0.163049978514596540313, 0.0710685660158400750009, 0.01497188097404877543, 0.00130080628375002584279 };
- static const T d[6] = { 1, 1.77564880074171280407, 1.31438791181040008779, 0.509359151038517059748, 0.103958527905812829559, 0.00901292460643094469406 };
+ static const T n[6] = { -0.039787689261113685983L, 0.160309168830518003303L, 0.163049978514596540313L, 0.0710685660158400750009L, 0.01497188097404877543L, 0.00130080628375002584279L };
+ static const T d[6] = { 1, 1.77564880074171280407L, 1.31438791181040008779L, 0.509359151038517059748L, 0.103958527905812829559L, 0.00901292460643094469406L };
static const float f0 = 0.419990927F;
r = tools::evaluate_polynomial(n, z - 0.75) / tools::evaluate_polynomial(d, z - 0.75);
b = f0;
@@ -206,8 +232,8 @@
else if(z < 2.25)
{
// Worst case absolute error found: 1.132743504e-017
- static const T n[6] = { -0.0300838560557949724172, 0.0592886319615167248092, 0.0622294724048409148736, 0.0248575228109427909578, 0.00463781847004901844581, 0.000347305179334822548368 };
- static const T d[7] = { 1, 1.57915060645728571344, 1.03342495188878679417, 0.35158678814344218974, 0.062469256580984456783, 0.00466640448020624599948, 0.290106403940303572448e-6 };
+ static const T n[6] = { -0.0300838560557949724172L, 0.0592886319615167248092L, 0.0622294724048409148736L, 0.0248575228109427909578L, 0.00463781847004901844581L, 0.000347305179334822548368L };
+ static const T d[7] = { 1, 1.57915060645728571344L, 1.03342495188878679417L, 0.35158678814344218974L, 0.062469256580984456783L, 0.00466640448020624599948L, 0.290106403940303572448e-6L };
static const float f0 = 0.4898625016F;
r = tools::evaluate_polynomial(n, z - 1.25) / tools::evaluate_polynomial(d, z - 1.25);
b = f0;
@@ -215,8 +241,8 @@
else if(z < 3.5)
{
// Worst case absolute error found: 3.446364609e-018
- static const T n[6] = { -0.0117907570137227857015, 0.0162667227692515660221, 0.0175329212378413544794, 0.00620897681269247137578, 0.000986614895094589251706, 0.601354618401624353425e-4 };
- static const T d[6] = { 1, 1.33374851361555383557, 0.73227756904205983415, 0.207410266363727673685, 0.0304034048466731110163, 0.00185296959991832048613 };
+ static const T n[6] = { -0.0117907570137227857015L, 0.0162667227692515660221L, 0.0175329212378413544794L, 0.00620897681269247137578L, 0.000986614895094589251706L, 0.601354618401624353425e-4L };
+ static const T d[6] = { 1, 1.33374851361555383557L, 0.73227756904205983415L, 0.207410266363727673685L, 0.0304034048466731110163L, 0.00185296959991832048613L };
static const float f0 = 0.5317370892F;
r = tools::evaluate_polynomial(n, z - 2.25) / tools::evaluate_polynomial(d, z - 2.25);
b = f0;
@@ -224,8 +250,8 @@
else if(z < 5.5)
{
// Worst case absolute error found: 1.579588208e-018
- static const T n[6] = { -0.00588219091116732271979, 0.00434428684527812140098, 0.00466899990542371512895, 0.00139937567253199794533, 0.000179205902444982389766, 0.845033527560949509345e-5 };
- static const T d[6] = { 1, 1.07389345953392962127, 0.470965611895885060643, 0.105594730223366124873, 0.0121252833787344059719, 0.000571755036133730341579 };
+ static const T n[6] = { -0.00588219091116732271979L, 0.00434428684527812140098L, 0.00466899990542371512895L, 0.00139937567253199794533L, 0.000179205902444982389766L, 0.845033527560949509345e-5L };
+ static const T d[6] = { 1, 1.07389345953392962127L, 0.470965611895885060643L, 0.105594730223366124873L, 0.0121252833787344059719L, 0.000571755036133730341579L };
static const float f0 = 0.5494099855F;
r = tools::evaluate_polynomial(n, z - 3.5) / tools::evaluate_polynomial(d, z - 3.5);
b = f0;
@@ -233,8 +259,8 @@
else if(z < 9)
{
// Worst case absolute error found: 1.410768708e-017
- static const T n[5] = { -0.00273864253749621265032, 0.0013089921066773026803, 0.000775841526778089659703, 0.000110909476102006410909, 0.472577590124068298534e-5 };
- static const T d[6] = { 1, 0.650694792327863647878, 0.161126734432670927888, 0.0180081468446110640846, 0.000767341359508884026192, -0.287636719206664167616e-9 };
+ static const T n[5] = { -0.00273864253749621265032L, 0.0013089921066773026803L, 0.000775841526778089659703L, 0.000110909476102006410909L, 0.472577590124068298534e-5L };
+ static const T d[6] = { 1, 0.650694792327863647878L, 0.161126734432670927888L, 0.0180081468446110640846L, 0.000767341359508884026192L, -0.287636719206664167616e-9L };
static const float f0 = 0.5580308437F;
r = tools::evaluate_polynomial(n, z - 5.5) / tools::evaluate_polynomial(d, z - 5.5);
b = f0;
@@ -242,8 +268,8 @@
else if(z < 14)
{
// Worst case absolute error found: 1.458310511e-018
- static const T n[5] = { -0.000995856413171151859346, 0.000320252910249376187643, 0.000129085624923151780987, 0.121577881306587454509e-4, 0.33293110334156470348e-6 };
- static const T d[5] = { 1, 0.428034987547594828954, 0.0692297359775940896439, 0.00501515176145997560701, 0.00013733589151338416322 };
+ static const T n[5] = { -0.000995856413171151859346L, 0.000320252910249376187643L, 0.000129085624923151780987L, 0.121577881306587454509e-4L, 0.33293110334156470348e-6L };
+ static const T d[5] = { 1, 0.428034987547594828954L, 0.0692297359775940896439L, 0.00501515176145997560701L, 0.00013733589151338416322L };
static const float f0 = 0.5617653728F;
r = tools::evaluate_polynomial(n, z - 9) / tools::evaluate_polynomial(d, z - 9);
b = f0;
@@ -251,8 +277,8 @@
else if(z < 21)
{
// Worst case absolute error found: 1.08182873e-019
- static const T n[5] = { -0.000395463268432048215535, 0.91155953112698182321e-4, 0.237451641259281193813e-4, 0.145759953022524466816e-5, 0.259395907606548998142e-7 };
- static const T d[5] = { 1, 0.281604524251560309285, 0.0298468482900092392397, 0.00141114575715338885136, 0.251128951158576064819e-4 };
+ static const T n[5] = { -0.000395463268432048215535L, 0.91155953112698182321e-4L, 0.237451641259281193813e-4L, 0.145759953022524466816e-5L, 0.259395907606548998142e-7L };
+ static const T d[5] = { 1, 0.281604524251560309285L, 0.0298468482900092392397L, 0.00141114575715338885136L, 0.251128951158576064819e-4L };
static const float f0 = 0.5631566644F;
r = tools::evaluate_polynomial(n, z - 14) / tools::evaluate_polynomial(d, z - 14);
b = f0;
@@ -260,8 +286,8 @@
else
{
// Worst case absolute error found: 7.010370259e-018
- static const T n[4] = { -0.000139182098873874523526, 0.395254617101737287826e-4, 0.376801239136290345387e-5, 0.629017242098850415839e-7 };
- static const T d[4] = { 1, 0.15077096006891495258, 0.00756136203065884121997, 0.000126226197336507576933 };
+ static const T n[4] = { -0.000139182098873874523526L, 0.395254617101737287826e-4L, 0.376801239136290345387e-5L, 0.629017242098850415839e-7L };
+ static const T d[4] = { 1, 0.15077096006891495258L, 0.00756136203065884121997L, 0.000126226197336507576933L };
static const float f0 = 0.5636912584F;
r = tools::evaluate_polynomial(n, z - 21) / tools::evaluate_polynomial(d, z - 21);
b = f0;
@@ -287,19 +313,19 @@
} // template <class T, class L>T erf_imp(T z, bool invert, const L& l, const mpl::int_<53>& t)
-template <class T, class L>
-T erf_imp(T z, bool invert, const L& l, const mpl::int_<64>& t)
+template <class T, class Policy>
+T erf_imp(T z, bool invert, const Policy& pol, const mpl::int_<64>& t)
{
using namespace std;
if(z < 0)
{
if(!invert)
- return -erf_imp(-z, invert, l, t);
+ return -erf_imp(-z, invert, pol, t);
else if(z < -0.5)
- return 2 - erf_imp(-z, invert, l, t);
+ return 2 - erf_imp(-z, invert, pol, t);
else
- return 1 + erf_imp(-z, false, l, t);
+ return 1 + erf_imp(-z, false, pol, t);
}
T result;
@@ -475,19 +501,19 @@
} // template <class T, class L>T erf_imp(T z, bool invert, const L& l, const mpl::int_<64>& t)
-template <class T, class L>
-T erf_imp(T z, bool invert, const L& l, const mpl::int_<113>& t)
+template <class T, class Policy>
+T erf_imp(T z, bool invert, const Policy& pol, const mpl::int_<113>& t)
{
using namespace std;
if(z < 0)
{
if(!invert)
- return -erf_imp(-z, invert, l, t);
+ return -erf_imp(-z, invert, pol, t);
else if(z < -0.5)
- return 2 - erf_imp(-z, invert, l, t);
+ return 2 - erf_imp(-z, invert, pol, t);
else
- return 1 + erf_imp(-z, false, l, t);
+ return 1 + erf_imp(-z, false, pol, t);
}
T result;
@@ -710,24 +736,24 @@
} // namespace detail
-template <class T>
-inline typename tools::promote_args<T>::type erf(T z)
+template <class T, class Policy>
+inline typename tools::promote_args<T>::type erf(T z, const Policy& pol)
{
typedef typename tools::promote_args<T>::type result_type;
- typedef typename lanczos::lanczos_traits<result_type>::value_type value_type;
- typedef typename lanczos::lanczos_traits<result_type>::evaluation_type evaluation_type;
+ typedef typename policy::evaluation<result_type, Policy>::type value_type;
+ typedef typename policy::precision<result_type, Policy>::type precision_type;
- typedef typename mpl::if_c<
- ::std::numeric_limits<result_type>::is_specialized == 0,
- mpl::int_<0>, // no numeric_limits, use generic solution
- typename mpl::if_c<
- ::std::numeric_limits<result_type>::digits <= 53,
+ typedef typename mpl::if_<
+ mpl::less_equal<precision_type, mpl::int_<0> >,
+ mpl::int_<0>,
+ typename mpl::if_<
+ mpl::less_equal<precision_type, mpl::int_<53> >,
mpl::int_<53>, // double
- typename mpl::if_c<
- ::std::numeric_limits<result_type>::digits <= 64,
+ typename mpl::if_<
+ mpl::less_equal<precision_type, mpl::int_<64> >,
mpl::int_<64>, // 80-bit long double
- typename mpl::if_c<
- ::std::numeric_limits<result_type>::digits <= 113,
+ typename mpl::if_<
+ mpl::less_equal<precision_type, mpl::int_<113> >,
mpl::int_<113>, // 128-bit long double
mpl::int_<0> // too many bits, use generic version.
>::type
@@ -738,28 +764,28 @@
return tools::checked_narrowing_cast<result_type>(detail::erf_imp(
static_cast<value_type>(z),
false,
- evaluation_type(),
- tag_type()), BOOST_CURRENT_FUNCTION);
+ pol,
+ tag_type()), "boost::math::erf<%1%>(%1%, %1%)");
}
-template <class T>
-inline typename tools::promote_args<T>::type erfc(T z)
+template <class T, class Policy>
+inline typename tools::promote_args<T>::type erfc(T z, const Policy& pol)
{
typedef typename tools::promote_args<T>::type result_type;
- typedef typename lanczos::lanczos_traits<result_type>::value_type value_type;
- typedef typename lanczos::lanczos_traits<result_type>::evaluation_type evaluation_type;
+ typedef typename policy::evaluation<result_type, Policy>::type value_type;
+ typedef typename policy::precision<result_type, Policy>::type precision_type;
- typedef typename mpl::if_c<
- ::std::numeric_limits<result_type>::is_specialized == 0,
- mpl::int_<0>, // no numeric_limits, use generic solution
- typename mpl::if_c<
- ::std::numeric_limits<result_type>::digits <= 53,
+ typedef typename mpl::if_<
+ mpl::less_equal<precision_type, mpl::int_<0> >,
+ mpl::int_<0>,
+ typename mpl::if_<
+ mpl::less_equal<precision_type, mpl::int_<53> >,
mpl::int_<53>, // double
- typename mpl::if_c<
- ::std::numeric_limits<result_type>::digits <= 64,
+ typename mpl::if_<
+ mpl::less_equal<precision_type, mpl::int_<64> >,
mpl::int_<64>, // 80-bit long double
- typename mpl::if_c<
- ::std::numeric_limits<result_type>::digits <= 113,
+ typename mpl::if_<
+ mpl::less_equal<precision_type, mpl::int_<113> >,
mpl::int_<113>, // 128-bit long double
mpl::int_<0> // too many bits, use generic version.
>::type
@@ -770,15 +796,20 @@
return tools::checked_narrowing_cast<result_type>(detail::erf_imp(
static_cast<value_type>(z),
true,
- evaluation_type(),
- tag_type()), BOOST_CURRENT_FUNCTION);
+ pol,
+ tag_type()), "boost::math::erfc<%1%>(%1%, %1%)");
}
-template <class T, class Policy>
-inline typename tools::promote_args<T>::type erfc(T z, const Policy& pol)
+template <class T>
+inline typename tools::promote_args<T>::type erf(T z)
+{
+ return boost::math::erf(z, policy::policy<>());
+}
+
+template <class T>
+inline typename tools::promote_args<T>::type erfc(T z)
{
- // Temporary Hack:
- return erfc(z);
+ return boost::math::erfc(z, policy::policy<>());
}
} // namespace math
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-06-21 12:21:16 EDT (Thu, 21 Jun 2007)
@@ -19,6 +19,7 @@
#include <boost/throw_exception.hpp>
#include <boost/math/special_functions/sign.hpp>
#include <boost/math/tools/toms748_solve.hpp>
+#include <boost/math/policy/error_handling.hpp>
#include <utility>
@@ -82,8 +83,8 @@
} // namespace
-template <class F, class T, class Tol>
-std::pair<T, T> bisect(F f, T min, T max, Tol tol, boost::uintmax_t& max_iter)
+template <class F, class T, class Tol, class Policy>
+std::pair<T, T> bisect(F f, T min, T max, Tol tol, boost::uintmax_t& max_iter, const Policy& pol)
{
T fmin = f(min);
T fmax = f(max);
@@ -97,13 +98,13 @@
//
if(min >= max)
{
- tools::logic_error(BOOST_CURRENT_FUNCTION,
- "Arguments in wrong order in boost::math::tools::bisect (first arg=%1%)", min);
+ policy::raise_evaluation_error(BOOST_CURRENT_FUNCTION,
+ "Arguments in wrong order in boost::math::tools::bisect (first arg=%1%)", min, pol);
}
if(fmin * fmax >= 0)
{
- tools::logic_error(BOOST_CURRENT_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);
+ policy::raise_evaluation_error(BOOST_CURRENT_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);
}
//
@@ -156,10 +157,16 @@
}
template <class F, class T, class Tol>
+inline std::pair<T, T> bisect(F f, T min, T max, Tol tol, boost::uintmax_t& max_iter)
+{
+ return bisect(f, min, max, tol, max_iter, policy::policy<>());
+}
+
+template <class F, class T, class Tol>
inline std::pair<T, T> bisect(F f, T min, T max, Tol tol)
{
boost::uintmax_t m = (std::numeric_limits<boost::uintmax_t>::max)();
- return bisect(f, min, max, tol, m);
+ return bisect(f, min, max, tol, m, policy::policy<>());
}
template <class F, class T>
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-06-21 12:21:16 EDT (Thu, 21 Jun 2007)
@@ -253,8 +253,8 @@
} // namespace detail
-template <class F, class T, class Tol>
-std::pair<T, T> toms748_solve(F f, const T& ax, const T& bx, const T& fax, const T& fbx, Tol tol, boost::uintmax_t& max_iter)
+template <class F, class T, class Tol, class Policy>
+std::pair<T, T> toms748_solve(F f, const T& ax, const T& bx, const T& fax, const T& fbx, Tol tol, boost::uintmax_t& max_iter, const Policy& pol)
{
//
// Main entry point and logic for Toms Algorithm 748
@@ -270,15 +270,15 @@
a = ax;
b = bx;
if(a >= b)
- tools::domain_error(
+ policy::raise_domain_error(
BOOST_CURRENT_FUNCTION,
- "Parameters a and b out of order: a=%1%", a);
+ "Parameters a and b out of order: a=%1%", a, pol);
fa = fax;
fb = fbx;
if(boost::math::sign(fa) * boost::math::sign(fb) > 0)
- tools::domain_error(
+ policy::raise_domain_error(
BOOST_CURRENT_FUNCTION,
- "Parameters a and b do not bracket the root: a=%1%", a);
+ "Parameters a and b do not bracket the root: a=%1%", a, pol);
// dummy value for fd, e and fe:
fe = e = fd = 1e5F;
@@ -415,16 +415,28 @@
}
template <class F, class T, class Tol>
-inline std::pair<T, T> toms748_solve(F f, const T& ax, const T& bx, Tol tol, boost::uintmax_t& max_iter)
+inline std::pair<T, T> toms748_solve(F f, const T& ax, const T& bx, const T& fax, const T& fbx, Tol tol, boost::uintmax_t& max_iter)
+{
+ return toms748_solve(f, ax, bx, fax, fbx, tol, max_iter, policy::policy<>());
+}
+
+template <class F, class T, class Tol, class Policy>
+inline std::pair<T, T> toms748_solve(F f, const T& ax, const T& bx, Tol tol, boost::uintmax_t& max_iter, const Policy& pol)
{
max_iter -= 2;
- std::pair<T, T> r = toms748_solve(f, ax, bx, f(ax), f(bx), tol, max_iter);
+ std::pair<T, T> r = toms748_solve(f, ax, bx, f(ax), f(bx), tol, max_iter, pol);
max_iter += 2;
return r;
}
template <class F, class T, class Tol>
-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)
+inline std::pair<T, T> toms748_solve(F f, const T& ax, const T& bx, Tol tol, boost::uintmax_t& max_iter)
+{
+ return toms748_solve(f, ax, bx, tol, max_iter, policy::policy<>());
+}
+
+template <class F, class T, class Tol, class Policy>
+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;
//
@@ -448,7 +460,7 @@
while(sign(fb) == sign(fa))
{
if(count == 0)
- tools::logic_error(BOOST_CURRENT_FUNCTION, "Unable to bracket root, last nearest value was %1%", b);
+ policy::raise_evaluation_error(BOOST_CURRENT_FUNCTION, "Unable to bracket root, last nearest value was %1%", b, pol);
a = b;
fa = fb;
b *= factor;
@@ -473,7 +485,7 @@
return a > 0 ? std::make_pair(T(0), T(a)) : std::make_pair(T(a), T(0));
}
if(count == 0)
- tools::logic_error(BOOST_CURRENT_FUNCTION, "Unable to bracket root, last nearest value was %1%", a);
+ policy::raise_evaluation_error(BOOST_CURRENT_FUNCTION, "Unable to bracket root, last nearest value was %1%", a, pol);
b = a;
fb = fa;
a /= factor;
@@ -484,12 +496,18 @@
}
max_iter -= count;
max_iter += 1;
- std::pair<T, T> r = toms748_solve(f, a, b, fa, fb, tol, count);
+ std::pair<T, T> r = toms748_solve(f, a, b, fa, fb, tol, count, pol);
max_iter += count;
BOOST_MATH_INSTRUMENT_CODE("max_iter = " << max_iter << " count = " << count);
return r;
}
+template <class F, class T, class Tol>
+inline 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)
+{
+ return bracket_and_solve_root(f, guess, factor, rising, tol, max_iter, policy::policy<>());
+}
+
} // namespace tools
} // namespace math
} // namespace boost
Modified: sandbox/math_toolkit/policy/libs/math/performance/main.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/performance/main.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/performance/main.cpp 2007-06-21 12:21:16 EDT (Thu, 21 Jun 2007)
@@ -100,6 +100,7 @@
if(!found)
{
std::cerr << "Unknown option: " << argv[i] << std::endl;
+ show_help();
return 1;
}
}
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-06-21 12:21:16 EDT (Thu, 21 Jun 2007)
@@ -7,6 +7,7 @@
<toolset>gcc:<cxxflags>-Wno-missing-braces
<toolset>darwin:<cxxflags>-Wno-missing-braces
<toolset>acc:<cxxflags>+W2068,2461,2236,4070
+ <toolset>intel:<cxxflags>-Qwd264,239
<include>../../..
<source>/boost/regex//boost_regex
<link>shared:<define>BOOST_REGEX_DYN_LINK=1
@@ -159,3 +160,4 @@
+
Modified: sandbox/math_toolkit/policy/libs/math/test/test_erf.cpp
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/test_erf.cpp (original)
+++ sandbox/math_toolkit/policy/libs/math/test/test_erf.cpp 2007-06-21 12:21:16 EDT (Thu, 21 Jun 2007)
@@ -10,8 +10,10 @@
#include <boost/math/constants/constants.hpp>
#include <boost/type_traits/is_floating_point.hpp>
#include <boost/array.hpp>
+#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
+#endif
#include "test_erf_hooks.hpp"
#include "handle_test_result.hpp"
@@ -98,6 +100,7 @@
template <class T>
void do_test_erf(const T& data, const char* type_name, const char* test_name)
{
+#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
typedef typename T::value_type row_type;
typedef typename row_type::value_type value_type;
@@ -151,11 +154,13 @@
}
#endif
std::cout << std::endl;
+#endif
}
template <class T>
void do_test_erf_inv(const T& data, const char* type_name, const char* test_name)
{
+#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
typedef typename T::value_type row_type;
typedef typename row_type::value_type value_type;
@@ -176,11 +181,13 @@
boost::lambda::ret<value_type>(boost::lambda::_1[1]));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::erf_inv", test_name);
std::cout << std::endl;
+#endif
}
template <class T>
void do_test_erfc_inv(const T& data, const char* type_name, const char* test_name)
{
+#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
typedef typename T::value_type row_type;
typedef typename row_type::value_type value_type;
@@ -201,6 +208,7 @@
boost::lambda::ret<value_type>(boost::lambda::_1[1]));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::erfc_inv", test_name);
std::cout << std::endl;
+#endif
}
template <class T>
@@ -291,8 +299,10 @@
test_spots(0.0, "double");
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
test_spots(0.0L, "long double");
+#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
test_spots(boost::math::concepts::real_concept(0.1), "real_concept");
#endif
+#endif
expected_results();
@@ -301,8 +311,10 @@
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
test_erf(0.1L, "long double");
#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
+#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
test_erf(boost::math::concepts::real_concept(0.1), "real_concept");
#endif
+#endif
#else
std::cout << "<note>The long double tests have been disabled on this platform "
"either because the long double overloads of the usual math functions are "
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