|
Boost-Commit : |
From: john_at_[hidden]
Date: 2007-10-13 12:23:21
Author: johnmaddock
Date: 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
New Revision: 39971
URL: http://svn.boost.org/trac/boost/changeset/39971
Log:
Fixed most of the remaining Borland issues, and removed dependency to Boost.Lambda.
Added tentative fix for the Sunpro compilers.
Text files modified:
trunk/boost/math/bindings/rr.hpp | 16 ++++----
trunk/boost/math/concepts/real_concept.hpp | 19 +++++++----
trunk/boost/math/concepts/std_real_concept.hpp | 12 +++---
trunk/boost/math/constants/constants.hpp | 10 +++---
trunk/boost/math/policies/policy.hpp | 2
trunk/boost/math/special_functions/detail/ibeta_inverse.hpp | 8 +++-
trunk/boost/math/special_functions/detail/unchecked_factorial.hpp | 13 +++----
trunk/boost/math/special_functions/legendre.hpp | 16 ++++----
trunk/boost/math/special_functions/log1p.hpp | 2
trunk/boost/math/special_functions/math_fwd.hpp | 2
trunk/boost/math/tools/config.hpp | 37 ++++++++++++++++++++++
trunk/boost/math/tools/precision.hpp | 34 ++++++++++----------
trunk/libs/math/test/functor.hpp | 51 +++++++++++++++++++++++++++++++
trunk/libs/math/test/test_cbrt.cpp | 13 +++++++
trunk/libs/math/test/test_chi_squared.cpp | 3 +
trunk/libs/math/test/test_classify.cpp | 1
trunk/libs/math/test/test_digamma.cpp | 13 ++-----
trunk/libs/math/test/test_ellint_1.cpp | 17 ++++------
trunk/libs/math/test/test_ellint_2.cpp | 15 +++-----
trunk/libs/math/test/test_ellint_3.cpp | 17 +++------
trunk/libs/math/test/test_erf.cpp | 42 ++++++++-----------------
trunk/libs/math/test/test_factorials.cpp | 1
trunk/libs/math/test/test_gamma.cpp | 30 +++++++-----------
trunk/libs/math/test/test_hermite.cpp | 21 ++++--------
trunk/libs/math/test/test_ibeta.cpp | 47 ++++++++--------------------
trunk/libs/math/test/test_ibeta_inv.cpp | 18 +++-------
trunk/libs/math/test/test_ibeta_inv_ab.cpp | 25 +++++---------
trunk/libs/math/test/test_igamma.cpp | 34 ++++++++------------
trunk/libs/math/test/test_igamma_inv.cpp | 18 +++-------
trunk/libs/math/test/test_igamma_inva.cpp | 18 +++-------
trunk/libs/math/test/test_laguerre.cpp | 39 ++++-------------------
trunk/libs/math/test/test_legendre.cpp | 65 +++++++--------------------------------
trunk/libs/math/test/test_spherical_harmonic.cpp | 38 +++-------------------
trunk/libs/math/test/test_tgamma_ratio.cpp | 35 ++++++++++-----------
34 files changed, 327 insertions(+), 405 deletions(-)
Modified: trunk/boost/math/bindings/rr.hpp
==============================================================================
--- trunk/boost/math/bindings/rr.hpp (original)
+++ trunk/boost/math/bindings/rr.hpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -425,7 +425,7 @@
{
template<>
-inline int digits<boost::math::ntl::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
+inline int digits<boost::math::ntl::RR>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
{
return ::NTL::RR::precision();
}
@@ -493,7 +493,7 @@
}
template <>
-inline boost::math::ntl::RR max_value<boost::math::ntl::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
+inline boost::math::ntl::RR max_value<boost::math::ntl::RR>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
{
static bool has_init = false;
static NTL::RR val;
@@ -507,7 +507,7 @@
}
template <>
-inline boost::math::ntl::RR min_value<boost::math::ntl::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
+inline boost::math::ntl::RR min_value<boost::math::ntl::RR>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
{
static bool has_init = false;
static NTL::RR val;
@@ -521,7 +521,7 @@
}
template <>
-inline boost::math::ntl::RR log_max_value<boost::math::ntl::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
+inline boost::math::ntl::RR log_max_value<boost::math::ntl::RR>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
{
static bool has_init = false;
static NTL::RR val;
@@ -536,7 +536,7 @@
}
template <>
-inline boost::math::ntl::RR log_min_value<boost::math::ntl::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
+inline boost::math::ntl::RR log_min_value<boost::math::ntl::RR>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
{
static bool has_init = false;
static NTL::RR val;
@@ -551,7 +551,7 @@
}
template <>
-inline boost::math::ntl::RR epsilon<boost::math::ntl::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
+inline boost::math::ntl::RR epsilon<boost::math::ntl::RR>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
{
return ldexp(boost::math::ntl::RR(1), 1-boost::math::policies::digits<boost::math::ntl::RR, boost::math::policies::policy<> >());
}
@@ -564,13 +564,13 @@
//
namespace constants{
-template<> inline boost::math::ntl::RR pi<boost::math::ntl::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
+template<> inline boost::math::ntl::RR pi<boost::math::ntl::RR>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
{
NTL::RR result;
ComputePi(result);
return result;
}
-template<> inline boost::math::ntl::RR e<boost::math::ntl::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
+template<> inline boost::math::ntl::RR e<boost::math::ntl::RR>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
{
NTL::RR result;
result = 1;
Modified: trunk/boost/math/concepts/real_concept.hpp
==============================================================================
--- trunk/boost/math/concepts/real_concept.hpp (original)
+++ trunk/boost/math/concepts/real_concept.hpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -55,7 +55,7 @@
real_concept(int c) : m_value(c){}
real_concept(unsigned long c) : m_value(c){}
real_concept(long c) : m_value(c){}
-#if defined(BOOST_HAS_LONG_LONG) || defined(__DECCXX)
+#if defined(BOOST_HAS_LONG_LONG) || defined(__DECCXX) || defined(__SUNPRO_CC)
real_concept(unsigned long long c) : m_value(static_cast<long double>(c)){}
real_concept(long long c) : m_value(static_cast<long double>(c)){}
#elif defined(BOOST_HAS_MS_INT64)
@@ -226,8 +226,13 @@
{ return std::tan(a.value()); }
inline real_concept pow(real_concept a, real_concept b)
{ return std::pow(a.value(), b.value()); }
+#if !defined(__SUNPRO_CC)
inline real_concept pow(real_concept a, int b)
{ return std::pow(a.value(), b); }
+#else
+inline real_concept pow(real_concept a, int b)
+{ return std::pow(a.value(), static_cast<long double>(b)); }
+#endif
inline real_concept sin(real_concept a)
{ return std::sin(a.value()); }
inline real_concept sinh(real_concept a)
@@ -305,31 +310,31 @@
}
template <>
-inline concepts::real_concept max_value<concepts::real_concept>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
+inline concepts::real_concept max_value<concepts::real_concept>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
{
return max_value<long double>();
}
template <>
-inline concepts::real_concept min_value<concepts::real_concept>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
+inline concepts::real_concept min_value<concepts::real_concept>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
{
return min_value<long double>();
}
template <>
-inline concepts::real_concept log_max_value<concepts::real_concept>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
+inline concepts::real_concept log_max_value<concepts::real_concept>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
{
return log_max_value<long double>();
}
template <>
-inline concepts::real_concept log_min_value<concepts::real_concept>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
+inline concepts::real_concept log_min_value<concepts::real_concept>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
{
return log_min_value<long double>();
}
template <>
-inline concepts::real_concept epsilon(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
+inline concepts::real_concept epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
{
#ifdef __SUNPRO_CC
return std::numeric_limits<long double>::epsilon();
@@ -339,7 +344,7 @@
}
template <>
-inline int digits<concepts::real_concept>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
+inline int digits<concepts::real_concept>(BOOST_MATH_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.
Modified: trunk/boost/math/concepts/std_real_concept.hpp
==============================================================================
--- trunk/boost/math/concepts/std_real_concept.hpp (original)
+++ trunk/boost/math/concepts/std_real_concept.hpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -300,37 +300,37 @@
}
template <>
-inline concepts::std_real_concept max_value<concepts::std_real_concept>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
+inline concepts::std_real_concept max_value<concepts::std_real_concept>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
{
return max_value<long double>();
}
template <>
-inline concepts::std_real_concept min_value<concepts::std_real_concept>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
+inline concepts::std_real_concept min_value<concepts::std_real_concept>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
{
return min_value<long double>();
}
template <>
-inline concepts::std_real_concept log_max_value<concepts::std_real_concept>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
+inline concepts::std_real_concept log_max_value<concepts::std_real_concept>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
{
return log_max_value<long double>();
}
template <>
-inline concepts::std_real_concept log_min_value<concepts::std_real_concept>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
+inline concepts::std_real_concept log_min_value<concepts::std_real_concept>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
{
return log_min_value<long double>();
}
template <>
-inline concepts::std_real_concept epsilon(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
+inline concepts::std_real_concept epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
{
return tools::epsilon<long double>();
}
template <>
-inline int digits<concepts::std_real_concept>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
+inline int digits<concepts::std_real_concept>(BOOST_MATH_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 digits<long double>();
Modified: trunk/boost/math/constants/constants.hpp
==============================================================================
--- trunk/boost/math/constants/constants.hpp (original)
+++ trunk/boost/math/constants/constants.hpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -7,7 +7,7 @@
#ifndef BOOST_MATH_CONSTANTS_CONSTANTS_INCLUDED
#define BOOST_MATH_CONSTANTS_CONSTANTS_INCLUDED
-#include <boost/config.hpp>
+#include <boost/math/tools/config.hpp>
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable: 4127 4701)
@@ -37,16 +37,16 @@
#define BOOST_DEFINE_MATH_CONSTANT(name, x, y, exp)\
- template <class T> inline T name(BOOST_EXPLICIT_TEMPLATE_TYPE(T))\
+ template <class T> inline T name(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T))\
{\
static const T result = ::boost::lexical_cast<T>(BOOST_STRINGIZE(BOOST_JOIN(BOOST_JOIN(x, y), BOOST_JOIN(e, exp))));\
return result;\
}\
- template <> inline float name<float>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(float))\
+ template <> inline float name<float>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(float))\
{ return BOOST_JOIN(BOOST_JOIN(x, BOOST_JOIN(e, exp)), F); }\
- template <> inline double name<double>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(double))\
+ template <> inline double name<double>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(double))\
{ return BOOST_JOIN(x, BOOST_JOIN(e, exp)); }\
- template <> inline long double name<long double>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(long double))\
+ template <> inline long double name<long double>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(long double))\
{ return BOOST_JOIN(BOOST_JOIN(x, BOOST_JOIN(e, exp)), L); }
BOOST_DEFINE_MATH_CONSTANT(pi, 3.141592653589793238462643383279502884197169399375105820974944, 59230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196, 0)
Modified: trunk/boost/math/policies/policy.hpp
==============================================================================
--- trunk/boost/math/policies/policy.hpp (original)
+++ trunk/boost/math/policies/policy.hpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -35,7 +35,7 @@
namespace tools{
template <class T>
-int digits(BOOST_EXPLICIT_TEMPLATE_TYPE(T));
+int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T));
}
Modified: trunk/boost/math/special_functions/detail/ibeta_inverse.hpp
==============================================================================
--- trunk/boost/math/special_functions/detail/ibeta_inverse.hpp (original)
+++ trunk/boost/math/special_functions/detail/ibeta_inverse.hpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -913,14 +913,16 @@
inline typename tools::promote_args<RT1, RT2, RT3>::type
ibetac_inv(RT1 a, RT2 b, RT3 q)
{
- return ibetac_inv(a, b, q, static_cast<RT1*>(0), policies::policy<>());
+ typedef typename remove_cv<RT1>::type dummy;
+ return ibetac_inv(a, b, q, static_cast<dummy*>(0), policies::policy<>());
}
template <class RT1, class RT2, class RT3, class Policy>
-inline typename tools::promote_args<RT1, RT2, RT3>::type
+inline typename tools::promote_args<RT1, RT2, RT3>::type
ibetac_inv(RT1 a, RT2 b, RT3 q, const Policy& pol)
{
- return ibetac_inv(a, b, q, static_cast<RT1*>(0), pol);
+ typedef typename remove_cv<RT1>::type dummy;
+ return ibetac_inv(a, b, q, static_cast<dummy*>(0), pol);
}
} // namespace math
Modified: trunk/boost/math/special_functions/detail/unchecked_factorial.hpp
==============================================================================
--- trunk/boost/math/special_functions/detail/unchecked_factorial.hpp (original)
+++ trunk/boost/math/special_functions/detail/unchecked_factorial.hpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -16,18 +16,17 @@
#pragma warning(pop)
#endif
#include <cmath>
+#include <boost/math/special_functions/math_fwd.hpp>
namespace boost { namespace math
{
// Forward declarations:
template <class T>
-T unchecked_factorial(unsigned i);
-template <class T>
struct max_factorial;
// efinitions:
template <>
-inline float unchecked_factorial<float>(unsigned i)
+inline float unchecked_factorial<float>(unsigned i BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(float))
{
static const boost::array<float, 35> factorials = {{
1.0F,
@@ -78,7 +77,7 @@
template <>
-inline long double unchecked_factorial<long double>(unsigned i)
+inline long double unchecked_factorial<long double>(unsigned i BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(long double))
{
static const boost::array<long double, 171> factorials = {{
1L,
@@ -264,9 +263,9 @@
};
template <>
-inline double unchecked_factorial(unsigned i)
+inline double unchecked_factorial(unsigned i BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(double))
{
- return static_cast<double>(unchecked_factorial<long double>(i));
+ return static_cast<double>(boost::math::unchecked_factorial<long double>(i));
}
template <>
@@ -277,7 +276,7 @@
};
template <class T>
-inline T unchecked_factorial(unsigned i)
+inline T unchecked_factorial(unsigned i BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(T))
{
static const boost::array<T, 101> factorials = {{
boost::lexical_cast<T>("1"),
Modified: trunk/boost/math/special_functions/legendre.hpp
==============================================================================
--- trunk/boost/math/special_functions/legendre.hpp (original)
+++ trunk/boost/math/special_functions/legendre.hpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -16,7 +16,7 @@
// Recurrance relation for legendre P and Q polynomials:
template <class T1, class T2, class T3>
-inline typename tools::promote_args<T1, T2, T3>::type
+inline typename tools::promote_args<T1, T2, T3>::type
legendre_next(unsigned l, T1 x, T2 Pl, T3 Plm1)
{
typedef typename tools::promote_args<T1, T2, T3>::type result_type;
@@ -58,7 +58,7 @@
while(n < l)
{
std::swap(p0, p1);
- p1 = legendre_next(n, x, p0, p1);
+ p1 = boost::math::legendre_next(n, x, p0, p1);
++n;
}
return p1;
@@ -127,16 +127,16 @@
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), pol) * legendre_p_imp(l, -m, x, sin_theta_power, pol);
+ return sign * boost::math::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, pol);
+ return boost::math::legendre_p(l, x, pol);
T p0 = boost::math::double_factorial<T>(2 * m - 1, pol) * sin_theta_power;
-
+
if(m&1)
p0 *= -1;
if(m == l)
@@ -149,7 +149,7 @@
while(n < l)
{
std::swap(p0, p1);
- p1 = legendre_next(n, m, x, p0, p1);
+ p1 = boost::math::legendre_next(n, m, x, p0, p1);
++n;
}
return p1;
@@ -166,7 +166,7 @@
}
template <class T, class Policy>
-inline typename tools::promote_args<T>::type
+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;
@@ -175,7 +175,7 @@
}
template <class T>
-inline typename tools::promote_args<T>::type
+inline typename tools::promote_args<T>::type
legendre_p(int l, int m, T x)
{
return boost::math::legendre_p(l, m, x, policies::policy<>());
Modified: trunk/boost/math/special_functions/log1p.hpp
==============================================================================
--- trunk/boost/math/special_functions/log1p.hpp (original)
+++ trunk/boost/math/special_functions/log1p.hpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -127,7 +127,7 @@
#ifdef BOOST_HAS_LOG1P
# if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)) \
- || defined(linux) || defined(__linux) || defined(__linux__) \
+ || ((defined(linux) || defined(__linux) || defined(__linux__)) && !defined(__SUNPRO_CC)) \
|| (defined(__hpux) && !defined(_PA_RISC1_1))
template <class Policy>
inline float log1p(float x, const Policy& pol)
Modified: trunk/boost/math/special_functions/math_fwd.hpp
==============================================================================
--- trunk/boost/math/special_functions/math_fwd.hpp (original)
+++ trunk/boost/math/special_functions/math_fwd.hpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -329,7 +329,7 @@
template <class RT, class Policy>
RT factorial(unsigned int, const Policy& pol);
template <class RT>
- RT unchecked_factorial(unsigned int);
+ RT unchecked_factorial(unsigned int BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(RT));
template <class RT>
RT double_factorial(unsigned i);
template <class RT, class Policy>
Modified: trunk/boost/math/tools/config.hpp
==============================================================================
--- trunk/boost/math/tools/config.hpp (original)
+++ trunk/boost/math/tools/config.hpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -40,6 +40,43 @@
# define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
#endif
+#if defined(BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS) || BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590)
+
+# include "boost/type.hpp"
+# include "boost/non_type.hpp"
+
+# define BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(t) boost::type<t>* = 0
+# define BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(t) boost::type<t>*
+# define BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE(t, v) boost::non_type<t, v>* = 0
+# define BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) boost::non_type<t, v>*
+
+# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(t) \
+ , BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(t)
+# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t) \
+ , BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(t)
+# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v) \
+ , BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
+# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) \
+ , BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)
+
+#else
+
+// no workaround needed: expand to nothing
+
+# define BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(t)
+# define BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(t)
+# define BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
+# define BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)
+
+# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(t)
+# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t)
+# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
+# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)
+
+
+#endif // defined BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
+
+
#if BOOST_WORKAROUND(BOOST_MSVC, < 1400)
//
// Define if constants too large for a float cause "bad"
Modified: trunk/boost/math/tools/precision.hpp
==============================================================================
--- trunk/boost/math/tools/precision.hpp (original)
+++ trunk/boost/math/tools/precision.hpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -37,7 +37,7 @@
// See Conceptual Requirements for Real Number Types.
template <class T>
-inline int digits(BOOST_EXPLICIT_TEMPLATE_TYPE(T))
+inline int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T))
{
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
BOOST_STATIC_ASSERT( ::std::numeric_limits<T>::is_specialized);
@@ -48,7 +48,7 @@
}
template <class T>
-inline T max_value(BOOST_EXPLICIT_TEMPLATE_TYPE(T))
+inline T max_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T))
{
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
BOOST_STATIC_ASSERT( ::std::numeric_limits<T>::is_specialized);
@@ -60,7 +60,7 @@
// -max_value<double> = -1.79769e+308, max_value<double> = 1.79769e+308.
template <class T>
-inline T min_value(BOOST_EXPLICIT_TEMPLATE_TYPE(T))
+inline T min_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T))
{
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
BOOST_STATIC_ASSERT( ::std::numeric_limits<T>::is_specialized);
@@ -80,13 +80,13 @@
// For type float first:
//
template <class T>
-inline T log_max_value(const mpl::int_<128>& BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
+inline T log_max_value(const mpl::int_<128>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
{
return 88.0f;
}
template <class T>
-inline T log_min_value(const mpl::int_<128>& BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
+inline T log_min_value(const mpl::int_<128>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
{
return -87.0f;
}
@@ -94,13 +94,13 @@
// Now double:
//
template <class T>
-inline T log_max_value(const mpl::int_<1024>& BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
+inline T log_max_value(const mpl::int_<1024>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
{
return 709.0;
}
template <class T>
-inline T log_min_value(const mpl::int_<1024>& BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
+inline T log_min_value(const mpl::int_<1024>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
{
return -708.0;
}
@@ -108,19 +108,19 @@
// 80 and 128-bit long doubles:
//
template <class T>
-inline T log_max_value(const mpl::int_<16384>& BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
+inline T log_max_value(const mpl::int_<16384>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
{
return 11356.0L;
}
template <class T>
-inline T log_min_value(const mpl::int_<16384>& BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
+inline T log_min_value(const mpl::int_<16384>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
{
return -11355.0L;
}
template <class T>
-inline T log_max_value(const mpl::int_<0>& BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
+inline T log_max_value(const mpl::int_<0>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
{
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
BOOST_STATIC_ASSERT( ::std::numeric_limits<T>::is_specialized);
@@ -133,7 +133,7 @@
}
template <class T>
-inline T log_min_value(const mpl::int_<0>& BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
+inline T log_min_value(const mpl::int_<0>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
{
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
BOOST_STATIC_ASSERT( ::std::numeric_limits<T>::is_specialized);
@@ -146,14 +146,14 @@
}
template <class T>
-inline T epsilon(const mpl::true_& BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
+inline T epsilon(const mpl::true_& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
{
return std::numeric_limits<T>::epsilon();
}
#if (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) && ((LDBL_MANT_DIG == 106) || (__LDBL_MANT_DIG__ == 106))
template <>
-inline long double epsilon<long double>(const mpl::true_& BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(long double))
+inline long double epsilon<long double>(const mpl::true_& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(long double))
{
// numeric_limits on Darwin tells lies here.
// This static assert fails for some unknown reason, so
@@ -164,7 +164,7 @@
#endif
template <class T>
-inline T epsilon(const mpl::false_& BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
+inline T epsilon(const mpl::false_& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
{
BOOST_MATH_STD_USING // for ADL of std names
static const T eps = ldexp(static_cast<T>(1), 1-policies::digits<T, policies::policy<> >());
@@ -174,7 +174,7 @@
} // namespace detail
template <class T>
-inline T log_max_value(BOOST_EXPLICIT_TEMPLATE_TYPE(T))
+inline T log_max_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T))
{
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
typedef typename mpl::if_c<
@@ -195,7 +195,7 @@
}
template <class T>
-inline T log_min_value(BOOST_EXPLICIT_TEMPLATE_TYPE(T))
+inline T log_min_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T))
{
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
typedef typename mpl::if_c<
@@ -217,7 +217,7 @@
}
template <class T>
-inline T epsilon(BOOST_EXPLICIT_TEMPLATE_TYPE(T))
+inline T epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T))
{
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
return detail::epsilon<T>(mpl::bool_< ::std::numeric_limits<T>::is_specialized>());
Modified: trunk/libs/math/test/functor.hpp
==============================================================================
--- trunk/libs/math/test/functor.hpp (original)
+++ trunk/libs/math/test/functor.hpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -131,6 +131,57 @@
}
template <class F>
+struct row_binder3_i2
+{
+ row_binder3_i2(F _f, unsigned i, unsigned j, unsigned k) : f(_f), m_i(i), m_j(j), m_k(k) {}
+
+ template <class S>
+ typename S::value_type operator()(const S& row)
+ {
+ return f(
+ boost::math::tools::real_cast<int>(row[m_i]),
+ boost::math::tools::real_cast<int>(row[m_j]),
+ row[m_k]);
+ }
+
+private:
+ F f;
+ unsigned m_i, m_j, m_k;
+};
+
+template<class F>
+inline row_binder3_i2<F> bind_func_int2(F f, unsigned i, unsigned j, unsigned k)
+{
+ return row_binder3_i2<F>(f, i, j, k);
+}
+
+template <class F>
+struct row_binder4_i2
+{
+ row_binder4_i2(F _f, unsigned i, unsigned j, unsigned k, unsigned l) : f(_f), m_i(i), m_j(j), m_k(k), m_l(l) {}
+
+ template <class S>
+ typename S::value_type operator()(const S& row)
+ {
+ return f(
+ boost::math::tools::real_cast<int>(row[m_i]),
+ boost::math::tools::real_cast<int>(row[m_j]),
+ row[m_k],
+ row[m_l]);
+ }
+
+private:
+ F f;
+ unsigned m_i, m_j, m_k, m_l;
+};
+
+template<class F>
+inline row_binder4_i2<F> bind_func_int2(F f, unsigned i, unsigned j, unsigned k, unsigned l)
+{
+ return row_binder4_i2<F>(f, i, j, k, l);
+}
+
+template <class F>
struct negate_type
{
negate_type(F f) : m_f(f){}
Modified: trunk/libs/math/test/test_cbrt.cpp
==============================================================================
--- trunk/libs/math/test/test_cbrt.cpp (original)
+++ trunk/libs/math/test/test_cbrt.cpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -58,6 +58,17 @@
".*", 10, 6); // test function
}
+struct negative_cbrt
+{
+ negative_cbrt(){}
+
+ template <class S>
+ typename S::value_type operator()(const S& row)
+ {
+ return boost::math::cbrt(-row[1]);
+ }
+};
+
template <class T>
void do_test_cbrt(const T& data, const char* type_name, const char* test_name)
@@ -82,7 +93,7 @@
extract_result(0));
result += boost::math::tools::test(
data,
- negate(bind_func(funcp, 1)),
+ negative_cbrt(),
negate(extract_result(0)));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::cbrt", test_name);
std::cout << std::endl;
Modified: trunk/libs/math/test/test_chi_squared.cpp
==============================================================================
--- trunk/libs/math/test/test_chi_squared.cpp (original)
+++ trunk/libs/math/test/test_chi_squared.cpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -523,6 +523,7 @@
int test_main(int, char* [])
{
+ BOOST_MATH_CONTROL_FP;
// Check that can generate chi_squared distribution using the two convenience methods:
chi_squared_distribution<> mychisqr(8);
chi_squared mychisqr2(8);
@@ -532,10 +533,12 @@
// (Parameter value, arbitrarily zero, only communicates the floating point type).
test_spots(0.0F); // Test float.
test_spots(0.0); // Test double.
+#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
test_spots(0.0L); // Test long double.
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
test_spots(boost::math::concepts::real_concept(0.)); // Test real concept.
#endif
+#endif
return 0;
} // int test_main(int, char* [])
Modified: trunk/libs/math/test/test_classify.cpp
==============================================================================
--- trunk/libs/math/test/test_classify.cpp (original)
+++ trunk/libs/math/test/test_classify.cpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -114,6 +114,7 @@
int test_main(int, char* [] )
{
+ BOOST_MATH_CONTROL_FP;
// start by printing some information:
#ifdef isnan
std::cout << "Platform has isnan macro." << std::endl;
Modified: trunk/libs/math/test/test_digamma.cpp
==============================================================================
--- trunk/libs/math/test/test_digamma.cpp (original)
+++ trunk/libs/math/test/test_digamma.cpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -8,10 +8,7 @@
#include <boost/test/floating_point_comparison.hpp>
#include <boost/math/special_functions/digamma.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 "functor.hpp"
#include "handle_test_result.hpp"
@@ -69,7 +66,6 @@
template <class T>
void do_test_digamma(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;
@@ -86,12 +82,10 @@
//
result = boost::math::tools::test(
data,
- boost::lambda::bind(funcp,
- boost::lambda::ret<value_type>(boost::lambda::_1[0])),
- boost::lambda::ret<value_type>(boost::lambda::_1[1]));
+ bind_func(funcp, 0),
+ extract_result(1));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::digamma", test_name);
std::cout << std::endl;
-#endif
}
template <class T>
@@ -155,6 +149,7 @@
int test_main(int, char* [])
{
+ BOOST_MATH_CONTROL_FP;
test_spots(0.0F, "float");
test_spots(0.0, "double");
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
Modified: trunk/libs/math/test/test_ellint_1.cpp
==============================================================================
--- trunk/libs/math/test/test_ellint_1.cpp (original)
+++ trunk/libs/math/test/test_ellint_1.cpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -16,8 +16,7 @@
#include <boost/test/floating_point_comparison.hpp>
#include <boost/math/special_functions/ellint_1.hpp>
#include <boost/array.hpp>
-#include <boost/lambda/lambda.hpp>
-#include <boost/lambda/bind.hpp>
+#include "functor.hpp"
#include "handle_test_result.hpp"
//
@@ -103,11 +102,9 @@
result = boost::math::tools::test(
data,
- boost::lambda::bind(fp2,
- boost::lambda::ret<value_type>(boost::lambda::_1[1]),
- boost::lambda::ret<value_type>(boost::lambda::_1[0])),
- boost::lambda::ret<value_type>(boost::lambda::_1[2]));
- handle_test_result(result, data[result.worst()], result.worst(),
+ bind_func(fp2, 1, 0),
+ extract_result(2));
+ handle_test_result(result, data[result.worst()], result.worst(),
type_name, "boost::math::ellint_1", test);
std::cout << std::endl;
@@ -126,9 +123,8 @@
value_type (*fp1)(value_type) = boost::math::ellint_1;
result = boost::math::tools::test(
data,
- boost::lambda::bind(fp1,
- boost::lambda::ret<value_type>(boost::lambda::_1[0])),
- boost::lambda::ret<value_type>(boost::lambda::_1[1]));
+ bind_func(fp1, 0),
+ extract_result(1));
handle_test_result(result, data[result.worst()], result.worst(),
type_name, "boost::math::ellint_1", test);
@@ -196,6 +192,7 @@
int test_main(int, char* [])
{
expected_results();
+ BOOST_MATH_CONTROL_FP;
test_spots(0.0F, "float");
test_spots(0.0, "double");
Modified: trunk/libs/math/test/test_ellint_2.cpp
==============================================================================
--- trunk/libs/math/test/test_ellint_2.cpp (original)
+++ trunk/libs/math/test/test_ellint_2.cpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -16,8 +16,7 @@
#include <boost/test/floating_point_comparison.hpp>
#include <boost/math/special_functions/ellint_2.hpp>
#include <boost/array.hpp>
-#include <boost/lambda/lambda.hpp>
-#include <boost/lambda/bind.hpp>
+#include "functor.hpp"
#include "handle_test_result.hpp"
//
@@ -103,10 +102,8 @@
result = boost::math::tools::test(
data,
- boost::lambda::bind(fp2,
- boost::lambda::ret<value_type>(boost::lambda::_1[1]),
- boost::lambda::ret<value_type>(boost::lambda::_1[0])),
- boost::lambda::ret<value_type>(boost::lambda::_1[2]));
+ bind_func(fp2, 1, 0),
+ extract_result(2));
handle_test_result(result, data[result.worst()], result.worst(),
type_name, "boost::math::ellint_2", test);
@@ -125,9 +122,8 @@
value_type (*fp1)(value_type) = boost::math::ellint_2;
result = boost::math::tools::test(
data,
- boost::lambda::bind(fp1,
- boost::lambda::ret<value_type>(boost::lambda::_1[0])),
- boost::lambda::ret<value_type>(boost::lambda::_1[1]));
+ bind_func(fp1, 0),
+ extract_result(1));
handle_test_result(result, data[result.worst()], result.worst(),
type_name, "boost::math::ellint_2", test);
@@ -187,6 +183,7 @@
int test_main(int, char* [])
{
expected_results();
+ BOOST_MATH_CONTROL_FP;
#ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
test_spots(0.0F, "float");
#endif
Modified: trunk/libs/math/test/test_ellint_3.cpp
==============================================================================
--- trunk/libs/math/test/test_ellint_3.cpp (original)
+++ trunk/libs/math/test/test_ellint_3.cpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -16,8 +16,7 @@
#include <boost/test/floating_point_comparison.hpp>
#include <boost/math/special_functions/ellint_3.hpp>
#include <boost/array.hpp>
-#include <boost/lambda/lambda.hpp>
-#include <boost/lambda/bind.hpp>
+#include "functor.hpp"
#include "handle_test_result.hpp"
//
@@ -116,11 +115,8 @@
result = boost::math::tools::test(
data,
- boost::lambda::bind(fp2,
- boost::lambda::ret<value_type>(boost::lambda::_1[2]),
- boost::lambda::ret<value_type>(boost::lambda::_1[0]),
- boost::lambda::ret<value_type>(boost::lambda::_1[1])),
- boost::lambda::ret<value_type>(boost::lambda::_1[3]));
+ bind_func(fp2, 2, 0, 1),
+ extract_result(3));
handle_test_result(result, data[result.worst()], result.worst(),
type_name, "boost::math::ellint_3", test);
@@ -141,10 +137,8 @@
result = boost::math::tools::test(
data,
- boost::lambda::bind(fp2,
- boost::lambda::ret<value_type>(boost::lambda::_1[1]),
- boost::lambda::ret<value_type>(boost::lambda::_1[0])),
- boost::lambda::ret<value_type>(boost::lambda::_1[2]));
+ bind_func(fp2, 1, 0),
+ extract_result(2));
handle_test_result(result, data[result.worst()], result.worst(),
type_name, "boost::math::ellint_3", test);
@@ -226,6 +220,7 @@
int test_main(int, char* [])
{
expected_results();
+ BOOST_MATH_CONTROL_FP;
test_spots(0.0F, "float");
test_spots(0.0, "double");
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
Modified: trunk/libs/math/test/test_erf.cpp
==============================================================================
--- trunk/libs/math/test/test_erf.cpp (original)
+++ trunk/libs/math/test/test_erf.cpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -11,10 +11,7 @@
#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 "functor.hpp"
#include "test_erf_hooks.hpp"
#include "handle_test_result.hpp"
@@ -101,7 +98,6 @@
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;
@@ -118,18 +114,16 @@
//
result = boost::math::tools::test(
data,
- boost::lambda::bind(funcp,
- boost::lambda::ret<value_type>(boost::lambda::_1[0])),
- boost::lambda::ret<value_type>(boost::lambda::_1[1]));
+ bind_func(funcp, 0),
+ extract_result(1));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::erf", test_name);
#ifdef TEST_OTHER
if(::boost::is_floating_point<value_type>::value){
funcp = other::erf;
result = boost::math::tools::test(
data,
- boost::lambda::bind(funcp,
- boost::lambda::ret<value_type>(boost::lambda::_1[0])),
- boost::lambda::ret<value_type>(boost::lambda::_1[1]));
+ bind_func(funcp, 0),
+ extract_result(1));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::erf");
}
#endif
@@ -139,29 +133,25 @@
funcp = boost::math::erfc;
result = boost::math::tools::test(
data,
- boost::lambda::bind(funcp,
- boost::lambda::ret<value_type>(boost::lambda::_1[0])),
- boost::lambda::ret<value_type>(boost::lambda::_1[2]));
+ bind_func(funcp, 0),
+ extract_result(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::erfc", test_name);
#ifdef TEST_OTHER
if(::boost::is_floating_point<value_type>::value){
funcp = other::erfc;
result = boost::math::tools::test(
data,
- boost::lambda::bind(funcp,
- boost::lambda::ret<value_type>(boost::lambda::_1[0])),
- boost::lambda::ret<value_type>(boost::lambda::_1[2]));
+ bind(funcp, 0),
+ extract_result(2));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::erfc");
}
#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;
@@ -177,18 +167,15 @@
funcp = boost::math::erf_inv;
result = boost::math::tools::test(
data,
- boost::lambda::bind(funcp,
- boost::lambda::ret<value_type>(boost::lambda::_1[0])),
- boost::lambda::ret<value_type>(boost::lambda::_1[1]));
+ bind_func(funcp, 0),
+ extract_result(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;
@@ -204,12 +191,10 @@
funcp = boost::math::erfc_inv;
result = boost::math::tools::test(
data,
- boost::lambda::bind(funcp,
- boost::lambda::ret<value_type>(boost::lambda::_1[0])),
- boost::lambda::ret<value_type>(boost::lambda::_1[1]));
+ bind_func(funcp, 0),
+ extract_result(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>
@@ -296,6 +281,7 @@
int test_main(int, char* [])
{
+ BOOST_MATH_CONTROL_FP;
test_spots(0.0F, "float");
test_spots(0.0, "double");
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
Modified: trunk/libs/math/test/test_factorials.cpp
==============================================================================
--- trunk/libs/math/test/test_factorials.cpp (original)
+++ trunk/libs/math/test/test_factorials.cpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -286,6 +286,7 @@
int test_main(int, char* [])
{
+ BOOST_MATH_CONTROL_FP;
test_spots(0.0F);
test_spots(0.0);
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
Modified: trunk/libs/math/test/test_gamma.cpp
==============================================================================
--- trunk/libs/math/test/test_gamma.cpp (original)
+++ trunk/libs/math/test/test_gamma.cpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -14,10 +14,7 @@
#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 "functor.hpp"
#include "test_gamma_hooks.hpp"
#include "handle_test_result.hpp"
@@ -288,7 +285,6 @@
template <class T>
void do_test_gamma(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;
@@ -305,16 +301,16 @@
//
result = boost::math::tools::test(
data,
- boost::lambda::bind(funcp, boost::lambda::ret<value_type>(boost::lambda::_1[0])),
- boost::lambda::ret<value_type>(boost::lambda::_1[1]));
+ bind_func(funcp, 0),
+ extract_result(1));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgamma", test_name);
#ifdef TEST_OTHER
if(::boost::is_floating_point<value_type>::value){
funcp = other::tgamma;
result = boost::math::tools::test(
data,
- boost::lambda::bind(funcp, boost::lambda::ret<value_type>(boost::lambda::_1[0])),
- boost::lambda::ret<value_type>(boost::lambda::_1[1]));
+ bind_func(funcp, 0),
+ extract_result(1));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::tgamma");
}
#endif
@@ -324,28 +320,26 @@
funcp = boost::math::lgamma;
result = boost::math::tools::test(
data,
- boost::lambda::bind(funcp, boost::lambda::ret<value_type>(boost::lambda::_1[0])),
- boost::lambda::ret<value_type>(boost::lambda::_1[2]));
+ bind_func(funcp, 0),
+ extract_result(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::lgamma", test_name);
#ifdef TEST_OTHER
if(::boost::is_floating_point<value_type>::value){
funcp = other::lgamma;
result = boost::math::tools::test(
data,
- boost::lambda::bind(funcp, boost::lambda::ret<value_type>(boost::lambda::_1[0])),
- boost::lambda::ret<value_type>(boost::lambda::_1[2]));
+ bind_func(funcp, 0),
+ extract_result(2));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::lgamma");
}
#endif
std::cout << std::endl;
-#endif
}
template <class T>
void do_test_gammap1m1(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;
@@ -362,11 +356,10 @@
//
result = boost::math::tools::test(
data,
- boost::lambda::bind(funcp, boost::lambda::ret<value_type>(boost::lambda::_1[0])),
- boost::lambda::ret<value_type>(boost::lambda::_1[1]));
+ bind_func(funcp, 0),
+ extract_result(1));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgamma1pm1", test_name);
std::cout << std::endl;
-#endif
}
template <class T>
@@ -447,6 +440,7 @@
int test_main(int, char* [])
{
expected_results();
+ BOOST_MATH_CONTROL_FP;
#ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
test_spots(0.0F);
Modified: trunk/libs/math/test/test_hermite.cpp
==============================================================================
--- trunk/libs/math/test/test_hermite.cpp (original)
+++ trunk/libs/math/test/test_hermite.cpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -18,10 +18,7 @@
#include <boost/math/special_functions/hermite.hpp>
#include <boost/math/constants/constants.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 "functor.hpp"
#include "handle_test_result.hpp"
#include "test_legendre_hooks.hpp"
@@ -98,7 +95,6 @@
template <class T>
void do_test_hermite(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;
@@ -106,7 +102,6 @@
pg funcp = boost::math::hermite;
typedef unsigned (*cast_t)(value_type);
- cast_t rc = &boost::math::tools::real_cast<unsigned, value_type>;
boost::math::tools::test_result<value_type> result;
@@ -118,17 +113,11 @@
//
result = boost::math::tools::test(
data,
- boost::lambda::bind(funcp,
- boost::lambda::ret<int>(
- boost::lambda::bind(
- rc,
- boost::lambda::ret<value_type>(boost::lambda::_1[0]))),
- boost::lambda::ret<value_type>(boost::lambda::_1[1])),
- boost::lambda::ret<value_type>(boost::lambda::_1[2]));
+ bind_func_int1(funcp, 0, 1),
+ extract_result(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::hermite", test_name);
std::cout << std::endl;
-#endif
}
template <class T>
@@ -177,6 +166,10 @@
int test_main(int, char* [])
{
+ BOOST_MATH_CONTROL_FP;
+
+ boost::math::hermite(51, 915.0);
+
#ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
test_spots(0.0F, "float");
#endif
Modified: trunk/libs/math/test/test_ibeta.cpp
==============================================================================
--- trunk/libs/math/test/test_ibeta.cpp (original)
+++ trunk/libs/math/test/test_ibeta.cpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -12,10 +12,7 @@
#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 "functor.hpp"
#include "test_beta_hooks.hpp"
#include "handle_test_result.hpp"
@@ -269,7 +266,6 @@
template <class T>
void do_test_beta(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;
@@ -286,57 +282,41 @@
//
result = boost::math::tools::test(
data,
- boost::lambda::bind(funcp,
- boost::lambda::ret<value_type>(boost::lambda::_1[0]),
- boost::lambda::ret<value_type>(boost::lambda::_1[1]),
- boost::lambda::ret<value_type>(boost::lambda::_1[2])),
- boost::lambda::ret<value_type>(boost::lambda::_1[3]));
+ bind_func(funcp, 0, 1, 2),
+ extract_result(3));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::beta", test_name);
funcp = boost::math::betac;
result = boost::math::tools::test(
data,
- boost::lambda::bind(funcp,
- boost::lambda::ret<value_type>(boost::lambda::_1[0]),
- boost::lambda::ret<value_type>(boost::lambda::_1[1]),
- boost::lambda::ret<value_type>(boost::lambda::_1[2])),
- boost::lambda::ret<value_type>(boost::lambda::_1[4]));
+ bind_func(funcp, 0, 1, 2),
+ extract_result(4));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::betac", test_name);
funcp = boost::math::ibeta;
result = boost::math::tools::test(
data,
- boost::lambda::bind(funcp,
- boost::lambda::ret<value_type>(boost::lambda::_1[0]),
- boost::lambda::ret<value_type>(boost::lambda::_1[1]),
- boost::lambda::ret<value_type>(boost::lambda::_1[2])),
- boost::lambda::ret<value_type>(boost::lambda::_1[5]));
+ bind_func(funcp, 0, 1, 2),
+ extract_result(5));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::ibeta", test_name);
funcp = boost::math::ibetac;
result = boost::math::tools::test(
data,
- boost::lambda::bind(funcp,
- boost::lambda::ret<value_type>(boost::lambda::_1[0]),
- boost::lambda::ret<value_type>(boost::lambda::_1[1]),
- boost::lambda::ret<value_type>(boost::lambda::_1[2])),
- boost::lambda::ret<value_type>(boost::lambda::_1[6]));
+ bind_func(funcp, 0, 1, 2),
+ extract_result(6));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::ibetac", test_name);
#ifdef TEST_OTHER
if(::boost::is_floating_point<value_type>::value){
funcp = other::ibeta;
result = boost::math::tools::test(
data,
- boost::lambda::bind(funcp,
- boost::lambda::ret<value_type>(boost::lambda::_1[0]),
- boost::lambda::ret<value_type>(boost::lambda::_1[1]),
- boost::lambda::ret<value_type>(boost::lambda::_1[2])),
- boost::lambda::ret<value_type>(boost::lambda::_1[5]));
+ bind_func(funcp, 0, 1, 2),
+ extract_result(5));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::ibeta");
}
#endif
std::cout << std::endl;
-#endif
}
template <class T>
@@ -516,6 +496,7 @@
int test_main(int, char* [])
{
expected_results();
+ BOOST_MATH_CONTROL_FP;
#ifdef TEST_GSL
gsl_set_error_handler_off();
#endif
@@ -534,17 +515,15 @@
#ifdef TEST_DOUBLE
test_beta(0.1, "double");
#endif
-#ifdef TEST_LDOUBLE
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
+#ifdef TEST_LDOUBLE
test_beta(0.1L, "long double");
#endif
#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
-#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
#ifdef TEST_REAL_CONCEPT
test_beta(boost::math::concepts::real_concept(0.1), "real_concept");
#endif
#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 "
Modified: trunk/libs/math/test/test_ibeta_inv.cpp
==============================================================================
--- trunk/libs/math/test/test_ibeta_inv.cpp (original)
+++ trunk/libs/math/test/test_ibeta_inv.cpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -12,10 +12,7 @@
#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 "functor.hpp"
#include "test_beta_hooks.hpp"
#include "handle_test_result.hpp"
@@ -213,15 +210,12 @@
template <class T>
void test_inverses2(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;
typedef value_type (*pg)(value_type, value_type, value_type);
pg funcp = boost::math::ibeta_inv;
- using namespace boost::lambda;
-
boost::math::tools::test_result<value_type> result;
std::cout << "Testing " << test_name << " with type " << type_name
@@ -232,8 +226,8 @@
//
result = boost::math::tools::test(
data,
- bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1]), ret<value_type>(_1[2])),
- ret<value_type>(_1[3]));
+ bind_func(funcp, 0, 1, 2),
+ extract_result(3));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::ibeta_inv", test_name);
//
// test ibetac_inv(T, T, T) against data:
@@ -241,10 +235,9 @@
funcp = boost::math::ibetac_inv;
result = boost::math::tools::test(
data,
- bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1]), ret<value_type>(_1[2])),
- ret<value_type>(_1[4]));
+ bind_func(funcp, 0, 1, 2),
+ extract_result(4));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::ibetac_inv", test_name);
-#endif
}
@@ -309,6 +302,7 @@
int test_main(int, char* [])
{
+ BOOST_MATH_CONTROL_FP;
expected_results();
#ifdef TEST_GSL
gsl_set_error_handler_off();
Modified: trunk/libs/math/test/test_ibeta_inv_ab.cpp
==============================================================================
--- trunk/libs/math/test/test_ibeta_inv_ab.cpp (original)
+++ trunk/libs/math/test/test_ibeta_inv_ab.cpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -12,10 +12,7 @@
#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 "functor.hpp"
#ifdef TEST_GSL
#include <gsl/gsl_errno.h>
@@ -176,15 +173,12 @@
template <class T>
void test_inverses2(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;
typedef value_type (*pg)(value_type, value_type, value_type);
pg funcp = boost::math::ibeta_inva;
- using namespace boost::lambda;
-
boost::math::tools::test_result<value_type> result;
std::cout << "Testing " << test_name << " with type " << type_name
@@ -195,8 +189,8 @@
//
result = boost::math::tools::test(
data,
- bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1]), ret<value_type>(_1[2])),
- ret<value_type>(_1[3]));
+ bind_func(funcp, 0, 1, 2),
+ extract_result(3));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::ibeta_inva", test_name);
//
// test ibetac_inva(T, T, T) against data:
@@ -204,8 +198,8 @@
funcp = boost::math::ibetac_inva;
result = boost::math::tools::test(
data,
- bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1]), ret<value_type>(_1[2])),
- ret<value_type>(_1[4]));
+ bind_func(funcp, 0, 1, 2),
+ extract_result(4));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::ibetac_inva", test_name);
//
// test ibeta_invb(T, T, T) against data:
@@ -213,8 +207,8 @@
funcp = boost::math::ibeta_invb;
result = boost::math::tools::test(
data,
- bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1]), ret<value_type>(_1[2])),
- ret<value_type>(_1[5]));
+ bind_func(funcp, 0, 1, 2),
+ extract_result(5));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::ibeta_invb", test_name);
//
// test ibetac_invb(T, T, T) against data:
@@ -222,10 +216,9 @@
funcp = boost::math::ibetac_invb;
result = boost::math::tools::test(
data,
- bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1]), ret<value_type>(_1[2])),
- ret<value_type>(_1[6]));
+ bind_func(funcp, 0, 1, 2),
+ extract_result(6));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::ibetac_invb", test_name);
-#endif
}
template <class T>
Modified: trunk/libs/math/test/test_igamma.cpp
==============================================================================
--- trunk/libs/math/test/test_igamma.cpp (original)
+++ trunk/libs/math/test/test_igamma.cpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -14,10 +14,7 @@
#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 "functor.hpp"
#include "test_gamma_hooks.hpp"
#include "handle_test_result.hpp"
@@ -310,15 +307,12 @@
template <class T>
void do_test_gamma_2(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;
typedef value_type (*pg)(value_type, value_type);
pg funcp = boost::math::tgamma;
- using namespace boost::lambda;
-
boost::math::tools::test_result<value_type> result;
std::cout << "Testing " << test_name << " with type " << type_name
@@ -331,8 +325,8 @@
{
result = boost::math::tools::test(
data,
- bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1])),
- ret<value_type>(_1[2]));
+ bind_func(funcp, 0, 1),
+ extract_result(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgamma", test_name);
//
// test tgamma_lower(T, T) against data:
@@ -340,8 +334,8 @@
funcp = boost::math::tgamma_lower;
result = boost::math::tools::test(
data,
- bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1])),
- ret<value_type>(_1[4]));
+ bind_func(funcp, 0, 1),
+ extract_result(4));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgamma_lower", test_name);
}
//
@@ -350,8 +344,8 @@
funcp = boost::math::gamma_q;
result = boost::math::tools::test(
data,
- bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1])),
- ret<value_type>(_1[3]));
+ bind_func(funcp, 0, 1),
+ extract_result(3));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::gamma_q", test_name);
#if defined(TEST_CEPHES) || defined(TEST_GSL)
//
@@ -362,8 +356,8 @@
funcp = other::gamma_q;
result = boost::math::tools::test(
data,
- bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1])),
- ret<value_type>(_1[3]));
+ bind_func(funcp, 0, 1),
+ extract_result(3));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::gamma_q");
}
#endif
@@ -373,8 +367,8 @@
funcp = boost::math::gamma_p;
result = boost::math::tools::test(
data,
- bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1])),
- ret<value_type>(_1[5]));
+ bind_func(funcp, 0, 1),
+ extract_result(5));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::gamma_p", test_name);
#if defined(TEST_CEPHES) || defined(TEST_GSL)
//
@@ -385,13 +379,12 @@
funcp = other::gamma_p;
result = boost::math::tools::test(
data,
- bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1])),
- ret<value_type>(_1[5]));
+ bind_func(funcp, 0, 1),
+ extract_result(5));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::gamma_p");
}
#endif
std::cout << std::endl;
-#endif
}
template <class T>
@@ -472,6 +465,7 @@
int test_main(int, char* [])
{
expected_results();
+ BOOST_MATH_CONTROL_FP;
#ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
test_spots(0.0F);
Modified: trunk/libs/math/test/test_igamma_inv.cpp
==============================================================================
--- trunk/libs/math/test/test_igamma_inv.cpp (original)
+++ trunk/libs/math/test/test_igamma_inv.cpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -12,10 +12,7 @@
#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 "functor.hpp"
#include "test_gamma_hooks.hpp"
#include "handle_test_result.hpp"
@@ -263,15 +260,12 @@
template <class T>
void do_test_gamma_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;
typedef value_type (*pg)(value_type, value_type);
pg funcp = boost::math::gamma_p_inv;
- using namespace boost::lambda;
-
boost::math::tools::test_result<value_type> result;
std::cout << "Testing " << test_name << " with type " << type_name
@@ -282,8 +276,8 @@
//
result = boost::math::tools::test(
data,
- bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1])),
- ret<value_type>(_1[2]));
+ bind_func(funcp, 0, 1),
+ extract_result(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::gamma_p_inv", test_name);
//
// test gamma_q_inv(T, T) against data:
@@ -291,10 +285,9 @@
funcp = boost::math::gamma_q_inv;
result = boost::math::tools::test(
data,
- bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1])),
- ret<value_type>(_1[3]));
+ bind_func(funcp, 0, 1),
+ extract_result(3));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::gamma_q_inv", test_name);
-#endif
}
template <class T>
@@ -371,6 +364,7 @@
int test_main(int, char* [])
{
expected_results();
+ BOOST_MATH_CONTROL_FP;
#ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
test_spots(0.0F, "float");
Modified: trunk/libs/math/test/test_igamma_inva.cpp
==============================================================================
--- trunk/libs/math/test/test_igamma_inva.cpp (original)
+++ trunk/libs/math/test/test_igamma_inva.cpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -12,10 +12,7 @@
#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 "functor.hpp"
#include "handle_test_result.hpp"
@@ -189,15 +186,12 @@
template <class T>
void do_test_gamma_inva(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;
typedef value_type (*pg)(value_type, value_type);
pg funcp = boost::math::gamma_p_inva;
- using namespace boost::lambda;
-
boost::math::tools::test_result<value_type> result;
std::cout << "Testing " << test_name << " with type " << type_name
@@ -208,8 +202,8 @@
//
result = boost::math::tools::test(
data,
- bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1])),
- ret<value_type>(_1[2]));
+ bind_func(funcp, 0, 1),
+ extract_result(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::gamma_p_inva", test_name);
//
// test gamma_q_inva(T, T) against data:
@@ -217,10 +211,9 @@
funcp = boost::math::gamma_q_inva;
result = boost::math::tools::test(
data,
- bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1])),
- ret<value_type>(_1[3]));
+ bind_func(funcp, 0, 1),
+ extract_result(3));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::gamma_q_inva", test_name);
-#endif
}
template <class T>
@@ -255,6 +248,7 @@
int test_main(int, char* [])
{
expected_results();
+ BOOST_MATH_CONTROL_FP;
#ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
#ifdef TEST_FLOAT
Modified: trunk/libs/math/test/test_laguerre.cpp
==============================================================================
--- trunk/libs/math/test/test_laguerre.cpp (original)
+++ trunk/libs/math/test/test_laguerre.cpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -9,10 +9,7 @@
#include <boost/math/special_functions/laguerre.hpp>
#include <boost/math/constants/constants.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 "functor.hpp"
#include "handle_test_result.hpp"
#include "test_legendre_hooks.hpp"
@@ -136,16 +133,12 @@
template <class T>
void do_test_laguerre2(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;
typedef value_type (*pg)(unsigned, value_type);
pg funcp = boost::math::laguerre;
- typedef unsigned (*cast_t)(value_type);
- cast_t rc = &boost::math::tools::real_cast<unsigned, value_type>;
-
boost::math::tools::test_result<value_type> result;
std::cout << "Testing " << test_name << " with type " << type_name
@@ -156,32 +149,22 @@
//
result = boost::math::tools::test(
data,
- boost::lambda::bind(funcp,
- boost::lambda::ret<unsigned>(
- boost::lambda::bind(
- rc,
- boost::lambda::ret<value_type>(boost::lambda::_1[0]))),
- boost::lambda::ret<value_type>(boost::lambda::_1[1])),
- boost::lambda::ret<value_type>(boost::lambda::_1[2]));
+ bind_func_int1(funcp, 0, 1),
+ extract_result(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::laguerre(n, x)", test_name);
std::cout << std::endl;
-#endif
}
template <class T>
void do_test_laguerre3(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;
typedef value_type (*pg)(unsigned, unsigned, value_type);
pg funcp = boost::math::laguerre;
- typedef unsigned (*cast_t)(value_type);
- cast_t rc = &boost::math::tools::real_cast<unsigned, value_type>;
-
boost::math::tools::test_result<value_type> result;
std::cout << "Testing " << test_name << " with type " << type_name
@@ -192,20 +175,10 @@
//
result = boost::math::tools::test(
data,
- boost::lambda::bind(funcp,
- boost::lambda::ret<unsigned>(
- boost::lambda::bind(
- rc,
- boost::lambda::ret<value_type>(boost::lambda::_1[0]))),
- boost::lambda::ret<unsigned>(
- boost::lambda::bind(
- rc,
- boost::lambda::ret<value_type>(boost::lambda::_1[1]))),
- boost::lambda::ret<value_type>(boost::lambda::_1[2])),
- boost::lambda::ret<value_type>(boost::lambda::_1[3]));
+ bind_func_int2(funcp, 0, 1, 2),
+ extract_result(3));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::laguerre(n, m, x)", test_name);
std::cout << std::endl;
-#endif
}
template <class T>
@@ -262,6 +235,8 @@
int test_main(int, char* [])
{
+ BOOST_MATH_CONTROL_FP;
+
#ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
test_spots(0.0F, "float");
#endif
Modified: trunk/libs/math/test/test_legendre.cpp
==============================================================================
--- trunk/libs/math/test/test_legendre.cpp (original)
+++ trunk/libs/math/test/test_legendre.cpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -9,10 +9,7 @@
#include <boost/math/special_functions/legendre.hpp>
#include <boost/math/constants/constants.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 "functor.hpp"
#include "handle_test_result.hpp"
#include "test_legendre_hooks.hpp"
@@ -192,16 +189,12 @@
template <class T>
void do_test_legendre_p(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;
typedef value_type (*pg)(int, value_type);
pg funcp = boost::math::legendre_p;
- typedef int (*cast_t)(value_type);
- cast_t rc = &boost::math::tools::real_cast<int, value_type>;
-
boost::math::tools::test_result<value_type> result;
std::cout << "Testing " << test_name << " with type " << type_name
@@ -212,26 +205,16 @@
//
result = boost::math::tools::test(
data,
- boost::lambda::bind(funcp,
- boost::lambda::ret<int>(
- boost::lambda::bind(
- rc,
- boost::lambda::ret<value_type>(boost::lambda::_1[0]))),
- boost::lambda::ret<value_type>(boost::lambda::_1[1])),
- boost::lambda::ret<value_type>(boost::lambda::_1[2]));
+ bind_func_int1(funcp, 0, 1),
+ extract_result(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::legendre_p", test_name);
#ifdef TEST_OTHER
if(::boost::is_floating_point<value_type>::value){
funcp = other::legendre_p;
result = boost::math::tools::test(
data,
- boost::lambda::bind(funcp,
- boost::lambda::ret<int>(
- boost::lambda::bind(
- rc,
- boost::lambda::ret<value_type>(boost::lambda::_1[0]))),
- boost::lambda::ret<value_type>(boost::lambda::_1[1])),
- boost::lambda::ret<value_type>(boost::lambda::_1[2]));
+ bind_func_int1(funcp, 0, 1),
+ extract_result(2));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::legendre_p");
}
#endif
@@ -244,48 +227,33 @@
//
result = boost::math::tools::test(
data,
- boost::lambda::bind(funcp2,
- boost::lambda::ret<int>(
- boost::lambda::bind(
- rc,
- boost::lambda::ret<value_type>(boost::lambda::_1[0]))),
- boost::lambda::ret<value_type>(boost::lambda::_1[1])),
- boost::lambda::ret<value_type>(boost::lambda::_1[3]));
+ bind_func_int1(funcp2, 0, 1),
+ extract_result(3));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::legendre_q", test_name);
#ifdef TEST_OTHER
if(::boost::is_floating_point<value_type>::value){
funcp = other::legendre_q;
result = boost::math::tools::test(
data,
- boost::lambda::bind(funcp2,
- boost::lambda::ret<int>(
- boost::lambda::bind(
- rc,
- boost::lambda::ret<value_type>(boost::lambda::_1[0]))),
- boost::lambda::ret<value_type>(boost::lambda::_1[1])),
- boost::lambda::ret<value_type>(boost::lambda::_1[3]));
+ bind_func_int1(funcp2, 0, 1),
+ extract_result(3));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::legendre_q");
}
#endif
std::cout << std::endl;
-#endif
}
template <class T>
void do_test_assoc_legendre_p(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;
typedef value_type (*pg)(int, int, value_type);
pg funcp = boost::math::legendre_p;
- typedef int (*cast_t)(value_type);
- cast_t rc = &boost::math::tools::real_cast<int, value_type>;
-
boost::math::tools::test_result<value_type> result;
std::cout << "Testing " << test_name << " with type " << type_name
@@ -296,20 +264,10 @@
//
result = boost::math::tools::test(
data,
- boost::lambda::bind(funcp,
- boost::lambda::ret<int>(
- boost::lambda::bind(
- rc,
- boost::lambda::ret<value_type>(boost::lambda::_1[0]))),
- boost::lambda::ret<int>(
- boost::lambda::bind(
- rc,
- boost::lambda::ret<value_type>(boost::lambda::_1[1]))),
- boost::lambda::ret<value_type>(boost::lambda::_1[2])),
- boost::lambda::ret<value_type>(boost::lambda::_1[3]));
+ bind_func_int2(funcp, 0, 1, 2),
+ extract_result(3));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::legendre_p", test_name);
std::cout << std::endl;
-#endif
}
template <class T>
@@ -385,6 +343,7 @@
int test_main(int, char* [])
{
+ BOOST_MATH_CONTROL_FP;
test_spots(0.0F, "float");
test_spots(0.0, "double");
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
Modified: trunk/libs/math/test/test_spherical_harmonic.cpp
==============================================================================
--- trunk/libs/math/test/test_spherical_harmonic.cpp (original)
+++ trunk/libs/math/test/test_spherical_harmonic.cpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -9,10 +9,7 @@
#include <boost/math/special_functions/spherical_harmonic.hpp>
#include <boost/math/constants/constants.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 "functor.hpp"
#include "handle_test_result.hpp"
@@ -100,14 +97,11 @@
template <class T>
void do_test_spherical_harmonic(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;
typedef value_type (*pg)(unsigned, int, value_type, value_type);
pg funcp = boost::math::spherical_harmonic_r;
- typedef unsigned (*cast_t)(value_type);
- cast_t cf = &boost::math::tools::real_cast<unsigned, value_type>;
boost::math::tools::test_result<value_type> result;
@@ -119,18 +113,8 @@
//
result = boost::math::tools::test(
data,
- boost::lambda::bind(funcp,
- boost::lambda::ret<unsigned>(
- boost::lambda::bind(
- cf,
- boost::lambda::ret<value_type>(boost::lambda::_1[0]))),
- boost::lambda::ret<unsigned>(
- boost::lambda::bind(
- cf,
- boost::lambda::ret<value_type>(boost::lambda::_1[1]))),
- boost::lambda::ret<value_type>(boost::lambda::_1[2]),
- boost::lambda::ret<value_type>(boost::lambda::_1[3])),
- boost::lambda::ret<value_type>(boost::lambda::_1[4]));
+ bind_func_int2(funcp, 0, 1, 2, 3),
+ extract_result(4));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::spherical_harmonic_r", test_name);
funcp = boost::math::spherical_harmonic_i;
@@ -139,22 +123,11 @@
//
result = boost::math::tools::test(
data,
- boost::lambda::bind(funcp,
- boost::lambda::ret<unsigned>(
- boost::lambda::bind(
- cf,
- boost::lambda::ret<value_type>(boost::lambda::_1[0]))),
- boost::lambda::ret<unsigned>(
- boost::lambda::bind(
- cf,
- boost::lambda::ret<value_type>(boost::lambda::_1[1]))),
- boost::lambda::ret<value_type>(boost::lambda::_1[2]),
- boost::lambda::ret<value_type>(boost::lambda::_1[3])),
- boost::lambda::ret<value_type>(boost::lambda::_1[5]));
+ bind_func_int2(funcp, 0, 1, 2, 3),
+ extract_result(5));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::spherical_harmonic_i", test_name);
std::cout << std::endl;
-#endif
}
template <class T>
@@ -303,6 +276,7 @@
int test_main(int, char* [])
{
+ BOOST_MATH_CONTROL_FP;
test_spots(0.0F, "float");
test_spots(0.0, "double");
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
Modified: trunk/libs/math/test/test_tgamma_ratio.cpp
==============================================================================
--- trunk/libs/math/test/test_tgamma_ratio.cpp (original)
+++ trunk/libs/math/test/test_tgamma_ratio.cpp 2007-10-13 12:23:18 EDT (Sat, 13 Oct 2007)
@@ -12,10 +12,7 @@
#include <boost/math/tools/stats.hpp>
#include <boost/math/tools/test.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 "functor.hpp"
#include "handle_test_result.hpp"
@@ -114,10 +111,18 @@
<< BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl;
}
+struct negative_tgamma_ratio
+{
+ template <class Row>
+ typename Row::value_type operator()(const Row& row)
+ {
+ return boost::math::tgamma_delta_ratio(row[0], -row[1]);
+ }
+};
+
template <class T>
void do_test_tgamma_delta_ratio(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;
@@ -134,19 +139,14 @@
//
result = boost::math::tools::test(
data,
- boost::lambda::bind(funcp,
- boost::lambda::ret<value_type>(boost::lambda::_1[0]),
- boost::lambda::ret<value_type>(boost::lambda::_1[1])),
- boost::lambda::ret<value_type>(boost::lambda::_1[2]));
+ bind_func(funcp, 0, 1),
+ extract_result(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgamma_delta_ratio(a, delta)", test_name);
result = boost::math::tools::test(
data,
- boost::lambda::bind(funcp,
- boost::lambda::ret<value_type>(boost::lambda::_1[0]),
- -boost::lambda::ret<value_type>(boost::lambda::_1[1])),
- boost::lambda::ret<value_type>(boost::lambda::_1[3]));
+ negative_tgamma_ratio(),
+ extract_result(3));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgamma_delta_ratio(a -delta)", test_name);
-#endif
}
template <class T>
@@ -168,10 +168,8 @@
//
result = boost::math::tools::test(
data,
- boost::lambda::bind(funcp,
- boost::lambda::ret<value_type>(boost::lambda::_1[0]),
- boost::lambda::ret<value_type>(boost::lambda::_1[1])),
- boost::lambda::ret<value_type>(boost::lambda::_1[2]));
+ bind_func(funcp, 0, 1),
+ extract_result(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgamma_ratio(a, b)", test_name);
}
@@ -201,6 +199,7 @@
int test_main(int, char* [])
{
+ BOOST_MATH_CONTROL_FP;
expected_results();
#ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
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