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 //[policy_ref_snip7
11 
12 #include <boost/math/distributions/negative_binomial.hpp>
13 using boost::math::negative_binomial_distribution;
14 
15 using namespace boost::math::policies;
16 
17 typedef negative_binomial_distribution<
18       double,
19       policy<discrete_quantile<integer_round_inwards> >
20    > dist_type;
21 
22 // Lower quantile rounded up:
23 double x = quantile(dist_type(20, 0.3), 0.05); // 28 rounded up from 27.3898
24 // Upper quantile rounded down:
25 double y = quantile(complement(dist_type(20, 0.3), 0.05)); // 68 rounded down from 68.1584
26 
27 //] //[/policy_ref_snip7]
28 
29 #include <iostream>
30 using std::cout; using std::endl;
31 
main()32 int main()
33 {
34    cout << "using policy<discrete_quantile<integer_round_inwards> > " << endl
35    << "quantile(dist_type(20, 0.3), 0.05) = " << x << endl
36    << "quantile(complement(dist_type(20, 0.3), 0.05)) =  " << y << endl;
37 }
38 
39 /*
40 
41 Output:
42   using policy<discrete_quantile<integer_round_inwards> >
43   quantile(dist_type(20, 0.3), 0.05) = 28
44   quantile(complement(dist_type(20, 0.3), 0.05)) =  68
45 
46 
47 */
48 
49