Boost logo

Boost-Commit :

From: john_at_[hidden]
Date: 2007-08-12 05:24:11


Author: johnmaddock
Date: 2007-08-12 05:24:08 EDT (Sun, 12 Aug 2007)
New Revision: 38609
URL: http://svn.boost.org/trac/boost/changeset/38609

Log:
Changed the name of some of the discrete quantile policies, and more or less finished the policy tutorial.
Added:
   sandbox/math_toolkit/libs/math/example/policy_eg_10.cpp (contents, props changed)
Text files modified:
   sandbox/math_toolkit/boost/math/concepts/real_concept.hpp | 10 +-
   sandbox/math_toolkit/boost/math/distributions/detail/inv_discrete_quantile.hpp | 10 +-
   sandbox/math_toolkit/boost/math/distributions/poisson.hpp | 10 +-
   sandbox/math_toolkit/boost/math/policy/policy.hpp | 12 +-
   sandbox/math_toolkit/boost/math/tools/user.hpp | 2
   sandbox/math_toolkit/libs/math/doc/policy.qbk | 30 +++---
   sandbox/math_toolkit/libs/math/doc/policy_tutorial.qbk | 163 +++++++++++++++++++++++++++++++++++++++
   sandbox/math_toolkit/libs/math/example/Jamfile.v2 | 2
   sandbox/math_toolkit/libs/math/example/policy_eg_3.cpp | 2
   sandbox/math_toolkit/libs/math/example/policy_eg_6.cpp | 2
   sandbox/math_toolkit/libs/math/example/policy_eg_7.cpp | 2
   sandbox/math_toolkit/libs/math/example/policy_ref_snip5.cpp | 2
   sandbox/math_toolkit/libs/math/example/policy_ref_snip7.cpp | 2
   sandbox/math_toolkit/libs/math/example/policy_ref_snip8.cpp | 2
   sandbox/math_toolkit/libs/math/test/test_binomial.cpp | 10 +-
   sandbox/math_toolkit/libs/math/test/test_negative_binomial.cpp | 10 +-
   sandbox/math_toolkit/libs/math/test/test_poisson.cpp | 10 +-
   sandbox/math_toolkit/libs/math/test/test_policy.cpp | 82 ++++++++++----------
   18 files changed, 263 insertions(+), 100 deletions(-)

Modified: sandbox/math_toolkit/boost/math/concepts/real_concept.hpp
==============================================================================
--- sandbox/math_toolkit/boost/math/concepts/real_concept.hpp (original)
+++ sandbox/math_toolkit/boost/math/concepts/real_concept.hpp 2007-08-12 05:24:08 EDT (Sun, 12 Aug 2007)
@@ -348,23 +348,23 @@
 { return digits<concepts::real_concept, policy<> >(); }
 
 template <>
