]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/example/policy_ref_snip9.cpp
1 // Copyright John Maddock 2007.
2 // Copyright Paul A. Bristow 2010
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)
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!
12 using std::cout
; using std::endl
;
16 #include <boost/math/special_functions/gamma.hpp>
17 using boost::math::tgamma
;
18 using boost::math::policies::policy
;
19 using boost::math::policies::digits10
;
21 typedef policy
<digits10
<5> > my_pol_5
; // Define a new, non-default, policy
22 // to calculate tgamma to accuracy of approximately 5 decimal digits.
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
;
35 tgamma(12, my_pol_5() = 3.9917e+007