Re: [Boost-bugs] [Boost C++ Libraries] #1856: minstd_rand returning different values in 1.35.0 than in 1.34.1

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #1856: minstd_rand returning different values in 1.35.0 than in 1.34.1
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-02-22 23:36:21


#1856: minstd_rand returning different values in 1.35.0 than in 1.34.1
----------------------------------------------------+-----------------------
  Reporter: Greg Landrum <greg.landrum_at_[hidden]> | Owner: no-maintainer
      Type: Bugs | Status: closed
 Milestone: Boost 1.36.0 | Component: random
   Version: Boost 1.35.0 | Severity: Problem
Resolution: invalid | Keywords:
----------------------------------------------------+-----------------------
Changes (by steven_watanabe):

  * status: new => closed
  * resolution: => invalid

Comment:

 The values returned by minstd_rand are the same for both
 versions. The difference is in uniform_int.

 uniform_int didn't handle signed/unsigned issues correctly
 in 1.33.1. Debugging this test case with 1.33.1 shows that during the
 second iteration (which prints 854 or 844), for the comparison on
 uniform_int.hpp line 97
 {{{
   if(result <= _range)
 }}}
 result is 9bad7746 and _range is 7fffffff.
 Since both arguments are signed, the comparison
 returns true, which is incorrect.

 So, I modified the test case to print out the actual values
 returned by uniform_int, and some of them are indeed negative.

 The current behavior is correct, so I'm marking this as invalid.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/1856#comment:1>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:59 UTC