[Bug libstdc++/89979] subtract_with_carry_engine incorrect carry flag

2021-08-31 Thread gcc--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89979

--- Comment #4 from Christoph Conrads  ---
> LLVM's libc++ does not go into the 0 loop but still does not do a good job:

The subtract-with-carry PRNG is a simple PRNG, it has a very long period whose
length can be proved with elementary number theory but the randomness
properties of an SWC on its own are bad which is why you have to discard a lot
of values. For reference, std::ranlux48 uses about 11 out of 389 values and you
can detect (self-advertisement: it discards much less variates if you you use
my parameters: b=32, s=2, r=13, see
https://github.com/boostorg/random/issues/57).

Here are the random values are drawing 100 times:

114294 141465 4294632814 252684 106646 4294497449 475286

Here are the random values after drawing 1000 times:

3844519667 4029384828 773557245 3005408692 1891078342 2314767096 2602358454

After drawing 2000 times:

671901017 3735908022 2276383719 2942324048 2197640583 3544339665 2823890385

[Bug libstdc++/89979] subtract_with_carry_engine incorrect carry flag

2021-08-22 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89979

--- Comment #3 from Andrew Pinski  ---
LLVM's libc++ does not go into the 0 loop but still does not do a good job:
4294967295 0 0 0 0 0 0 1
0 0 0 0 0 0 0 1
0 0 0 0 0 0 4294967295 1
0 0 0 0 0 4294967295 4294967295 1
0 0 0 0 4294967295 4294967295 4294967295 1
0 0 0 4294967295 4294967295 4294967295 4294967294 0
0 0 4294967295 4294967295 4294967295 4294967294 4294967295 0
0 4294967295 4294967295 4294967295 4294967294 4294967295 4294967295 0
4294967295 4294967295 4294967295 4294967294 4294967295 4294967295 4294967294 0
4294967295 4294967295 4294967294 4294967295 4294967295 4294967294 0 0
4294967295 4294967294 4294967295 4294967295 4294967294 0 0 0
4294967294 4294967295 4294967295 4294967294 0 0 4294967295 1


While libstdc++ does seems to get into a loop:
4294967295 0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 2
0 0 0 0 0 0 0 0 3
0 0 0 0 0 0 0 0 4
0 0 0 0 0 0 0 0 5
0 0 0 0 0 0 0 0 6
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 2
0 0 0 0 0 0 0 0 3
0 0 0 0 0 0 0 0 4

[Bug libstdc++/89979] subtract_with_carry_engine incorrect carry flag

2019-04-05 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89979

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-04-05
 Ever confirmed|0   |1

--- Comment #2 from Jonathan Wakely  ---
(In reply to Christoph Conrads from comment #1)
> There is no attachment with the preprocessed code demonstrating the problem
> because the this code is 1.2 MB large.

That's OK in this case as you code doesn't depend on anything except standard
library headers.

[Bug libstdc++/89979] subtract_with_carry_engine incorrect carry flag

2019-04-04 Thread g...@christoph-conrads.name
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89979

--- Comment #1 from Christoph Conrads  ---
There is no attachment with the preprocessed code demonstrating the problem
because the this code is 1.2 MB large.