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 #include <iostream>
11 using std::cout; using std::endl;
12
13 //[policy_ref_snip2
14
15 #include <boost/math/distributions/normal.hpp>
16 using boost::math::normal_distribution;
17
18 using namespace boost::math::policies;
19
20 // Define a specific policy:
21 typedef policy<
22 overflow_error<ignore_error>
23 > my_policy;
24
25 // Define the distribution, using my_policy:
26 typedef normal_distribution<double, my_policy> my_norm;
27
28 // Construct a my_norm distribution, using default mean and standard deviation,
29 // and get a 0.05 or 5% quantile:
30 double q = quantile(my_norm(), 0.05); // = -1.64485
31
32 //] //[/policy_ref_snip2]
33
main()34 int main()
35 {
36 my_norm n; // Construct a my_norm distribution,
37 // using default mean zero and standard deviation unity.
38 double q = quantile(n, 0.05); // and get a quantile.
39 cout << "quantile(my_norm(), 0.05) = " << q << endl;
40 }
41
42 /*
43
44 Output:
45
46 quantile(my_norm(), 0.05) = -1.64485
47 */
48