Subject: [Boost-bugs] [Boost C++ Libraries] #9183: quantile for poisson distribution - precision issue?
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-09-30 17:59:52
#9183: quantile for poisson distribution - precision issue?
------------------------------+-------------------------
Reporter: tan@⦠| Owner: johnmaddock
Type: Support Requests | Status: new
Milestone: To Be Determined | Component: math
Version: Boost 1.54.0 | Severity: Showstopper
Keywords: |
------------------------------+-------------------------
The following (there are others) returns an "unexpected" result:
#define BOOST_MATH_DISCRETE_QUANTILE_POLICY integer_round_up
// #define BOOST_MATH_DISCRETE_QUANTILE_POLICY real
#include <cstdlib>
#include <cstdio>
#include <boost/math/distributions/poisson.hpp>
int main()
{
double m=54.3;
double x=66.0;
boost::math::poisson_distribution<> dist( m );
std::printf(
"\nqpois(ppois(66,54.3),54.3) = %d\n\n",
boost::math::quantile(
dist,
boost::math::cdf( dist, x ) ) );
return 0
}
The "expected" answer is 66 but 67 is being returned.
I am aware of Ticket 8308 (https://svn.boost.org/trac/boost/ticket/8308).
I do not think R is "rounding to the nearest", and as far as I am aware,
it has been consistent with
quantile(p)=infimum {x|cdf(x)>=p}
which is what "we" needed/expected.
If we change the policy to give real output---on my Ubuntu 12.04 (Intel
14.0 C++ with g++ 4.7.3), the result is 6.600000000000001e+01. So I
wonder if this is just a (finite) precision/rounding issue ... in that it
is really 66 to some "fuzz".
I have (also) tried this with revision 86054 of the trunk.
Thank you!
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9183> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:14 UTC