This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/66302] New: Wrong output sequence of double precision uniform C++ RNG distribution


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

            Bug ID: 66302
           Summary: Wrong output sequence of double precision uniform C++
                    RNG distribution
           Product: gcc
           Version: 5.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: andrey.kolesov at intel dot com
  Target Milestone: ---

Created attachment 35632
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35632&action=edit
Difference between int, float and double C++ RNG uniform distribution sequences

Double precision uniform distribution of C++ random number generators from
libstdc++ produces sequence which is significantly different from floating
point and integer (direct engine) generators.
Double precision sequence contains only every second (odd: 1,3,5,7...) element
from float and integer sequences. Generally generator output shouldn't depend
on output data type up to precision bounds.
Looks like the issue doesn't depend on engine types: reproduced on rand0 and
mt19937.
Attached test case output (U - unisigned int direct engine sequence, F - float
distribution sequence, D - double distribution sequence):

#  : U          F          D
-------------------------------------
0  | 1.306e+07  1.306e+07  4.399e+08
1  | 4.399e+08  4.399e+08  7.970e+08
2  | 2.262e+08  2.262e+08  2.819e+08
3  | 7.970e+08  7.970e+08  1.026e+09
4  | 2.062e+09  2.062e+09  5.506e+08
5  | 2.819e+08  2.819e+08  1.260e+09
6  | 1.189e+09  1.189e+09  1.852e+09
7  | 1.026e+09  1.026e+09  1.239e+09
8  | 1.747e+09  1.747e+09  2.108e+09
...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]