• Jeff R. Allen's avatar
    math/rand: Float32/64 must only return values in [0,1) · 17dc712c
    Jeff R. Allen authored
    Float32 and Float64 are now both created by taking the ratio
    of two integers which are chosen to fit entirely into the
    precision of the desired float type. The previous code
    could cast a Float64 with more than 23 bits of ".99999"
    into a Float32 of 1.0, which is not in [0,1).
    
    Float32 went from 15 to 21 ns/op (but is now correct).
    
    Fixes #6721.
    
    R=golang-dev, iant, rsc
    CC=golang-dev
    https://golang.org/cl/22730043
    17dc712c
Name
Last commit
Last update
..
example_test.go Loading commit data...
exp.go Loading commit data...
normal.go Loading commit data...
rand.go Loading commit data...
rand_test.go Loading commit data...
rng.go Loading commit data...
zipf.go Loading commit data...