Re: [Boost-bugs] [Boost C++ Libraries] #9966: exponential_distribution returns negative zero

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #9966: exponential_distribution returns negative zero
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-02-27 22:11:35

#9966: exponential_distribution returns negative zero
  Reporter: mazzamuto@… | Owner: no-maintainer
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: random
   Version: Boost 1.48.0 | Severity: Problem
Resolution: | Keywords:

Comment (by mazzamuto@…):

 Thanks for your help, I understand what you say on +Inf and about the
 approximation. I must say that I haven't used BOOST extensively, so there
 may be some things that I'm missing. Anyways the problem in the OP did
 cause a bug in a section of my code which wasn't expecting 0 from
 exponential_distribution. I fixed it with an additional check.

 I was referring to this documentation page
 where it says: The domain of the random variable is [0, +∞]. Anyways I get
 this output when I ask the range of the distribution. Is the interval open
 or closed? Is it possibile to generate numbers in an open-open interval
 with BOOST? Thanks again.

 range of exponential_distribution: 0 inf

 #include <boost/version.hpp>
 #include <boost/math/distributions/exponential.hpp>

 #include <iostream>

 using namespace std;

 int main() {
     cout << "Using BOOST " << BOOST_VERSION << endl;
     cout << "---------------" << endl;

     boost::math::exponential_distribution<double> ed(1);

     pair<double, double> r = boost::math::range(ed);
     cout << "range of exponential_distribution: " << r.first << " " <<
 r.second << endl;

     return 0;

Ticket URL: <>
Boost C++ Libraries <>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:18 UTC