1 // Copyright John Maddock 2008. 2 // Use, modification and distribution are subject to the 3 // Boost Software License, Version 1.0. (See accompanying file 4 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 // 6 #include <boost/math/policies/policy.hpp> 7 #include <boost/math/special_functions/math_fwd.hpp> 8 9 namespace boost{ namespace math{ namespace policies{ 10 11 template <> 12 struct policy< 13 domain_error<errno_on_error>, 14 pole_error<errno_on_error>, 15 overflow_error<errno_on_error>, 16 evaluation_error<errno_on_error>, 17 rounding_error<errno_on_error>, 18 default_policy, default_policy, default_policy, default_policy, default_policy, default_policy> 19 { 20 public: 21 typedef domain_error<errno_on_error> domain_error_type; 22 typedef pole_error<errno_on_error> pole_error_type; 23 typedef overflow_error<errno_on_error> overflow_error_type; 24 typedef underflow_error<errno_on_error> underflow_error_type; 25 typedef denorm_error<errno_on_error> denorm_error_type; 26 typedef evaluation_error<errno_on_error> evaluation_error_type; 27 typedef rounding_error<errno_on_error> rounding_error_type; 28 typedef indeterminate_result_error<> indeterminate_result_error_type; 29 #if BOOST_MATH_DIGITS10_POLICY == 0 30 typedef digits2<> precision_type; 31 #else 32 typedef detail::precision<digits10<>, digits2<> >::type precision_type; 33 #endif 34 typedef promote_float<> promote_float_type; 35 typedef promote_double<> promote_double_type; 36 typedef discrete_quantile<> discrete_quantile_type; 37 typedef assert_undefined<> assert_undefined_type; 38 typedef max_series_iterations<> max_series_iterations_type; 39 typedef max_root_iterations<> max_root_iterations_type; 40 }; 41 42 template <> 43 struct policy< 44 domain_error<errno_on_error>, 45 pole_error<errno_on_error>, 46 overflow_error<errno_on_error>, 47 evaluation_error<errno_on_error>, 48 rounding_error<errno_on_error>, 49 detail::forwarding_arg1, 50 detail::forwarding_arg2, 51 default_policy, default_policy, default_policy, default_policy, default_policy, default_policy> 52 { 53 public: 54 typedef domain_error<errno_on_error> domain_error_type; 55 typedef pole_error<errno_on_error> pole_error_type; 56 typedef overflow_error<errno_on_error> overflow_error_type; 57 typedef underflow_error<errno_on_error> underflow_error_type; 58 typedef denorm_error<errno_on_error> denorm_error_type; 59 typedef evaluation_error<errno_on_error> evaluation_error_type; 60 typedef rounding_error<errno_on_error> rounding_error_type; 61 typedef indeterminate_result_error<> indeterminate_result_error_type; 62 #if BOOST_MATH_DIGITS10_POLICY == 0 63 typedef digits2<> precision_type; 64 #else 65 typedef detail::precision<digits10<>, digits2<> >::type precision_type; 66 #endif 67 typedef promote_float<false> promote_float_type; 68 typedef promote_double<false> promote_double_type; 69 typedef discrete_quantile<> discrete_quantile_type; 70 typedef assert_undefined<> assert_undefined_type; 71 typedef max_series_iterations<> max_series_iterations_type; 72 typedef max_root_iterations<> max_root_iterations_type; 73 }; 74 75 template <> 76 struct normalise<policy<domain_error<errno_on_error>, pole_error<errno_on_error>, overflow_error<errno_on_error>, evaluation_error<errno_on_error>, rounding_error<errno_on_error> >, 77 promote_float<false>, 78 promote_double<false>, 79 discrete_quantile<>, 80 assert_undefined<>, 81 default_policy, 82 default_policy, 83 default_policy, 84 default_policy, 85 default_policy, 86 default_policy, 87 default_policy> 88 { 89 typedef policy<domain_error<errno_on_error>, pole_error<errno_on_error>, overflow_error<errno_on_error>, evaluation_error<errno_on_error>, rounding_error<errno_on_error>, detail::forwarding_arg1, detail::forwarding_arg2> type; 90 }; 91 92 template <> 93 struct normalise<policy<domain_error<errno_on_error>, pole_error<errno_on_error>, overflow_error<errno_on_error>, evaluation_error<errno_on_error>, rounding_error<errno_on_error>, detail::forwarding_arg1, detail::forwarding_arg2 >, 94 promote_float<false>, 95 promote_double<false>, 96 discrete_quantile<>, 97 assert_undefined<>, 98 default_policy, 99 default_policy, 100 default_policy, 101 default_policy, 102 default_policy, 103 default_policy, 104 default_policy> 105 { 106 typedef policy<domain_error<errno_on_error>, pole_error<errno_on_error>, overflow_error<errno_on_error>, evaluation_error<errno_on_error>, rounding_error<errno_on_error>, detail::forwarding_arg1, detail::forwarding_arg2> type; 107 }; 108 109 }}} // namespaces 110 111 namespace c_policies{ 112 113 using boost::math::policies::policy; 114 using boost::math::policies::errno_on_error; 115 using boost::math::policies::domain_error; 116 using boost::math::policies::pole_error; 117 using boost::math::policies::overflow_error; 118 using boost::math::policies::rounding_error; 119 using boost::math::policies::evaluation_error; 120 121 typedef policy< 122 domain_error<errno_on_error>, 123 pole_error<errno_on_error>, 124 overflow_error<errno_on_error>, 125 evaluation_error<errno_on_error>, 126 rounding_error<errno_on_error> 127 > c_policy; 128 129 BOOST_MATH_DECLARE_SPECIAL_FUNCTIONS(c_policy) 130 131 } 132