diff --git a/include/boost/math/policies/policy.hpp b/include/boost/math/policies/policy.hpp index 64c61ed9e..967075792 100644 --- a/include/boost/math/policies/policy.hpp +++ b/include/boost/math/policies/policy.hpp @@ -17,11 +17,18 @@ #include #include #include +#include #include #include #include #include #include +// Sadly we do need the .h versions of these to be sure of getting +// FLT_MANT_DIG etc. +#include +#include +#include +#include namespace boost{ namespace math{ @@ -674,22 +681,28 @@ struct evaluation typedef typename mpl::if_::type type; }; +#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + +template +struct basic_digits : public mpl::int_<0>{ }; +template <> +struct basic_digits : public mpl::int_{ }; +template <> +struct basic_digits : public mpl::int_{ }; +template <> +struct basic_digits : public mpl::int_{ }; + template struct precision { typedef typename Policy::precision_type precision_type; - typedef typename mpl::if_c< - ((std::numeric_limits::is_specialized == 0) || (std::numeric_limits::digits == 0)), + typedef basic_digits digits_t; + typedef typename mpl::if_< + mpl::equal_to >, // Possibly unknown precision: precision_type, - typename mpl::if_c< -#ifndef __BORLANDC__ - ((::std::numeric_limits::digits <= precision_type::value) - || (Policy::precision_type::value <= 0)), -#else - ((::std::numeric_limits::digits <= ::boost::math::policies::precision::precision_type::value) - || (::boost::math::policies::precision::precision_type::value <= 0)), -#endif + typename mpl::if_< + mpl::or_, mpl::less_equal > >, // Default case, full precision for RealType: digits2< ::std::numeric_limits::digits>, // User customised precision: @@ -698,6 +711,63 @@ struct precision >::type type; }; +template +struct precision +{ + typedef digits2 type; +}; +template +struct precision +{ + typedef digits2 type; +}; +template +struct precision +{ + typedef digits2 type; +}; + +#else + +template +struct precision +{ +#ifndef __BORLANDC__ + typedef typename Policy::precision_type precision_type; + typedef typename mpl::if_c< + ((::std::numeric_limits::is_specialized == 0) || (::std::numeric_limits::digits == 0)), + // Possibly unknown precision: + precision_type, + typename mpl::if_c< + ((::std::numeric_limits::digits <= precision_type::value) + || (Policy::precision_type::value <= 0)), + // Default case, full precision for RealType: + digits2< ::std::numeric_limits::digits>, + // User customised precision: + precision_type + >::type + >::type type; +#else + typedef typename Policy::precision_type precision_type; + typedef mpl::int_< ::std::numeric_limits::digits> digits_t; + typedef mpl::bool_< ::std::numeric_limits::is_specialized> spec_t; + typedef typename mpl::if_< + mpl::or_, mpl::equal_to > >, + // Possibly unknown precision: + precision_type, + typename mpl::if_< + mpl::or_, mpl::less_equal > >, + // Default case, full precision for RealType: + digits2< ::std::numeric_limits::digits>, + // User customised precision: + precision_type + >::type + >::type type; +#endif +}; + +#endif + namespace detail{ template diff --git a/include/boost/math/tools/config.hpp b/include/boost/math/tools/config.hpp index 39f58faba..e59798f93 100644 --- a/include/boost/math/tools/config.hpp +++ b/include/boost/math/tools/config.hpp @@ -16,6 +16,9 @@ #if defined(__CYGWIN__) || defined(__FreeBSD__) # define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS #endif +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) +# define BOOST_MATH_NO_REAL_CONCEPT_TESTS +#endif #if BOOST_WORKAROUND(BOOST_MSVC, < 1400) // diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 813cea8d4..43bfb1713 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -25,6 +25,8 @@ project msvc:/wd4127 msvc:/wd4701 # needed for lexical cast - temporary. msvc-7.1:../vc71_fix//vc_fix + borland:static + borland:static # msvc:/wd4506 has no effect? # suppress xstring(237) : warning C4506: no definition for inline function ../../.. @@ -201,3 +203,5 @@ compile compile_test/tools_toms748_solve_inc_test.cpp ; + +