public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/89979] subtract_with_carry_engine incorrect carry flag
       [not found] <bug-89979-4@http.gcc.gnu.org/bugzilla/>
@ 2021-08-22 21:46 ` pinskia at gcc dot gnu.org
  2021-08-31  9:39 ` gcc@christoph-conrads.name
  1 sibling, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-22 21:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89979

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug libstdc++/89979] subtract_with_carry_engine incorrect carry flag
       [not found] <bug-89979-4@http.gcc.gnu.org/bugzilla/>
  2021-08-22 21:46 ` [Bug libstdc++/89979] subtract_with_carry_engine incorrect carry flag pinskia at gcc dot gnu.org
@ 2021-08-31  9:39 ` gcc@christoph-conrads.name
  1 sibling, 0 replies; 2+ messages in thread
From: gcc@christoph-conrads.name @ 2021-08-31  9:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89979

--- Comment #4 from Christoph Conrads <gcc@christoph-conrads.name> ---
> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-31  9:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-89979-4@http.gcc.gnu.org/bugzilla/>
2021-08-22 21:46 ` [Bug libstdc++/89979] subtract_with_carry_engine incorrect carry flag pinskia at gcc dot gnu.org
2021-08-31  9:39 ` gcc@christoph-conrads.name

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).