This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++17 status.
Section: 28.5.9.3.4 [rand.dist.bern.negbin] Status: C++17 Submitter: Stephan T. Lavavej Opened: 2014-06-14 Last modified: 2017-07-30
Priority: 3
View all other issues in [rand.dist.bern.negbin].
View all issues with C++17 status.
Discussion:
28.5.9.3.4 [rand.dist.bern.negbin] p2 requires "0 < p <= 1". Consider what happens when p == 1. The discrete probability function specified by p1 involves "* p^k * (1 - p)^i". For p == 1, this is "* 1^k * 0^i", so every integer i >= 0 is produced with zero probability. (Let's avoid thinking about 0^0.)
Wikipedia states that p must be within (0, 1), exclusive on both sides. Previous resolution [SUPERSEDED]:
Change 28.5.9.3.4 [rand.dist.bern.negbin] p2 as indicated: [Drafting note: This should be read as: Replace the symbol "≤" by "<" — end drafting note]
explicit negative_binomial_distribution(IntType k = 1, double p = 0.5);-2- Requires: 0 < p
≤< 1 and 0 < k.
[2014-11 Urbana]
SG6 suggests better wording.
[2014-11-08 Urbana]
Moved to Ready with the node.
There remains concern that the constructors are permitting values that may (or may not) be strictly outside the domain of the function, but that is a concern that affects the design of the random number facility as a whole, and should be addressed by a paper reviewing and addressing the whole clause, not picked up in the issues list one distribution at a time. It is still not clear that such a paper would be uncontroversial.
Proposed resolution:
This wording is relative to N4140.
Add a note after paragraph 1 before the synopsis in 28.5.9.3.4 [rand.dist.bern.negbin]:
A negative_binomial_distribution random number distribution produces random integers distributed according to the discrete probability function
.
[Note: This implies that is undefined when p == 1. — end note]
Drafting note: should be in math font, and p == 1 should be in code font.