/usr/include/boost/math/policies
Edit: /usr/include/boost/math/policies/policy.hpp (39050B)
// Copyright John Maddock 2007.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_MATH_POLICY_HPP
#define BOOST_MATH_POLICY_HPP
#include
#include
#include
#include
#include
#include
#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{
namespace tools{
template
BOOST_MATH_CONSTEXPR int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) BOOST_NOEXCEPT;
template
BOOST_MATH_CONSTEXPR T epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) BOOST_MATH_NOEXCEPT(T);
}
namespace policies{
//
// Define macros for our default policies, if they're not defined already:
//
// Special cases for exceptions disabled first:
//
#ifdef BOOST_NO_EXCEPTIONS
# ifndef BOOST_MATH_DOMAIN_ERROR_POLICY
# define BOOST_MATH_DOMAIN_ERROR_POLICY errno_on_error
# endif
# ifndef BOOST_MATH_POLE_ERROR_POLICY
# define BOOST_MATH_POLE_ERROR_POLICY errno_on_error
# endif
# ifndef BOOST_MATH_OVERFLOW_ERROR_POLICY
# define BOOST_MATH_OVERFLOW_ERROR_POLICY errno_on_error
# endif
# ifndef BOOST_MATH_EVALUATION_ERROR_POLICY
# define BOOST_MATH_EVALUATION_ERROR_POLICY errno_on_error
# endif
# ifndef BOOST_MATH_ROUNDING_ERROR_POLICY
# define BOOST_MATH_ROUNDING_ERROR_POLICY errno_on_error
# endif
#endif
//
// Then the regular cases:
//
#ifndef BOOST_MATH_DOMAIN_ERROR_POLICY
#define BOOST_MATH_DOMAIN_ERROR_POLICY throw_on_error
#endif
#ifndef BOOST_MATH_POLE_ERROR_POLICY
#define BOOST_MATH_POLE_ERROR_POLICY throw_on_error
#endif
#ifndef BOOST_MATH_OVERFLOW_ERROR_POLICY
#define BOOST_MATH_OVERFLOW_ERROR_POLICY throw_on_error
#endif
#ifndef BOOST_MATH_EVALUATION_ERROR_POLICY
#define BOOST_MATH_EVALUATION_ERROR_POLICY throw_on_error
#endif
#ifndef BOOST_MATH_ROUNDING_ERROR_POLICY
#define BOOST_MATH_ROUNDING_ERROR_POLICY throw_on_error
#endif
#ifndef BOOST_MATH_UNDERFLOW_ERROR_POLICY
#define BOOST_MATH_UNDERFLOW_ERROR_POLICY ignore_error
#endif
#ifndef BOOST_MATH_DENORM_ERROR_POLICY
#define BOOST_MATH_DENORM_ERROR_POLICY ignore_error
#endif
#ifndef BOOST_MATH_INDETERMINATE_RESULT_ERROR_POLICY
#define BOOST_MATH_INDETERMINATE_RESULT_ERROR_POLICY ignore_error
#endif
#ifndef BOOST_MATH_DIGITS10_POLICY
#define BOOST_MATH_DIGITS10_POLICY 0
#endif
#ifndef BOOST_MATH_PROMOTE_FLOAT_POLICY
#define BOOST_MATH_PROMOTE_FLOAT_POLICY true
#endif
#ifndef BOOST_MATH_PROMOTE_DOUBLE_POLICY
#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
#define BOOST_MATH_PROMOTE_DOUBLE_POLICY false
#else
#define BOOST_MATH_PROMOTE_DOUBLE_POLICY true
#endif
#endif
#ifndef BOOST_MATH_DISCRETE_QUANTILE_POLICY
#define BOOST_MATH_DISCRETE_QUANTILE_POLICY integer_round_outwards
#endif
#ifndef BOOST_MATH_ASSERT_UNDEFINED_POLICY
#define BOOST_MATH_ASSERT_UNDEFINED_POLICY true
#endif
#ifndef BOOST_MATH_MAX_SERIES_ITERATION_POLICY
#define BOOST_MATH_MAX_SERIES_ITERATION_POLICY 1000000
#endif
#ifndef BOOST_MATH_MAX_ROOT_ITERATION_POLICY
#define BOOST_MATH_MAX_ROOT_ITERATION_POLICY 200
#endif
#if !defined(__BORLANDC__)
#define BOOST_MATH_META_INT(type, name, Default)\
template struct name : public boost::integral_constant{};\
namespace detail{\
template \
char test_is_valid_arg(const name*);\
char test_is_default_arg(const name*);\
template struct is_##name##_imp\
{\
template static char test(const name*);\
static double test(...);\
BOOST_STATIC_CONSTANT(bool, value = sizeof(test(static_cast(0))) == 1);\
};\
}\
template struct is_##name : public boost::integral_constant::value>{};
#define BOOST_MATH_META_BOOL(name, Default)\
template struct name : public boost::integral_constant{};\
namespace detail{\
template \
char test_is_valid_arg(const name*);\
char test_is_default_arg(const name*);\
template struct is_##name##_imp\
{\
template static char test(const name*);\
static double test(...);\
BOOST_STATIC_CONSTANT(bool, value = sizeof(test(static_cast(0))) == 1);\
};\
}\
template struct is_##name : public boost::integral_constant::value>{};
#else
#define BOOST_MATH_META_INT(Type, name, Default)\
template struct name : public boost::integral_constant{};\
namespace detail{\
template \
char test_is_valid_arg(const name*);\
char test_is_default_arg(const name*);\
template struct is_##name##_tester\
{\
template static char test(const name&);\
static double test(...);\
};\
template struct is_##name##_imp\
{\
static T inst;\
BOOST_STATIC_CONSTANT(bool, value = sizeof( ::boost::math::policies::detail::is_##name##_tester::test(inst)) == 1);\
};\
}\
template struct is_##name : public boost::integral_constant::value>\
{\
template struct apply{ typedef is_##name type; };\
};
#define BOOST_MATH_META_BOOL(name, Default)\
template struct name : public boost::integral_constant{};\
namespace detail{\
template \
char test_is_valid_arg(const name*);\
char test_is_default_arg(const name*);\
template struct is_##name##_tester\
{\
template static char test(const name&);\
static double test(...);\
};\
template struct is_##name##_imp\
{\
static T inst;\
BOOST_STATIC_CONSTANT(bool, value = sizeof( ::boost::math::policies::detail::is_##name##_tester::test(inst)) == 1);\
};\
}\
template struct is_##name : public boost::integral_constant::value>\
{\
template struct apply{ typedef is_##name type; };\
};
#endif
//
// Begin by defining policy types for error handling:
//
enum error_policy_type
{
throw_on_error = 0,
errno_on_error = 1,
ignore_error = 2,
user_error = 3
};
BOOST_MATH_META_INT(error_policy_type, domain_error, BOOST_MATH_DOMAIN_ERROR_POLICY)
BOOST_MATH_META_INT(error_policy_type, pole_error, BOOST_MATH_POLE_ERROR_POLICY)
BOOST_MATH_META_INT(error_policy_type, overflow_error, BOOST_MATH_OVERFLOW_ERROR_POLICY)
BOOST_MATH_META_INT(error_policy_type, underflow_error, BOOST_MATH_UNDERFLOW_ERROR_POLICY)
BOOST_MATH_META_INT(error_policy_type, denorm_error, BOOST_MATH_DENORM_ERROR_POLICY)
BOOST_MATH_META_INT(error_policy_type, evaluation_error, BOOST_MATH_EVALUATION_ERROR_POLICY)
BOOST_MATH_META_INT(error_policy_type, rounding_error, BOOST_MATH_ROUNDING_ERROR_POLICY)
BOOST_MATH_META_INT(error_policy_type, indeterminate_result_error, BOOST_MATH_INDETERMINATE_RESULT_ERROR_POLICY)
//
// Policy types for internal promotion:
//
BOOST_MATH_META_BOOL(promote_float, BOOST_MATH_PROMOTE_FLOAT_POLICY)
BOOST_MATH_META_BOOL(promote_double, BOOST_MATH_PROMOTE_DOUBLE_POLICY)
BOOST_MATH_META_BOOL(assert_undefined, BOOST_MATH_ASSERT_UNDEFINED_POLICY)
//
// Policy types for discrete quantiles:
//
enum discrete_quantile_policy_type
{
real,
integer_round_outwards,
integer_round_inwards,
integer_round_down,
integer_round_up,
integer_round_nearest
};
BOOST_MATH_META_INT(discrete_quantile_policy_type, discrete_quantile, BOOST_MATH_DISCRETE_QUANTILE_POLICY)
//
// Precision:
//
BOOST_MATH_META_INT(int, digits10, BOOST_MATH_DIGITS10_POLICY)
BOOST_MATH_META_INT(int, digits2, 0)
//
// Iterations:
//
BOOST_MATH_META_INT(unsigned long, max_series_iterations, BOOST_MATH_MAX_SERIES_ITERATION_POLICY)
BOOST_MATH_META_INT(unsigned long, max_root_iterations, BOOST_MATH_MAX_ROOT_ITERATION_POLICY)
//
// Define the names for each possible policy:
//
#define BOOST_MATH_PARAMETER(name)\
BOOST_PARAMETER_TEMPLATE_KEYWORD(name##_name)\
BOOST_PARAMETER_NAME(name##_name)
struct default_policy{};
namespace detail{
//
// Trait to work out bits precision from digits10 and digits2:
//
template
struct precision
{
//
// Now work out the precision:
//
typedef typename mpl::if_c<
(Digits10::value == 0),
digits2<0>,
digits2<((Digits10::value + 1) * 1000L) / 301L>
>::type digits2_type;
public:
#ifdef __BORLANDC__
typedef typename mpl::if_c<
(Digits2::value > ::boost::math::policies::detail::precision::digits2_type::value),
Digits2, digits2_type>::type type;
#else
typedef typename mpl::if_c<
(Digits2::value > digits2_type::value),
Digits2, digits2_type>::type type;
#endif
};
template
struct select_result
{
typedef A type;
};
template
struct select_result
{
typedef typename mpl::deref::type type;
};
template
struct find_arg
{
private:
typedef typename mpl::find_if::type iter;
typedef typename mpl::end::type end_type;
public:
typedef typename select_result<
DefaultType, iter,
::boost::is_same::value>::type type;
};
double test_is_valid_arg(...);
double test_is_default_arg(...);
char test_is_valid_arg(const default_policy*);
char test_is_default_arg(const default_policy*);
template
struct is_valid_policy_imp
{
BOOST_STATIC_CONSTANT(bool, value = sizeof(::boost::math::policies::detail::test_is_valid_arg(static_cast(0))) == 1);
};
template
struct is_default_policy_imp
{
BOOST_STATIC_CONSTANT(bool, value = sizeof(::boost::math::policies::detail::test_is_default_arg(static_cast(0))) == 1);
};
template struct is_valid_policy
: public boost::integral_constant::value>
{};
template struct is_default_policy
: public boost::integral_constant::value>
{
template
struct apply
{
typedef is_default_policy type;
};
};
template
struct append_N
{
typedef typename mpl::push_back::type new_seq;
typedef typename append_N::type type;
};
template
struct append_N
{
typedef Seq type;
};
//
// Traits class to work out what template parameters our default
// policy<> class will have when modified for forwarding:
//
template
struct default_args
{
typedef promote_float arg1;
typedef promote_double arg2;
};
template <>
struct default_args
{
typedef default_policy arg1;
typedef default_policy arg2;
};
template <>
struct default_args
{
typedef promote_float arg1;
typedef default_policy arg2;
};
template <>
struct default_args
{
typedef promote_double arg1;
typedef default_policy arg2;
};
typedef default_args::arg1 forwarding_arg1;
typedef default_args::arg2 forwarding_arg2;
} // detail
//
// Now define the policy type with enough arguments to handle all
// the policies:
//
template
struct policy
{
private:
//
// Validate all our arguments:
//
BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy::value);
BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy::value);
BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy::value);
BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy::value);
BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy::value);
BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy::value);
BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy::value);
BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy::value);
BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy::value);
BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy::value);
BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy::value);
BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy::value);
BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy::value);
//
// Typelist of the arguments:
//
typedef mpl::list arg_list;
public:
typedef typename detail::find_arg, domain_error<> >::type domain_error_type;
typedef typename detail::find_arg, pole_error<> >::type pole_error_type;
typedef typename detail::find_arg, overflow_error<> >::type overflow_error_type;
typedef typename detail::find_arg, underflow_error<> >::type underflow_error_type;
typedef typename detail::find_arg, denorm_error<> >::type denorm_error_type;
typedef typename detail::find_arg, evaluation_error<> >::type evaluation_error_type;
typedef typename detail::find_arg, rounding_error<> >::type rounding_error_type;
typedef typename detail::find_arg, indeterminate_result_error<> >::type indeterminate_result_error_type;
private:
//
// Now work out the precision:
//
typedef typename detail::find_arg, digits10<> >::type digits10_type;
typedef typename detail::find_arg, digits2<> >::type bits_precision_type;
public:
typedef typename detail::precision::type precision_type;
//
// Internal promotion:
//
typedef typename detail::find_arg, promote_float<> >::type promote_float_type;
typedef typename detail::find_arg, promote_double<> >::type promote_double_type;
//
// Discrete quantiles:
//
typedef typename detail::find_arg, discrete_quantile<> >::type discrete_quantile_type;
//
// Mathematically undefined properties:
//
typedef typename detail::find_arg, assert_undefined<> >::type assert_undefined_type;
//
// Max iterations:
//
typedef typename detail::find_arg, max_series_iterations<> >::type max_series_iterations_type;
typedef typename detail::find_arg, max_root_iterations<> >::type max_root_iterations_type;
};
//
// These full specializations are defined to reduce the amount of
// template instantiations that have to take place when using the default
// policies, they have quite a large impact on compile times:
//
template <>
struct policy
{
public:
typedef domain_error<> domain_error_type;
typedef pole_error<> pole_error_type;
typedef overflow_error<> overflow_error_type;
typedef underflow_error<> underflow_error_type;
typedef denorm_error<> denorm_error_type;
typedef evaluation_error<> evaluation_error_type;
typedef rounding_error<> rounding_error_type;
typedef indeterminate_result_error<> indeterminate_result_error_type;
#if BOOST_MATH_DIGITS10_POLICY == 0
typedef digits2<> precision_type;
#else
typedef detail::precision, digits2<> >::type precision_type;
#endif
typedef promote_float<> promote_float_type;
typedef promote_double<> promote_double_type;
typedef discrete_quantile<> discrete_quantile_type;
typedef assert_undefined<> assert_undefined_type;
typedef max_series_iterations<> max_series_iterations_type;
typedef max_root_iterations<> max_root_iterations_type;
};
template <>
struct policy
{
public:
typedef domain_error<> domain_error_type;
typedef pole_error<> pole_error_type;
typedef overflow_error<> overflow_error_type;
typedef underflow_error<> underflow_error_type;
typedef denorm_error<> denorm_error_type;
typedef evaluation_error<> evaluation_error_type;
typedef rounding_error<> rounding_error_type;
typedef indeterminate_result_error<> indeterminate_result_error_type;
#if BOOST_MATH_DIGITS10_POLICY == 0
typedef digits2<> precision_type;
#else
typedef detail::precision, digits2<> >::type precision_type;
#endif
typedef promote_float promote_float_type;
typedef promote_double promote_double_type;
typedef discrete_quantile<> discrete_quantile_type;
typedef assert_undefined<> assert_undefined_type;
typedef max_series_iterations<> max_series_iterations_type;
typedef max_root_iterations<> max_root_iterations_type;
};
template
struct normalise
{
private:
typedef mpl::list arg_list;
typedef typename detail::find_arg, typename Policy::domain_error_type >::type domain_error_type;
typedef typename detail::find_arg, typename Policy::pole_error_type >::type pole_error_type;
typedef typename detail::find_arg, typename Policy::overflow_error_type >::type overflow_error_type;
typedef typename detail::find_arg, typename Policy::underflow_error_type >::type underflow_error_type;
typedef typename detail::find_arg, typename Policy::denorm_error_type >::type denorm_error_type;
typedef typename detail::find_arg, typename Policy::evaluation_error_type >::type evaluation_error_type;
typedef typename detail::find_arg, typename Policy::rounding_error_type >::type rounding_error_type;
typedef typename detail::find_arg, typename Policy::indeterminate_result_error_type >::type indeterminate_result_error_type;
//
// Now work out the precision:
//
typedef typename detail::find_arg, digits10<> >::type digits10_type;
typedef typename detail::find_arg, typename Policy::precision_type >::type bits_precision_type;
typedef typename detail::precision::type precision_type;
//
// Internal promotion:
//
typedef typename detail::find_arg, typename Policy::promote_float_type >::type promote_float_type;
typedef typename detail::find_arg, typename Policy::promote_double_type >::type promote_double_type;
//
// Discrete quantiles:
//
typedef typename detail::find_arg, typename Policy::discrete_quantile_type >::type discrete_quantile_type;
//
// Mathematically undefined properties:
//
typedef typename detail::find_arg, typename Policy::assert_undefined_type >::type assert_undefined_type;
//
// Max iterations:
//
typedef typename detail::find_arg, typename Policy::max_series_iterations_type>::type max_series_iterations_type;
typedef typename detail::find_arg, typename Policy::max_root_iterations_type>::type max_root_iterations_type;
//
// Define a typelist of the policies:
//
typedef mpl::vector<
domain_error_type,
pole_error_type,
overflow_error_type,
underflow_error_type,
denorm_error_type,
evaluation_error_type,
rounding_error_type,
indeterminate_result_error_type,
precision_type,
promote_float_type,
promote_double_type,
discrete_quantile_type,
assert_undefined_type,
max_series_iterations_type,
max_root_iterations_type> result_list;
//
// Remove all the policies that are the same as the default:
//
typedef typename mpl::remove_if >::type reduced_list;
//
// Pad out the list with defaults:
//
typedef typename detail::append_N::value)>::type result_type;
public:
typedef policy<
typename mpl::at >::type,
typename mpl::at >::type,
typename mpl::at >::type,
typename mpl::at >::type,
typename mpl::at >::type,
typename mpl::at >::type,
typename mpl::at >::type,
typename mpl::at >::type,
typename mpl::at >::type,
typename mpl::at >::type,
typename mpl::at >::type,
typename mpl::at >::type,
typename mpl::at >::type > type;
};
//
// Full specialisation to speed up compilation of the common case:
//
template <>
struct normalise,
promote_float,
promote_double,
discrete_quantile<>,
assert_undefined<>,
default_policy,
default_policy,
default_policy,
default_policy,
default_policy,
default_policy,
default_policy>
{
typedef policy type;
};
template <>
struct normalise,
promote_float,
promote_double,
discrete_quantile<>,
assert_undefined<>,
default_policy,
default_policy,
default_policy,
default_policy,
default_policy,
default_policy,
default_policy>
{
typedef policy type;
};
inline BOOST_MATH_CONSTEXPR policy<> make_policy() BOOST_NOEXCEPT
{ return policy<>(); }
template
inline BOOST_MATH_CONSTEXPR typename normalise, A1>::type make_policy(const A1&) BOOST_NOEXCEPT
{
typedef typename normalise, A1>::type result_type;
return result_type();
}
template
inline BOOST_MATH_CONSTEXPR typename normalise, A1, A2>::type make_policy(const A1&, const A2&) BOOST_NOEXCEPT
{
typedef typename normalise, A1, A2>::type result_type;
return result_type();
}
template
inline BOOST_MATH_CONSTEXPR typename normalise, A1, A2, A3>::type make_policy(const A1&, const A2&, const A3&) BOOST_NOEXCEPT
{
typedef typename normalise, A1, A2, A3>::type result_type;
return result_type();
}
template
inline BOOST_MATH_CONSTEXPR typename normalise, A1, A2, A3, A4>::type make_policy(const A1&, const A2&, const A3&, const A4&) BOOST_NOEXCEPT
{
typedef typename normalise, A1, A2, A3, A4>::type result_type;
return result_type();
}
template
inline BOOST_MATH_CONSTEXPR typename normalise, A1, A2, A3, A4, A5>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&) BOOST_NOEXCEPT
{
typedef typename normalise, A1, A2, A3, A4, A5>::type result_type;
return result_type();
}
template
inline BOOST_MATH_CONSTEXPR typename normalise, A1, A2, A3, A4, A5, A6>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&) BOOST_NOEXCEPT
{
typedef typename normalise, A1, A2, A3, A4, A5, A6>::type result_type;
return result_type();
}
template
inline BOOST_MATH_CONSTEXPR typename normalise, A1, A2, A3, A4, A5, A6, A7>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&) BOOST_NOEXCEPT
{
typedef typename normalise, A1, A2, A3, A4, A5, A6, A7>::type result_type;
return result_type();
}
template
inline BOOST_MATH_CONSTEXPR typename normalise, A1, A2, A3, A4, A5, A6, A7, A8>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&) BOOST_NOEXCEPT
{
typedef typename normalise, A1, A2, A3, A4, A5, A6, A7, A8>::type result_type;
return result_type();
}
template
inline BOOST_MATH_CONSTEXPR typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&, const A9&) BOOST_NOEXCEPT
{
typedef typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9>::type result_type;
return result_type();
}
template
inline BOOST_MATH_CONSTEXPR typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&, const A9&, const A10&) BOOST_NOEXCEPT
{
typedef typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>::type result_type;
return result_type();
}
template
inline BOOST_MATH_CONSTEXPR typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&, const A9&, const A10&, const A11&) BOOST_NOEXCEPT
{
typedef typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>::type result_type;
return result_type();
}
//
// Traits class to handle internal promotion:
//
template
struct evaluation
{
typedef Real type;
};
template
struct evaluation
{
typedef typename mpl::if_::type type;
};
template
struct evaluation
{
typedef typename mpl::if_::type type;
};
#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
template
struct basic_digits : public boost::integral_constant{ };
template <>
struct basic_digits : public boost::integral_constant{ };
template <>
struct basic_digits : public boost::integral_constant{ };
template <>
struct basic_digits : public boost::integral_constant{ };
template
struct precision
{
BOOST_STATIC_ASSERT( ::std::numeric_limits::radix == 2);
typedef typename Policy::precision_type precision_type;
typedef basic_digits digits_t;
typedef typename mpl::if_<
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;
};
template
struct precision
{
typedef digits2 type;
};
template
struct precision
{
typedef digits2 type;
};
template
struct precision
{
typedef digits2 type;
};
#else
template
struct precision
{
BOOST_STATIC_ASSERT((::std::numeric_limits::radix == 2) || ((::std::numeric_limits::is_specialized == 0) || (::std::numeric_limits