1 Upstream-Status: Inappropriate [Backport]
2 From 6bb9234e718d4b75a9a1e63d523d08c3392ba55f Mon Sep 17 00:00:00 2001
3 From: paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
4 Date: Sat, 26 Mar 2011 10:02:34 +0000
5 Subject: [PATCH 008/200] 2011-03-26 Paolo Carlini <paolo.carlini@oracle.com>
7 * include/bits/random.h (negative_binomial_distribution<>::
8 negative_binomial_distribution(_IntType, double),
9 negative_binomial_distribution<>::
10 negative_binomial_distribution(const param_type&)): Fix thinko
11 p / (1 - p) for (1 - p) / p.
12 * include/bits/random.tcc (negative_binomial_distribution<>::
16 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@171553 138bc75d-0d04-0410-961f-82ee72b054a4
18 index 26cec8a..988ee61 100644
19 --- a/libstdc++-v3/include/bits/random.h
20 +++ b/libstdc++-v3/include/bits/random.h
21 @@ -3782,7 +3782,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
23 param_type(_IntType __k = 1, double __p = 0.5)
24 : _M_k(__k), _M_p(__p)
27 + _GLIBCXX_DEBUG_ASSERT((_M_k > 0) && (_M_p > 0.0) && (_M_p <= 1.0));
32 @@ -3803,12 +3805,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
35 negative_binomial_distribution(_IntType __k = 1, double __p = 0.5)
36 - : _M_param(__k, __p), _M_gd(__k, __p / (1.0 - __p))
37 + : _M_param(__k, __p), _M_gd(__k, (1.0 - __p) / __p)
41 negative_binomial_distribution(const param_type& __p)
42 - : _M_param(__p), _M_gd(__p.k(), __p.p() / (1.0 - __p.p()))
43 + : _M_param(__p), _M_gd(__p.k(), (1.0 - __p.p()) / __p.p())
47 diff --git a/libstdc++-v3/include/bits/random.tcc b/libstdc++-v3/include/bits/random.tcc
48 index 4b17e91..e81392f 100644
49 --- a/libstdc++-v3/include/bits/random.tcc
50 +++ b/libstdc++-v3/include/bits/random.tcc
51 @@ -1100,7 +1100,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
55 - _M_gd(__urng, param_type(__p.k(), __p.p() / (1.0 - __p.p())));
56 + _M_gd(__urng, param_type(__p.k(), (1.0 - __p.p()) / __p.p()));
58 std::poisson_distribution<result_type> __poisson(__y);
59 return __poisson(__urng);