policy_ref_snip10.cpp 910 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. // Note that this file contains quickbook mark-up as well as code
  7. // and comments, don't change any of the special comment mark-ups!
  8. // Setting precision in a single function call using make_policy.
  9. #include <iostream>
  10. using std::cout; using std::endl;
  11. //[policy_ref_snip10
  12. #include <boost/math/special_functions/gamma.hpp>
  13. using boost::math::tgamma;
  14. using namespace boost::math::policies;
  15. double t = tgamma(12, policy<digits10<5> >()); // Concise make_policy.
  16. //] //[/policy_ref_snip10]
  17. int main()
  18. {
  19. cout << "tgamma(12, policy<digits10<5> >()) = "<< t << endl;
  20. }
  21. /*
  22. Output:
  23. tgamma(12, policy<digits10<5> >()) = 3.99168e+007
  24. */