]> git.donarmstrong.com Git - rsem.git/blobdiff - boost/math/policies/policy.hpp
Updated boost to v1.55.0
[rsem.git] / boost / math / policies / policy.hpp
index b66cd7f9239b05097b5552627ad29fb2d4660641..24334c7d0457810edbf30ed1b18015736241c68c 100644 (file)
@@ -431,7 +431,7 @@ public:
    //
    // Mathematically undefined properties:
    //
-   typedef typename detail::find_arg<arg_list, is_assert_undefined<mpl::_1>, discrete_quantile<> >::type assert_undefined_type;
+   typedef typename detail::find_arg<arg_list, is_assert_undefined<mpl::_1>, assert_undefined<> >::type assert_undefined_type;
    //
    // Max iterations:
    //
@@ -537,12 +537,12 @@ private:
    //
    // Mathematically undefined properties:
    //
-   typedef typename detail::find_arg<arg_list, is_assert_undefined<mpl::_1>, discrete_quantile<> >::type assert_undefined_type;
+   typedef typename detail::find_arg<arg_list, is_assert_undefined<mpl::_1>, typename Policy::assert_undefined_type >::type assert_undefined_type;
    //
    // Max iterations:
    //
-   typedef typename detail::find_arg<arg_list, is_max_series_iterations<mpl::_1>, max_series_iterations<> >::type max_series_iterations_type;
-   typedef typename detail::find_arg<arg_list, is_max_root_iterations<mpl::_1>, max_root_iterations<> >::type max_root_iterations_type;
+   typedef typename detail::find_arg<arg_list, is_max_series_iterations<mpl::_1>, typename Policy::max_series_iterations_type>::type max_series_iterations_type;
+   typedef typename detail::find_arg<arg_list, is_max_root_iterations<mpl::_1>, typename Policy::max_root_iterations_type>::type max_root_iterations_type;
    //
    // Define a typelist of the policies:
    //
@@ -738,6 +738,7 @@ struct basic_digits<long double> : public mpl::int_<LDBL_MANT_DIG>{ };
 template <class Real, class Policy>
 struct precision
 {
+   BOOST_STATIC_ASSERT( ::std::numeric_limits<Real>::radix == 2);
    typedef typename Policy::precision_type precision_type;
    typedef basic_digits<Real> digits_t;
    typedef typename mpl::if_<
@@ -775,6 +776,7 @@ struct precision<long double, Policy>
 template <class Real, class Policy>
 struct precision
 {
+   BOOST_STATIC_ASSERT((::std::numeric_limits<Real>::radix == 2) || ((::std::numeric_limits<Real>::is_specialized == 0) || (::std::numeric_limits<Real>::digits == 0)));
 #ifndef __BORLANDC__
    typedef typename Policy::precision_type precision_type;
    typedef typename mpl::if_c<
@@ -811,6 +813,16 @@ struct precision
 
 #endif
 
+#ifdef BOOST_MATH_USE_FLOAT128
+
+template <class Policy>
+struct precision<__float128, Policy>
+{
+   typedef mpl::int_<113> type;
+};
+
+#endif
+
 namespace detail{
 
 template <class T, class Policy>
@@ -896,8 +908,10 @@ inline T get_epsilon_imp(mpl::true_ const&)
 {
 #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
    BOOST_STATIC_ASSERT( ::std::numeric_limits<T>::is_specialized);
+   BOOST_STATIC_ASSERT( ::std::numeric_limits<T>::radix == 2);
 #else
    BOOST_ASSERT(::std::numeric_limits<T>::is_specialized);
+   BOOST_ASSERT(::std::numeric_limits<T>::radix == 2);
 #endif
    typedef typename boost::math::policies::precision<T, Policy>::type p_t;
    typedef mpl::bool_<p_t::value <= std::numeric_limits<boost::uintmax_t>::digits> is_small_int;
@@ -916,7 +930,7 @@ inline T get_epsilon_imp(mpl::false_ const&)
 template <class T, class Policy>
 inline T get_epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T))
 {
-   typedef mpl::bool_< std::numeric_limits<T>::is_specialized > tag_type;
+   typedef mpl::bool_< (std::numeric_limits<T>::is_specialized && (std::numeric_limits<T>::radix == 2)) > tag_type;
    return detail::get_epsilon_imp<T, Policy>(tag_type());
 }
 
@@ -947,6 +961,29 @@ struct is_policy_imp
 template <class P>
 struct is_policy : public mpl::bool_< ::boost::math::policies::detail::is_policy_imp<P>::value> {};
 
+//
+// Helper traits class for distribution error handling:
+//
+template <class Policy>
+struct constructor_error_check
+{
+   typedef typename Policy::domain_error_type domain_error_type;
+   typedef typename mpl::if_c<
+      (domain_error_type::value == throw_on_error) || (domain_error_type::value == user_error),
+      mpl::true_,
+      mpl::false_>::type type;
+};
+
+template <class Policy>
+struct method_error_check
+{
+   typedef typename Policy::domain_error_type domain_error_type;
+   typedef typename mpl::if_c<
+      (domain_error_type::value == throw_on_error) && (domain_error_type::value != user_error),
+      mpl::false_,
+      mpl::true_>::type type;
+};
+
 }}} // namespaces
 
 #endif // BOOST_MATH_POLICY_HPP