1 //  Copyright John Maddock 2007.
2 //  Copyright Paul A. Bristow 2010
3 //  Use, modification and distribution are subject to the
4 //  Boost Software License, Version 1.0. (See accompanying file
5 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 
7 // Note that this file contains quickbook mark-up as well as code
8 // and comments, don't change any of the special comment mark-ups!
9 
10 double some_value = 2.;
11 
12 //[policy_ref_snip3
13 
14 #include <boost/math/special_functions/gamma.hpp>
15 
16 using namespace boost::math::policies;
17 using boost::math::tgamma;
18 
19 // Define a new policy *not* internally promoting RealType to double:
20 typedef policy<
21       promote_double<false>
22       > my_policy;
23 
24 // Call the function, applying the new policy:
25 double t1 = tgamma(some_value, my_policy());
26 
27 // Alternatively we could use helper function make_policy,
28 // and concisely define everything at the call site:
29 double t2 = tgamma(some_value, make_policy(promote_double<false>()));
30 
31 //] //[\policy_ref_snip3]
32 
33 #include <iostream>
34 using std::cout;  using std::endl;
35 
main()36 int main()
37 {
38    cout << "tgamma(some_value, my_policy()) = " << t1
39      << ", tgamma(some_value, make_policy(promote_double<false>()) = " << t2 << endl;
40 }
41