Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r63101 - in trunk: boost/random libs/random/test
From: steven_at_[hidden]
Date: 2010-06-19 10:55:53


Author: steven_watanabe
Date: 2010-06-19 10:55:52 EDT (Sat, 19 Jun 2010)
New Revision: 63101
URL: http://svn.boost.org/trac/boost/changeset/63101

Log:
Fix integer overflow bug.
Text files modified:
   trunk/boost/random/binomial_distribution.hpp | 2 +-
   trunk/libs/random/test/chi_squared_test.hpp | 2 +-
   2 files changed, 2 insertions(+), 2 deletions(-)

Modified: trunk/boost/random/binomial_distribution.hpp
==============================================================================
--- trunk/boost/random/binomial_distribution.hpp (original)
+++ trunk/boost/random/binomial_distribution.hpp 2010-06-19 10:55:52 EDT (Sat, 19 Jun 2010)
@@ -309,7 +309,7 @@
             IntType k = static_cast<IntType>(floor((2*btrd.a/us + btrd.b)*u + btrd.c));
             if(k < 0 || k > _t) continue;
             v = v*btrd.alpha/(btrd.a/(us*us) + btrd.b);
- IntType km = abs(k - m);
+ RealType km = abs(k - m);
             if(km <= 15) {
                 RealType f = 1;
                 if(m < k) {

Modified: trunk/libs/random/test/chi_squared_test.hpp
==============================================================================
--- trunk/libs/random/test/chi_squared_test.hpp (original)
+++ trunk/libs/random/test/chi_squared_test.hpp 2010-06-19 10:55:52 EDT (Sat, 19 Jun 2010)
@@ -38,7 +38,7 @@
         current_actual += actual;
         current_expected += expected;
 
- if(expected >= cutoff) {
+ if(current_expected >= cutoff) {
             if(prev_expected != 0) {
                 update(prev_actual, prev_expected);
             }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk