1 #ifndef STAN_MATH_PRIM_FUN_BOOST_POLICY_HPP
2 #define STAN_MATH_PRIM_FUN_BOOST_POLICY_HPP
3 
4 #include <stan/math/prim/meta.hpp>
5 #include <boost/math/policies/policy.hpp>
6 
7 namespace stan {
8 namespace math {
9 
10 /**
11  * Boost policy that overrides the defaults to match the built-in
12  * C++ standard library functions.
13  *
14  * The non-default behavior from Boost's built-ins are
15  * (1) overflow errors return error numbers on error.
16  * (2) pole errors return error numbers on error.
17  * (3) doubles passed to Boost are not promoted to long double.
18  *
19  * The policy is equipped with an optional generic argument B controlling the
20  * precision in some functions. If set to 0, the maximum precision available
21  * in the type being used is demanded from Boost. Otherwise, it correspond to
22  * the approximately B-bit precision, i.e. for trading speed for accuracy.
23  */
24 template <int B = 0>
25 using boost_policy_t = boost::math::policies::policy<
26     boost::math::policies::overflow_error<
27         boost::math::policies::errno_on_error>,
28     boost::math::policies::pole_error<boost::math::policies::errno_on_error>,
29     boost::math::policies::promote_double<false>,
30     boost::math::policies::digits2<B>>;
31 }  // namespace math
32 }  // namespace stan
33 #endif
34