]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/example/policy_ref_snip11.cpp
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)
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!
11 using std::cout
; using std::endl
;
13 // Setting (approximate) precision 25 bits in a single function call using make_policy.
17 #include <boost/math/distributions/normal.hpp>
18 using boost::math::normal_distribution
;
20 using namespace boost::math::policies
;
22 const int bits
= 25; // approximate precision.
25 normal_distribution
<double, policy
<digits2
<bits
> > >(),
26 0.05); // 5% quantile.
28 //] //[/policy_ref_snip11]
32 std::streamsize p
= 2 + (bits
* 30103UL) / 100000UL;
33 // Approximate number of significant decimal digits for 25 bits.
35 cout
<< bits
<< " binary bits is approoximately equivalent to " << p
<< " decimal digits " << endl
;
36 cout
<< "quantile(normal_distribution<double, policy<digits2<25> > >(), 0.05 = "
37 << q
<< endl
; // -1.64485
42 25 binary bits is approoximately equivalent to 9 decimal digits
43 quantile(normal_distribution<double, policy<digits2<25> > >(), 0.05 = -1.64485363