-inline int digits<concepts::real_concept, policy<discrete_quantile<integer_below> > >(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
+inline int digits<concepts::real_concept, policy<discrete_quantile<integer_round_down> > >(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
 { return digits<concepts::real_concept, policy<> >(); }
 
 template <>
-inline int digits<concepts::real_concept, policy<discrete_quantile<integer_above> > >(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
+inline int digits<concepts::real_concept, policy<discrete_quantile<integer_round_up> > >(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
 { return digits<concepts::real_concept, policy<> >(); }
 
 template <>
-inline int digits<concepts::real_concept, policy<discrete_quantile<integer_outside> > >(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
+inline int digits<concepts::real_concept, policy<discrete_quantile<integer_round_outwards> > >(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
 { return digits<concepts::real_concept, policy<> >(); }
 
 template <>
-inline int digits<concepts::real_concept, policy<discrete_quantile<integer_inside> > >(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
+inline int digits<concepts::real_concept, policy<discrete_quantile<integer_round_inwards> > >(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
 { return digits<concepts::real_concept, policy<> >(); }
 
 template <>
-inline int digits<concepts::real_concept, policy<discrete_quantile<integer_nearest> > >(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
+inline int digits<concepts::real_concept, policy<discrete_quantile<integer_round_nearest> > >(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
 { return digits<concepts::real_concept, policy<> >(); }
 
 }

Modified: sandbox/math_toolkit/boost/math/distributions/detail/inv_discrete_quantile.hpp
==============================================================================
--- sandbox/math_toolkit/boost/math/distributions/detail/inv_discrete_quantile.hpp (original)
+++ sandbox/math_toolkit/boost/math/distributions/detail/inv_discrete_quantile.hpp 2007-08-12 05:24:08 EDT (Sun, 12 Aug 2007)
@@ -314,7 +314,7 @@
       const typename Dist::value_type& guess,
       const typename Dist::value_type& multiplier,
       const typename Dist::value_type& adder,
- const policies::discrete_quantile<policies::integer_outside>&,
+ const policies::discrete_quantile<policies::integer_round_outwards>&,
       boost::uintmax_t& max_iter)
 {
    typedef typename Dist::value_type value_type;
@@ -356,7 +356,7 @@
       const typename Dist::value_type& guess,
       const typename Dist::value_type& multiplier,
       const typename Dist::value_type& adder,
- const policies::discrete_quantile<policies::integer_inside>&,
+ const policies::discrete_quantile<policies::integer_round_inwards>&,
       boost::uintmax_t& max_iter)
 {
    typedef typename Dist::value_type value_type;
@@ -398,7 +398,7 @@
       const typename Dist::value_type& guess,
       const typename Dist::value_type& multiplier,
       const typename Dist::value_type& adder,
- const policies::discrete_quantile<policies::integer_below>&,
+ const policies::discrete_quantile<policies::integer_round_down>&,
       boost::uintmax_t& max_iter)
 {
    typedef typename Dist::value_type value_type;
@@ -425,7 +425,7 @@
       const typename Dist::value_type& guess,
       const typename Dist::value_type& multiplier,
       const typename Dist::value_type& adder,
- const policies::discrete_quantile<policies::integer_above>&,
+ const policies::discrete_quantile<policies::integer_round_up>&,
       boost::uintmax_t& max_iter)
 {
    using namespace std;
@@ -451,7 +451,7 @@
       const typename Dist::value_type& guess,
       const typename Dist::value_type& multiplier,
       const typename Dist::value_type& adder,
- const policies::discrete_quantile<policies::integer_nearest>&,
+ const policies::discrete_quantile<policies::integer_round_nearest>&,
       boost::uintmax_t& max_iter)
 {
    typedef typename Dist::value_type value_type;

Modified: sandbox/math_toolkit/boost/math/distributions/poisson.hpp
==============================================================================
--- sandbox/math_toolkit/boost/math/distributions/poisson.hpp (original)
+++ sandbox/math_toolkit/boost/math/distributions/poisson.hpp 2007-08-12 05:24:08 EDT (Sun, 12 Aug 2007)
@@ -60,7 +60,7 @@
             const typename Dist::value_type& guess,
             const typename Dist::value_type& multiplier,
             const typename Dist::value_type& adder,
- const policies::discrete_quantile<policies::integer_nearest>&,
+ const policies::discrete_quantile<policies::integer_round_nearest>&,
             boost::uintmax_t& max_iter);
       template <class Dist>
       inline typename Dist::value_type
@@ -70,7 +70,7 @@
             const typename Dist::value_type& guess,
             const typename Dist::value_type& multiplier,
             const typename Dist::value_type& adder,
- const policies::discrete_quantile<policies::integer_above>&,
+ const policies::discrete_quantile<policies::integer_round_up>&,
             boost::uintmax_t& max_iter);
       template <class Dist>
       inline typename Dist::value_type
@@ -80,7 +80,7 @@
             const typename Dist::value_type& guess,
             const typename Dist::value_type& multiplier,
             const typename Dist::value_type& adder,
- const policies::discrete_quantile<policies::integer_below>&,
+ const policies::discrete_quantile<policies::integer_round_down>&,
             boost::uintmax_t& max_iter);
       template <class Dist>
       inline typename Dist::value_type
@@ -90,7 +90,7 @@
             const typename Dist::value_type& guess,
             const typename Dist::value_type& multiplier,
             const typename Dist::value_type& adder,
- const policies::discrete_quantile<policies::integer_outside>&,
+ const policies::discrete_quantile<policies::integer_round_outwards>&,
             boost::uintmax_t& max_iter);
       template <class Dist>
       inline typename Dist::value_type
@@ -100,7 +100,7 @@
             const typename Dist::value_type& guess,
             const typename Dist::value_type& multiplier,
             const typename Dist::value_type& adder,
- const policies::discrete_quantile<policies::integer_inside>&,
+ const policies::discrete_quantile<policies::integer_round_inwards>&,
             boost::uintmax_t& max_iter);
       template <class Dist>
       inline typename Dist::value_type

Modified: sandbox/math_toolkit/boost/math/policy/policy.hpp
==============================================================================
--- sandbox/math_toolkit/boost/math/policy/policy.hpp (original)
+++ sandbox/math_toolkit/boost/math/policy/policy.hpp 2007-08-12 05:24:08 EDT (Sun, 12 Aug 2007)
@@ -59,7 +59,7 @@
 #endif
 #endif
 #ifndef BOOST_MATH_DISCRETE_QUANTILE_POLICY
-#define BOOST_MATH_DISCRETE_QUANTILE_POLICY integer_outside
+#define BOOST_MATH_DISCRETE_QUANTILE_POLICY integer_round_outwards
 #endif
 #ifndef BOOST_MATH_ASSERT_UNDEFINED_POLICY
 #define BOOST_MATH_ASSERT_UNDEFINED_POLICY true
@@ -170,11 +170,11 @@
 enum discrete_quantile_policy_type
 {
    real,
- integer_outside,
- integer_inside,
- integer_below,
- integer_above,
- integer_nearest
+ integer_round_outwards,
+ integer_round_inwards,
+ integer_round_down,
+ integer_round_up,
+ integer_round_nearest
 };
 
 BOOST_MATH_META_INT(discrete_quantile_policy_type, discrete_quantile, BOOST_MATH_DISCRETE_QUANTILE_POLICY);

Modified: sandbox/math_toolkit/boost/math/tools/user.hpp
==============================================================================
--- sandbox/math_toolkit/boost/math/tools/user.hpp (original)
+++ sandbox/math_toolkit/boost/math/tools/user.hpp 2007-08-12 05:24:08 EDT (Sun, 12 Aug 2007)
@@ -77,7 +77,7 @@
 //
 // What do discrete quantiles return?
 //
-// #define BOOST_MATH_DISCRETE_QUANTILE_POLICY integer_outside
+// #define BOOST_MATH_DISCRETE_QUANTILE_POLICY integer_round_outwards
 //
 // If a function is mathematically undefined
 // (for example the Cauchy distribution has no mean),

Modified: sandbox/math_toolkit/libs/math/doc/policy.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/policy.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/policy.qbk 2007-08-12 05:24:08 EDT (Sun, 12 Aug 2007)
@@ -257,7 +257,7 @@
 Suppose we want `tgamma` to be evaluated without internal promotion to
 `long double`, then we could use:
 
-[import policy_ref_snip3]
+[import ../example/policy_ref_snip3.cpp]
 
 [policy_ref_snip3]
    
@@ -327,11 +327,11 @@
    enum discrete_quantile_policy_type
    {
       real,
- integer_outside,
- integer_inside,
- integer_below,
- integer_above,
- integer_nearest
+ integer_round_outwards,
+ integer_round_inwards,
+ integer_round_down,
+ integer_round_up,
+ integer_round_nearest
    };
    
    template <discrete_quantile_policy_type>
@@ -350,7 +350,7 @@
    
 Results in `x = 27.3898` and `y = 68.1584`.
 
-[h5 integer_outside]
+[h5 integer_round_outwards]
 
 This is the default policy: an integer value is returned so that:
 
@@ -376,9 +376,9 @@
 In other words we guarantee ['at least 90% coverage in the central region overall],
 and also ['no more than 5% coverage in each tail].
 
-[h5 integer_inside]
+[h5 integer_round_inwards]
 
-This is the opposite of ['integer_outside]: an integer value is returned so that:
+This is the opposite of ['integer_round_outwards]: an integer value is returned so that:
 
 * Lower quantiles (where the probability is less than 0.5) are rounded
 ['up].
@@ -400,17 +400,17 @@
 In other words we guarantee ['at no more than 90% coverage in the central region overall],
 and also ['at least 5% coverage in each tail].
 
-[h5 integer_below]
+[h5 integer_round_down]
 
 Always rounds down to an integer value, no matter whether it's an upper
 or a lower quantile.
 
-[h5 integer_above]
+[h5 integer_round_up]
 
 Always rounds up to an integer value, no matter whether it's an upper
 or a lower quantile.
 
-[h5 integer_nearest]
+[h5 integer_round_nearest]
 
 Always rounds to the nearest integer value, no matter whether it's an upper
 or a lower quantile. This will produce the requested coverage
@@ -562,9 +562,9 @@
 
 Determines how discrete quantiles return their results: either
 as an integer, or as a real value, can be set to one of the
-enumerated values: `real`, `integer_outside`, `integer_inside`,
-`integer_below`, `integer_above`, `integer_nearest`. Defaults to
-`integer_outside`.
+enumerated values: `real`, `integer_round_outwards`, `integer_round_inwards`,
+`integer_round_down`, `integer_round_up`, `integer_round_nearest`. Defaults to
+`integer_round_outwards`.
 
 [h5 BOOST_MATH_ASSERT_UNDEFINED_POLICY]
 

Modified: sandbox/math_toolkit/libs/math/doc/policy_tutorial.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/policy_tutorial.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/policy_tutorial.qbk 2007-08-12 05:24:08 EDT (Sun, 12 Aug 2007)
@@ -51,7 +51,9 @@
 [[Precision of Approximation Used][By default uses an approximation that
    will result in the lowest level of error for the type of the result.]]
 [[Behaviour of Discrete Quantiles][Returns an integer result that is rounded
- down for lower quantiles and rounded up for upper quantiles - see TODO LINK HERE!!]]
+ down for lower quantiles and rounded up for upper quantiles - see
+ [link math_toolkit.policy.pol_tutorial.understand_dis_quant the tutorial
+ on discrete distribution quantiles.]]]
 ]
 
 What's more, if you define your own policy type, then it automatically
@@ -292,6 +294,165 @@
 
 [endsect]
 
+[section:understand_dis_quant Understanding Quantiles of Discrete Distributions]
+
+Discrete distributions present us with a problem when calculating the
+quantile: we are starting from a continuous real-valued variable - the
+probability - but the result (the value of the random variable)
+should really be discrete.
+
+Consider for example a Binomial distribution, with a sample size of
+50, and a success fraction of 0.5. There are a variety of ways
+we can plot a discrete distribution, but if we plot the PDF
+as a step-function then it looks something like this:
+
+[$../graphs/binomial_pdf.png]
+
+Now lets suppose that the user asks for a the quantile that corresponds
+to a probability of 0.05, if we zoom in on the CDF for that region here's
+what we see:
+
+[$../graphs/binomial_quantile_1.png]
+
+As can be seen there is no random variable that corresponds to
+a probability of exactly 0.05, so we're left with two choices as
+shown in the figure:
+
+* We could round the result down to 18.
+* We could round the result up to 19.
+
+In fact there's actually a third choice as well: we could "pretend" that the
+distribution was continuous and return a real valued result: in this case we
+would calculate a result of approximately 18.701 (this accurately
+reflects the fact that the result is nearer to 19 than 18).
+
+By using policies we can offer any of the above as options, but that
+still leaves the question: ['What is actually the right thing to do?]
+
+And in particular: ['What policy should we use by default?]
+
+In coming to an answer we should realise that:
+
+* Calculating an integer result is often much faster than
+calculating a real-valued result: in fact in our tests it
+was up to 20 times faster.
+* Normally people calculate quantiles so that they can perform
+a test of some kind: ['"If the random variable is less than N
+then we can reject our null-hypothesis with 90% confidence."]
+
+So there is a genuine benefit to calculating an integer result
+as well as it being "the right thing to do" from a philosophical
+point of view. What's more if someone asks for a quantile at 0.05,
+then we can normally assume that they are asking for
+['[*at least] 95% of the probability to the right of the value chosen,
+and [*no more than] 5% of the probability to the left of the value chosen.]
+
+In the above binomial example we would therefore round the result down to 18.
+
+The converse applies to upper-quantiles: If the probability is greater than
+0.5 we would want to round the quantile up, ['so that [*at least] the requested
+probability is to the left of the value returned, and [*no more than] 1 - the
+requested probability is to the right of the value returned.]
+
+Likewise for two-sided intervals, we would round lower quantiles down,
+and upper quantiles up. This ensures that we have ['at least the requested
+probability in the central region] and ['no more than 1 minus the requested
+probability in the tail areas.]
+
+For example, taking our 50 sample binomial distribution with a success fraction
+of 0.5, if we wanted a two sided 90% confidence interval, then we would ask
+for the 0.05 and 0.95 quantiles with the results ['rounded outwards] so that
+['at least 90% of the probability] is in the central area:
+
+[$../graphs/binomial_pdf_3.png]
+
+So far so good, but there is in fact a trap waiting for the unwary here:
+
+ quantile(binomial(50, 0.5), 0.05);
+
+returns 18 as the result, which is what we would expect from the graph above,
+and indeed there is no x greater than 18 for which:
+
+ cdf(binomial(50, 0.5), x) <= 0.05;
+
+However:
+
+ quantile(binomial(50, 0.5), 0.95);
+
+returns 31, and indeed while there is no x less than 31 for which:
+
+ cdf(binomial(50, 0.5), x) >= 0.95;
+
+We might naively expect that for this symmetrical distribution the result
+would be 32 (since 32 = 50 - 18), but we need to remember that the cdf of
+the binomial is /inclusive/ of the random variable. So while the left tail
+area /includes/ the quantile returned, the right tail area always excludes
+an upper quantile value: since that "belongs" to the central area.
+
+Look at the graph above to see what's going on here: the lower quantile
+of 18 belongs to the left tail, so any value <= 18 is in the left tail.
+The upper quantile of 31 on the other hand belongs to the central area,
+so the tail area actually starts at 32, so any value > 31 is in the
+right tail.
+
+Therefore if U and L are the upper and lower quantiles respectively, then
+a random variable X is in the tail area - where we would reject the null
+hypothesis if:
+
+ X <= L || X > U
+
+And the a variable X is inside the central region if:
+
+ L < X <= U
+
+The moral here is to ['always be very careful with your comparisons
+when dealing with a discrete distribution], and if in doubt,
+['base your comparisons on CDF's instead].
+
+[heading Other Rounding Policies are Available]
+
+As you would expect from a section on policies, you won't be surprised
+to know that other rounding options are available:
+
+[variablelist
+
+[[integer_round_outwards]
+ [This is the default policy as described above: lower quantiles
+ are rounded down (probability < 0.5), and upper quantiles
+ (probability > 0.5) are rounded up.
+
+ This gives /no more than/ the requested probability
+ in the tails, and /at least/ the requested probability
+ in the central area.]]
+[[integer_round_inwards]
+ [This is the exact opposite of the default policy:
+ lower quantiles
+ are rounded up (probability < 0.5),
+ and upper quantiles (probability > 0.5) are rounded down.
+
+ This gives /at least/ the requested probability
+ in the tails, and /no more than/ the requested probability
+ in the central area.]]
+[[integer_round_down][This policy will always round the result down
+ no matter whether it is an upper or lower quantile]]
+[[integer_round_up][This policy will always round the result up
+ no matter whether it is an upper or lower quantile]]
+[[integer_round_nearest][This policy will always round the result
+ to the nearest integer
+ no matter whether it is an upper or lower quantile]]
+[[real][This policy will return a real valued result
+ for the quantile of a discrete distribution: this is
+ generally much slower than finding an integer result
+ but does allow for more sophisticated rounding policies.]]
+
+]
+
+[import ../example/policy_eg_10.cpp]
+
+[policy_eg_10]
+
+[endsect]
+
 [endsect][/section:pol_Tutorial Policy Tutorial]
 
 

Modified: sandbox/math_toolkit/libs/math/example/Jamfile.v2
==============================================================================
--- sandbox/math_toolkit/libs/math/example/Jamfile.v2 (original)
+++ sandbox/math_toolkit/libs/math/example/Jamfile.v2 2007-08-12 05:24:08 EDT (Sun, 12 Aug 2007)
@@ -49,6 +49,7 @@
 run policy_eg_7.cpp ;
 run policy_eg_8.cpp ;
 run policy_eg_9.cpp ;
+run policy_eg_10.cpp ;
 run policy_ref_snip1.cpp ;
 run policy_ref_snip10.cpp ;
 run policy_ref_snip11.cpp ;
@@ -71,3 +72,4 @@
 
 
 
+

Added: sandbox/math_toolkit/libs/math/example/policy_eg_10.cpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/libs/math/example/policy_eg_10.cpp 2007-08-12 05:24:08 EDT (Sun, 12 Aug 2007)
@@ -0,0 +1,171 @@
+// Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+// Note that this file contains quickbook mark-up as well as code
+// and comments, don't change any of the special comment mark-ups!
+
+//[policy_eg_10
+
+/*`
+
+To understand how the rounding policies for
+the discrete distributions can be used, we'll
+use the 50-sample binomial distribution with a
+success fraction of 0.5 once again, and calculate
+all the possible quantiles at 0.05 and 0.95.
+
+Begin by including the needed headers:
+
+*/
+
+#include <iostream>
+#include <boost/math/distributions/binomial.hpp>
+
+/*`
+
+Next we'll bring the needed declarations into scope, and
+define distribution types for all the available rounding policies:
+
+*/
+
+using namespace boost::math::policies;
+using namespace boost::math;
+
+typedef binomial_distribution<
+ double,
+ policy<discrete_quantile<integer_round_outwards> > >
+ binom_round_outwards;
+
+typedef binomial_distribution<
+ double,
+ policy<discrete_quantile<integer_round_inwards> > >
+ binom_round_inwards;
+
+typedef binomial_distribution<
+ double,
+ policy<discrete_quantile<integer_round_down> > >
+ binom_round_down;
+
+typedef binomial_distribution<
+ double,
+ policy<discrete_quantile<integer_round_up> > >
+ binom_round_up;
+
+typedef binomial_distribution<
+ double,
+ policy<discrete_quantile<integer_round_nearest> > >
+ binom_round_nearest;
+
+typedef binomial_distribution<
+ double,
+ policy<discrete_quantile<real> > >
+ binom_real_quantile;
+
+/*`
+
+Now let's set to work calling those quantiles:
+
+*/
+
+int main()
+{
+ std::cout <<
+ "Testing rounding policies for a 50 sample binomial distribution,\n"
+ "with a success fraction of 0.5.\n\n"
+ "Lower quantiles are calculated at p = 0.05\n\n"
+ "Upper quantiles at p = 0.95.\n\n";
+
+ std::cout << std::setw(25) << std::right
+ << "Policy"<< std::setw(18) << std::right
+ << "Lower Quantile" << std::setw(18) << std::right
+ << "Upper Quantile" << std::endl;
+
+ // Test integer_round_outwards:
+ std::cout << std::setw(25) << std::right
+ << "integer_round_outwards"
+ << std::setw(18) << std::right
+ << quantile(binom_round_outwards(50, 0.5), 0.05)
+ << std::setw(18) << std::right
+ << quantile(binom_round_outwards(50, 0.5), 0.95)
+ << std::endl;
+
+ // Test integer_round_inwards:
+ std::cout << std::setw(25) << std::right
+ << "integer_round_inwards"
+ << std::setw(18) << std::right
+ << quantile(binom_round_inwards(50, 0.5), 0.05)
+ << std::setw(18) << std::right
+ << quantile(binom_round_inwards(50, 0.5), 0.95)
+ << std::endl;
+
+ // Test integer_round_down:
+ std::cout << std::setw(25) << std::right
+ << "integer_round_down"
+ << std::setw(18) << std::right
+ << quantile(binom_round_down(50, 0.5), 0.05)
+ << std::setw(18) << std::right
+ << quantile(binom_round_down(50, 0.5), 0.95)
+ << std::endl;
+
+ // Test integer_round_up:
+ std::cout << std::setw(25) << std::right
+ << "integer_round_up"
+ << std::setw(18) << std::right
+ << quantile(binom_round_up(50, 0.5), 0.05)
+ << std::setw(18) << std::right
+ << quantile(binom_round_up(50, 0.5), 0.95)
+ << std::endl;
+
+ // Test integer_round_nearest:
+ std::cout << std::setw(25) << std::right
+ << "integer_round_nearest"
+ << std::setw(18) << std::right
+ << quantile(binom_round_nearest(50, 0.5), 0.05)
+ << std::setw(18) << std::right
+ << quantile(binom_round_nearest(50, 0.5), 0.95)
+ << std::endl;
+
+ // Test real:
+ std::cout << std::setw(25) << std::right
+ << "real"
+ << std::setw(18) << std::right
+ << quantile(binom_real_quantile(50, 0.5), 0.05)
+ << std::setw(18) << std::right
+ << quantile(binom_real_quantile(50, 0.5), 0.95)
+ << std::endl;
+}
+
+/*`
+
+Which produces the program output:
+
+[pre
+Testing rounding policies for a 50 sample binomial distribution,
+with a success fraction of 0.5.
+
+Lower quantiles are calculated at p = 0.05
+
+Upper quantiles at p = 0.95.
+
+Testing rounding policies for a 50 sample binomial distribution,
+with a success fraction of 0.5.
+
+Lower quantiles are calculated at p = 0.05
+
+Upper quantiles at p = 0.95.
+
+ Policy Lower Quantile Upper Quantile
+ integer_round_outwards 18 31
+ integer_round_inwards 19 30
+ integer_round_down 18 30
+ integer_round_up 19 31
+ integer_round_nearest 19 30
+ real 18.701 30.299
+]
+
+*/
+
+//] ends quickbook import
+

Modified: sandbox/math_toolkit/libs/math/example/policy_eg_3.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/example/policy_eg_3.cpp (original)
+++ sandbox/math_toolkit/libs/math/example/policy_eg_3.cpp 2007-08-12 05:24:08 EDT (Sun, 12 Aug 2007)
@@ -16,7 +16,7 @@
 using namespace boost::math::policies;
 typedef policy<
    promote_float<false>,
- discrete_quantile<integer_nearest>
+ discrete_quantile<integer_round_nearest>
> mypolicy;
 //
 // Then define a distribution that uses it:

Modified: sandbox/math_toolkit/libs/math/example/policy_eg_6.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/example/policy_eg_6.cpp (original)
+++ sandbox/math_toolkit/libs/math/example/policy_eg_6.cpp 2007-08-12 05:24:08 EDT (Sun, 12 Aug 2007)
@@ -41,7 +41,7 @@
    // Don't promote double -> long double internally:
    promote_double<false>,
    // Return the closest integer result for discrete quantiles:
- discrete_quantile<integer_nearest>
+ discrete_quantile<integer_round_nearest>
> my_policy;
 
 /*`

Modified: sandbox/math_toolkit/libs/math/example/policy_eg_7.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/example/policy_eg_7.cpp (original)
+++ sandbox/math_toolkit/libs/math/example/policy_eg_7.cpp 2007-08-12 05:24:08 EDT (Sun, 12 Aug 2007)
@@ -22,7 +22,7 @@
    // Don't promote double -> long double internally:
    promote_double<false>,
    // Return the closest integer result for discrete quantiles:
- discrete_quantile<integer_nearest>
+ discrete_quantile<integer_round_nearest>
> my_policy;
 
 BOOST_MATH_DECLARE_DISTRIBUTIONS(double, my_policy)

Modified: sandbox/math_toolkit/libs/math/example/policy_ref_snip5.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/example/policy_ref_snip5.cpp (original)
+++ sandbox/math_toolkit/libs/math/example/policy_ref_snip5.cpp 2007-08-12 05:24:08 EDT (Sun, 12 Aug 2007)
@@ -15,7 +15,7 @@
 
 typedef negative_binomial_distribution<
       double,
- policy<discrete_quantile<integer_inside> >
+ policy<discrete_quantile<integer_round_inwards> >
> dist_type;
    
 // Lower quantile:

Modified: sandbox/math_toolkit/libs/math/example/policy_ref_snip7.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/example/policy_ref_snip7.cpp (original)
+++ sandbox/math_toolkit/libs/math/example/policy_ref_snip7.cpp 2007-08-12 05:24:08 EDT (Sun, 12 Aug 2007)
@@ -15,7 +15,7 @@
 
 typedef negative_binomial_distribution<
       double,
- policy<discrete_quantile<integer_inside> >
+ policy<discrete_quantile<integer_round_inwards> >
> dist_type;
    
 // Lower quantile rounded up:

Modified: sandbox/math_toolkit/libs/math/example/policy_ref_snip8.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/example/policy_ref_snip8.cpp (original)
+++ sandbox/math_toolkit/libs/math/example/policy_ref_snip8.cpp 2007-08-12 05:24:08 EDT (Sun, 12 Aug 2007)
@@ -15,7 +15,7 @@
 
 typedef negative_binomial_distribution<
       double,
- policy<discrete_quantile<integer_nearest> >
+ policy<discrete_quantile<integer_round_nearest> >
> dist_type;
    
 // Lower quantile rounded up:

Modified: sandbox/math_toolkit/libs/math/test/test_binomial.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/test/test_binomial.cpp (original)
+++ sandbox/math_toolkit/libs/math/test/test_binomial.cpp 2007-08-12 05:24:08 EDT (Sun, 12 Aug 2007)
@@ -623,11 +623,11 @@
   {
      using namespace boost::math::policies;
      typedef policy<discrete_quantile<boost::math::policies::real> > P1;
- typedef policy<discrete_quantile<integer_below> > P2;
- typedef policy<discrete_quantile<integer_above> > P3;
- typedef policy<discrete_quantile<integer_outside> > P4;
- typedef policy<discrete_quantile<integer_inside> > P5;
- typedef policy<discrete_quantile<integer_nearest> > P6;
+ typedef policy<discrete_quantile<integer_round_down> > P2;
+ typedef policy<discrete_quantile<integer_round_up> > P3;
+ typedef policy<discrete_quantile<integer_round_outwards> > P4;
+ typedef policy<discrete_quantile<integer_round_inwards> > P5;
+ typedef policy<discrete_quantile<integer_round_nearest> > P6;
      RealType tol = boost::math::tools::epsilon<RealType>() * 500;
      if(!boost::is_floating_point<RealType>::value)
         tol *= 10; // no lanczos approximation implies less accuracy

Modified: sandbox/math_toolkit/libs/math/test/test_negative_binomial.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/test/test_negative_binomial.cpp (original)
+++ sandbox/math_toolkit/libs/math/test/test_negative_binomial.cpp 2007-08-12 05:24:08 EDT (Sun, 12 Aug 2007)
@@ -721,11 +721,11 @@
   {
      using namespace boost::math::policies;
      typedef policy<discrete_quantile<boost::math::policies::real> > P1;
- typedef policy<discrete_quantile<integer_below> > P2;
- typedef policy<discrete_quantile<integer_above> > P3;
- typedef policy<discrete_quantile<integer_outside> > P4;
- typedef policy<discrete_quantile<integer_inside> > P5;
- typedef policy<discrete_quantile<integer_nearest> > P6;
+ typedef policy<discrete_quantile<integer_round_down> > P2;
+ typedef policy<discrete_quantile<integer_round_up> > P3;
+ typedef policy<discrete_quantile<integer_round_outwards> > P4;
+ typedef policy<discrete_quantile<integer_round_inwards> > P5;
+ typedef policy<discrete_quantile<integer_round_nearest> > P6;
      RealType tol = boost::math::tools::epsilon<RealType>() * 700;
      if(!boost::is_floating_point<RealType>::value)
         tol *= 10; // no lanczos approximation implies less accuracy

Modified: sandbox/math_toolkit/libs/math/test/test_poisson.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/test/test_poisson.cpp (original)
+++ sandbox/math_toolkit/libs/math/test/test_poisson.cpp 2007-08-12 05:24:08 EDT (Sun, 12 Aug 2007)
@@ -420,11 +420,11 @@
   {
      using namespace boost::math::policies;
      typedef policy<discrete_quantile<real> > P1;
- typedef policy<discrete_quantile<integer_below> > P2;
- typedef policy<discrete_quantile<integer_above> > P3;
- typedef policy<discrete_quantile<integer_outside> > P4;
- typedef policy<discrete_quantile<integer_inside> > P5;
- typedef policy<discrete_quantile<integer_nearest> > P6;
+ typedef policy<discrete_quantile<integer_round_down> > P2;
+ typedef policy<discrete_quantile<integer_round_up> > P3;
+ typedef policy<discrete_quantile<integer_round_outwards> > P4;
+ typedef policy<discrete_quantile<integer_round_inwards> > P5;
+ typedef policy<discrete_quantile<integer_round_nearest> > P6;
      RealType tol = boost::math::tools::epsilon<RealType>() * 20;
      if(!boost::is_floating_point<RealType>::value)
         tol *= 7;

Modified: sandbox/math_toolkit/libs/math/test/test_policy.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/test/test_policy.cpp (original)
+++ sandbox/math_toolkit/libs/math/test/test_policy.cpp 2007-08-12 05:24:08 EDT (Sun, 12 Aug 2007)
@@ -135,16 +135,16 @@
    BOOST_CHECK((is_same<policy<promote_double<false> >::promote_double_type, promote_double<false> >::value));
    BOOST_CHECK((is_same<policy<promote_double<false> >::discrete_quantile_type, policy<>::discrete_quantile_type>::value));
    
- BOOST_CHECK((is_same<policy<discrete_quantile<integer_above> >::domain_error_type, policy<>::domain_error_type >::value));
- BOOST_CHECK((is_same<policy<discrete_quantile<integer_above> >::pole_error_type, policy<>::pole_error_type >::value));
- BOOST_CHECK((is_same<policy<discrete_quantile<integer_above> >::overflow_error_type, policy<>::overflow_error_type >::value));
- BOOST_CHECK((is_same<policy<discrete_quantile<integer_above> >::underflow_error_type, policy<>::underflow_error_type >::value));
- BOOST_CHECK((is_same<policy<discrete_quantile<integer_above> >::denorm_error_type, policy<>::denorm_error_type >::value));
- BOOST_CHECK((is_same<policy<discrete_quantile<integer_above> >::evaluation_error_type, policy<>::evaluation_error_type >::value));
- BOOST_CHECK((is_same<policy<discrete_quantile<integer_above> >::precision_type, policy<>::precision_type >::value));
- BOOST_CHECK((is_same<policy<discrete_quantile<integer_above> >::promote_float_type, policy<>::promote_float_type>::value));
- BOOST_CHECK((is_same<policy<discrete_quantile<integer_above> >::promote_double_type, policy<>::promote_double_type>::value));
- BOOST_CHECK((is_same<policy<discrete_quantile<integer_above> >::discrete_quantile_type, discrete_quantile<integer_above> >::value));
+ BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::domain_error_type, policy<>::domain_error_type >::value));
+ BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::pole_error_type, policy<>::pole_error_type >::value));
+ BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::overflow_error_type, policy<>::overflow_error_type >::value));
+ BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::underflow_error_type, policy<>::underflow_error_type >::value));
+ BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::denorm_error_type, policy<>::denorm_error_type >::value));
+ BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::evaluation_error_type, policy<>::evaluation_error_type >::value));
+ BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::precision_type, policy<>::precision_type >::value));
+ BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::promote_float_type, policy<>::promote_float_type>::value));
+ BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::promote_double_type, policy<>::promote_double_type>::value));
+ BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::discrete_quantile_type, discrete_quantile<integer_round_up> >::value));
 
    //
    // Now try again with 2 policies:
@@ -171,38 +171,38 @@
    BOOST_CHECK((is_same<policy<denorm_error<throw_on_error>, domain_error<ignore_error> >::promote_double_type, policy<>::promote_double_type>::value));
    BOOST_CHECK((is_same<policy<denorm_error<throw_on_error>, domain_error<ignore_error> >::discrete_quantile_type, policy<>::discrete_quantile_type>::value));
    
- BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> >::domain_error_type, domain_error<ignore_error> >::value));
- BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> >::pole_error_type, pole_error<BOOST_MATH_POLE_ERROR_POLICY> >::value));
- BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> >::overflow_error_type, overflow_error<BOOST_MATH_OVERFLOW_ERROR_POLICY> >::value));
- BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> >::underflow_error_type, underflow_error<BOOST_MATH_UNDERFLOW_ERROR_POLICY> >::value));
- BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> >::denorm_error_type, denorm_error<throw_on_error> >::value));
- BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> >::evaluation_error_type, evaluation_error<BOOST_MATH_EVALUATION_ERROR_POLICY> >::value));
- BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> >::precision_type, digits2<20> >::value));
- BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> >::promote_float_type, promote_float<false> >::value));
- BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> >::promote_double_type, policy<>::promote_double_type>::value));
- BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> >::discrete_quantile_type, discrete_quantile<integer_below> >::value));
+ BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::domain_error_type, domain_error<ignore_error> >::value));
+ BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::pole_error_type, pole_error<BOOST_MATH_POLE_ERROR_POLICY> >::value));
+ BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::overflow_error_type, overflow_error<BOOST_MATH_OVERFLOW_ERROR_POLICY> >::value));
+ BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::underflow_error_type, underflow_error<BOOST_MATH_UNDERFLOW_ERROR_POLICY> >::value));
+ BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::denorm_error_type, denorm_error<throw_on_error> >::value));
+ BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::evaluation_error_type, evaluation_error<BOOST_MATH_EVALUATION_ERROR_POLICY> >::value));
+ BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::precision_type, digits2<20> >::value));
+ BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::promote_float_type, promote_float<false> >::value));
+ BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::promote_double_type, policy<>::promote_double_type>::value));
+ BOOST_CHECK((is_same<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::discrete_quantile_type, discrete_quantile<integer_round_down> >::value));
    
- BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::domain_error_type, domain_error<ignore_error> >::value));
- BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::pole_error_type, pole_error<BOOST_MATH_POLE_ERROR_POLICY> >::value));
- BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::overflow_error_type, overflow_error<BOOST_MATH_OVERFLOW_ERROR_POLICY> >::value));
- BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::underflow_error_type, underflow_error<BOOST_MATH_UNDERFLOW_ERROR_POLICY> >::value));
- BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::denorm_error_type, denorm_error<throw_on_error> >::value));
- BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::evaluation_error_type, evaluation_error<BOOST_MATH_EVALUATION_ERROR_POLICY> >::value));
- BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::precision_type, digits2<20> >::value));
- BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::promote_float_type, promote_float<false> >::value));
- BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::promote_double_type, policy<>::promote_double_type>::value));
- BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::discrete_quantile_type, discrete_quantile<integer_below> >::value));
+ BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::domain_error_type, domain_error<ignore_error> >::value));
+ BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::pole_error_type, pole_error<BOOST_MATH_POLE_ERROR_POLICY> >::value));
+ BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::overflow_error_type, overflow_error<BOOST_MATH_OVERFLOW_ERROR_POLICY> >::value));
+ BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::underflow_error_type, underflow_error<BOOST_MATH_UNDERFLOW_ERROR_POLICY> >::value));
+ BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::denorm_error_type, denorm_error<throw_on_error> >::value));
+ BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::evaluation_error_type, evaluation_error<BOOST_MATH_EVALUATION_ERROR_POLICY> >::value));
+ BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::precision_type, digits2<20> >::value));
+ BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::promote_float_type, promote_float<false> >::value));
+ BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::promote_double_type, policy<>::promote_double_type>::value));
+ BOOST_CHECK((is_same<normalise<policy<digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> > >::type::discrete_quantile_type, discrete_quantile<integer_round_down> >::value));
    
- BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::domain_error_type, domain_error<ignore_error> >::value));
- BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::pole_error_type, pole_error<BOOST_MATH_POLE_ERROR_POLICY> >::value));
- BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::overflow_error_type, overflow_error<BOOST_MATH_OVERFLOW_ERROR_POLICY> >::value));
- BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::underflow_error_type, underflow_error<BOOST_MATH_UNDERFLOW_ERROR_POLICY> >::value));
- BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::denorm_error_type, denorm_error<throw_on_error> >::value));
- BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::evaluation_error_type, evaluation_error<BOOST_MATH_EVALUATION_ERROR_POLICY> >::value));
- BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::precision_type, digits2<20> >::value));
- BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::promote_float_type, promote_float<false> >::value));
- BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::promote_double_type, policy<>::promote_double_type>::value));
- BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_below>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::discrete_quantile_type, discrete_quantile<integer_below> >::value));
+ BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::domain_error_type, domain_error<ignore_error> >::value));
+ BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::pole_error_type, pole_error<BOOST_MATH_POLE_ERROR_POLICY> >::value));
+ BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::overflow_error_type, overflow_error<BOOST_MATH_OVERFLOW_ERROR_POLICY> >::value));
+ BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::underflow_error_type, underflow_error<BOOST_MATH_UNDERFLOW_ERROR_POLICY> >::value));
+ BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::denorm_error_type, denorm_error<throw_on_error> >::value));
+ BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::evaluation_error_type, evaluation_error<BOOST_MATH_EVALUATION_ERROR_POLICY> >::value));
+ BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::precision_type, digits2<20> >::value));
+ BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::promote_float_type, promote_float<false> >::value));
+ BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::promote_double_type, policy<>::promote_double_type>::value));
+ BOOST_CHECK((is_same<normalise<policy<>, digits2<20>, promote_float<false>, discrete_quantile<integer_round_down>, denorm_error<throw_on_error>, domain_error<ignore_error> >::type::discrete_quantile_type, discrete_quantile<integer_round_down> >::value));
 
    BOOST_CHECK(check_same(make_policy(), policy<>()));
    BOOST_CHECK(check_same(make_policy(denorm_error<ignore_error>()), normalise<policy<denorm_error<ignore_error> > >::type()));
@@ -221,7 +221,7 @@
    BOOST_CHECK(check_same(make_policy(domain_error<ignore_error>(), pole_error<ignore_error>(), overflow_error<ignore_error>(), underflow_error<throw_on_error>(), denorm_error<throw_on_error>(), evaluation_error<ignore_error>(), digits10<5>()), policy<domain_error<ignore_error>, pole_error<ignore_error>, overflow_error<ignore_error>, underflow_error<throw_on_error>, denorm_error<throw_on_error>, evaluation_error<ignore_error>, digits2<19> >()));
    BOOST_CHECK(check_same(make_policy(domain_error<ignore_error>(), pole_error<ignore_error>(), overflow_error<ignore_error>(), underflow_error<throw_on_error>(), denorm_error<throw_on_error>(), evaluation_error<ignore_error>(), digits2<10>(), promote_float<false>()), policy<domain_error<ignore_error>, pole_error<ignore_error>, overflow_error<ignore_error>, underflow_error<throw_on_error>, denorm_error<throw_on_error>, evaluation_error<ignore_error>, digits2<10>, promote_float<false> >()));
    BOOST_CHECK(check_same(make_policy(domain_error<ignore_error>(), pole_error<ignore_error>(), overflow_error<ignore_error>(), underflow_error<throw_on_error>(), denorm_error<throw_on_error>(), evaluation_error<ignore_error>(), digits2<10>(), promote_float<false>(), promote_double<false>()), policy<domain_error<ignore_error>, pole_error<ignore_error>, overflow_error<ignore_error>, underflow_error<throw_on_error>, denorm_error<throw_on_error>, evaluation_error<ignore_error>, digits2<10>, promote_float<false>, promote_double<false> >()));
- BOOST_CHECK(check_same(make_policy(domain_error<ignore_error>(), pole_error<ignore_error>(), overflow_error<ignore_error>(), underflow_error<throw_on_error>(), denorm_error<throw_on_error>(), evaluation_error<ignore_error>(), digits2<10>(), promote_float<false>(), promote_double<false>(), discrete_quantile<integer_below>()), policy<domain_error<ignore_error>, pole_error<ignore_error>, overflow_error<ignore_error>, underflow_error<throw_on_error>, denorm_error<throw_on_error>, evaluation_error<ignore_error>, digits2<10>, promote_float<false>, promote_double<false>, discrete_quantile<integer_below> >()));
+ BOOST_CHECK(check_same(make_policy(domain_error<ignore_error>(), pole_error<ignore_error>(), overflow_error<ignore_error>(), underflow_error<throw_on_error>(), denorm_error<throw_on_error>(), evaluation_error<ignore_error>(), digits2<10>(), promote_float<false>(), promote_double<false>(), discrete_quantile<integer_round_down>()), policy<domain_error<ignore_error>, pole_error<ignore_error>, overflow_error<ignore_error>, underflow_error<throw_on_error>, denorm_error<throw_on_error>, evaluation_error<ignore_error>, digits2<10>, promote_float<false>, promote_double<false>, discrete_quantile<integer_round_down> >()));
 
    return 0;
 } // int test_main(int, char* [])


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk