OSDN Git Service

2013-02-04 Manuel López-Ibáñez <manu@gcc.gnu.org>
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 4 Feb 2013 19:28:40 +0000 (19:28 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 4 Feb 2013 19:28:40 +0000 (19:28 +0000)
    Paolo Carlini  <paolo.carlini@oracle.com>

PR libstdc++/56202 (again)
* include/bits/random.tcc (binomial_distribution<>::
_M_waiting(_UniformRandomNumberGenerator&, _IntType)): Fix thinko
in previous commit.

* include/bits/random.h: Fix comment typo.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@195732 138bc75d-0d04-0410-961f-82ee72b054a4

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/random.h
libstdc++-v3/include/bits/random.tcc

index 077e483..2c1ffd2 100644 (file)
@@ -1,6 +1,16 @@
 2013-02-04  Manuel López-Ibáñez  <manu@gcc.gnu.org>
            Paolo Carlini  <paolo.carlini@oracle.com>
 
+       PR libstdc++/56202 (again)
+       * include/bits/random.tcc (binomial_distribution<>::
+       _M_waiting(_UniformRandomNumberGenerator&, _IntType)): Fix thinko
+       in previous commit.
+
+       * include/bits/random.h: Fix comment typo.
+
+2013-02-04  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+           Paolo Carlini  <paolo.carlini@oracle.com>
+
        PR libstdc++/56202
        * include/bits/random.tcc (binomial_distribution<>::
        _M_waiting(_UniformRandomNumberGenerator&, _IntType)): Avoid
index e1887e2..b471726 100644 (file)
@@ -3770,7 +3770,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
    * @brief A discrete binomial random number distribution.
    *
    * The formula for the binomial probability density function is
-   * @f$p(i|t,p) = \binom{n}{i} p^i (1 - p)^{t - i}@f$ where @f$t@f$
+   * @f$p(i|t,p) = \binom{t}{i} p^i (1 - p)^{t - i}@f$ where @f$t@f$
    * and @f$p@f$ are the parameters of the distribution.
    */
   template<typename _IntType = int>
index 6220a5d..acd4582 100644 (file)
@@ -1657,13 +1657,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
        do
          {
-           const double __e = -std::log(1.0 - __aurng());
            if (__t == __x)
-             {
-               if (__e)
-                 return __x;
-               continue;
-             }
+             return __x;
+           const double __e = -std::log(1.0 - __aurng());
            __sum += __e / (__t - __x);
            __x += 1;
          }