public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/40331]  New: uniform_real random number distribution produces wildly out of range values (TR1 & C++0x)
@ 2009-06-03 15:49 colin at gibibit dot com
  2009-06-03 15:52 ` [Bug libstdc++/40331] " colin at gibibit dot com
  2009-06-03 16:49 ` paolo dot carlini at oracle dot com
  0 siblings, 2 replies; 3+ messages in thread
From: colin at gibibit dot com @ 2009-06-03 15:49 UTC (permalink / raw)
  To: gcc-bugs

Using either the std::tr1 or C++0x std:: random number generators, the
uniform_real distribution produces numbers that are completely wrong.

For instance, using Boost.Random the test program produces this sequence of
floating point numbers:

Random real: 0.0975404
Random real: 0.547221
Random real: 0.278498
...

On the other hand, both the TR1 and C++0x random number generators produce
something like

Random real: 4.18933e+08
Random real: 2.35029e+09
Random real: 1.19614e+09
...

instead.

This is using the mt19937 random number generator engine and the uniform_real
distribution.  I have tried both uniform_real<float> and uniform_real<double>
and they both have this bug.


-- 
           Summary: uniform_real random number distribution produces wildly
                    out of range values (TR1 & C++0x)
           Product: gcc
           Version: 4.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: colin at gibibit dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40331


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

end of thread, other threads:[~2009-06-03 16:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-03 15:49 [Bug libstdc++/40331] New: uniform_real random number distribution produces wildly out of range values (TR1 & C++0x) colin at gibibit dot com
2009-06-03 15:52 ` [Bug libstdc++/40331] " colin at gibibit dot com
2009-06-03 16:49 ` paolo dot carlini at oracle dot com

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).