]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/math/example/policy_ref_snip9.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / math / example / policy_ref_snip9.cpp
CommitLineData
7c673cae
FG
1// Copyright John Maddock 2007.
2// Copyright Paul A. Bristow 2010
3
4// Use, modification and distribution are subject to the
5// Boost Software License, Version 1.0. (See accompanying file
6// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7
8// Note that this file contains quickbook mark-up as well as code
9// and comments, don't change any of the special comment mark-ups!
10
11#include <iostream>
12using std::cout; using std::endl;
13
14//[policy_ref_snip9
15
16#include <boost/math/special_functions/gamma.hpp>
17using boost::math::tgamma;
18using boost::math::policies::policy;
19using boost::math::policies::digits10;
20
21typedef policy<digits10<5> > my_pol_5; // Define a new, non-default, policy
22// to calculate tgamma to accuracy of approximately 5 decimal digits.
23//]
24
25int main()
26{
27 cout.precision(5); // To only show 5 (hopefully) accurate decimal digits.
28 double t = tgamma(12, my_pol_5()); // Apply the 5 decimal digits accuracy policy to use of tgamma.
29 cout << "tgamma(12, my_pol_5() = " << t << endl;
30}
31
32/*
33
34Output:
35 tgamma(12, my_pol_5() = 3.9917e+007
36*/