Boost logo

Boost :

Subject: Re: [boost] [random] geometric_distribution backwards compatibility
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2011-01-23 19:52:02

On Sun, 23 Jan 2011, Steven Watanabe wrote:

> Over the last year I've been (slowly) updating
> Boost.Random to match the new standard. Unfortunately
> I just hit a problem that I don't have a good solution
> for. In the standard, the geometric_distribution is
> defined as $p(i) = p(1-p)^{i}$, with i >= 0. In the
> current Boost.Random code it is $p(i) = (1-p) p^{i-1}$,
> with i >= 1. The definition in the standard makes
> more sense, but I don't want to introduce a breaking
> change. I can see two options here:
> * Leave the implementation alone and put a big
> warning in the documentation saying that the
> behavior doesn't match the standard.
> * Since I'm also moving things into namespace
> boost::random, I can use the new definition
> and leave a version with the old behavior in
> namespace boost instead of having a using
> declaration. I'd still have to add a warning
> that boost::geometric_distribution isn't the
> same as boost::random::geometric_distribution.
> Neither one is particularly appealing.
> Any thoughts? Better ideas?

I noticed that discrepancy between Boost.Random and usual definitions of
geometric_distribution as well, but forgot to report it; I would prefer to
have the standard definition rather than the current one. I support your
second option, as long as people don't have both "using namespace boost;"
and "using namespace boost::random;" in the same code. Since you state
that you will be moving things around, you are likely to be deprecating
the versions in boost::, and so the change in geometric_distribution would
fit into the same category.

-- Jeremiah Willcock

Boost list run by bdawes at, gregod at, cpdaniel at, john at