#9833 closed Bugs (fixed)
"leaking exception" (eg. geometric distribution)
| Reported by: | Owned by: | John Maddock | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | math |
| Version: | Boost Development Trunk | Severity: | Showstopper |
| Keywords: | Cc: |
Description
Sorry to label this outright as a "bug" ... it might just be my misunderstanding.
Consider the code included below ... please save it as-is as test.cpp and build it with: g++ -o test test.cpp. Then uncomment the #define USE_CONFIG_FILE on the first line and repeat the above process to see the issue.
Thank you.
HS
// #define USE_CONFIG_FILE 1
#ifdef USE_CONFIG_FILE
#include <boost/math/distributions.hpp>
#include <boost/math/policies/policy.hpp>
namespace test
{
using namespace boost::math::policies;
typedef policy<
domain_error< ignore_error >,
overflow_error< ignore_error >,
discrete_quantile< integer_round_up >
> my_boost_policy;
BOOST_MATH_DECLARE_DISTRIBUTIONS( double, my_boost_policy );
}
#else
#define BOOST_MATH_DOMAIN_ERROR_POLICY ignore_error
#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error
#define BOOST_MATH_DISCRETE_QUANTILE_POLICY integer_round_up
#endif
#include <cstdlib>
#include <cstdio>
#include <boost/math/distributions/geometric.hpp>
int main()
{
double _p0 = 1.0;
double _x = 0.0;
#ifdef USE_CONFIG_FILE
test::geometric _dist( _p0 );
#else
boost::math::geometric_distribution<> _dist( _p0 );
#endif /* USE_CONFIG_FILE */
std::printf(
"\n"
" 1-CDF(0,false): %g\n",
boost::math::cdf(
boost::math::complement(
_dist,
_x ) ) );
std::printf(
" CDF(0,false): %g\n\n",
boost::math::cdf( _dist, _x ) );
return EXIT_SUCCESS;
}
Note:
See TracTickets
for help on using tickets.

Definitely a bug, fixed in https://github.com/boostorg/math/commit/9199b09304fe6d6d11aa7ac9cc9ea3127f6d91d1