Patchwork [v3] libstdc++/56202

login
register
mail settings
Submitter Paolo Carlini
Date Feb. 4, 2013, 8:26 p.m.
Message ID <51101965.2080003@oracle.com>
Download mbox | patch
Permalink /patch/218061/
State New
Headers show

Comments

Paolo Carlini - Feb. 4, 2013, 8:26 p.m.
... committed this follow up. See Audit trail for details.

Paolo.

//////////////////
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.

Patch

Index: include/bits/random.h
===================================================================
--- include/bits/random.h	(revision 195721)
+++ include/bits/random.h	(working copy)
@@ -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: include/bits/random.tcc
===================================================================
--- include/bits/random.tcc	(revision 195722)
+++ include/bits/random.tcc	(working copy)
@@ -1657,13 +1657,9 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 	do
 	  {
+	    if (__t == __x)
+	      return __x;
 	    const double __e = -std::log(1.0 - __aurng());
-	    if (__t == __x)
-	      {
-		if (__e)
-		  return __x;
-		continue;
-	      }
 	    __sum += __e / (__t - __x);
 	    __x += 1;
 	  }