about summary refs log tree commit diff
path: root/src/rt/rust_kernel.cpp
diff options
context:
space:
mode:
authorJed Davis <jld@panix.com>2012-07-16 19:28:32 -0700
committerJed Davis <jld@panix.com>2012-07-16 21:54:57 -0700
commitdb34b5acd150d114f392c907fa28f92a5227d3db (patch)
treee406028658b5d6aab6ce0afe337ec467ac4f3b14 /src/rt/rust_kernel.cpp
parent0e42004babc7b965a10056084a8ae76c72140a44 (diff)
downloadrust-db34b5acd150d114f392c907fa28f92a5227d3db.tar.gz
rust-db34b5acd150d114f392c907fa28f92a5227d3db.zip
Prevent random floats from occasionally being greater than 1.
Previously, gen_f64 could generate numbers as high as 1.0000000002328306
in the case that u3 was 4294967295.0f64 and u2 was nonzero.  This change
divides the random numbers by 2**32 instead, effectively concatenating
their bits as apparently intended.  (Bonus fix: const.)

The comments are updated to be more specific than "random float"; note
that this can still generate 1.0f64 (P = 2**-54) due to rounding.
Diffstat (limited to 'src/rt/rust_kernel.cpp')
0 files changed, 0 insertions, 0 deletions