diff options
author | warren <warren.weckesser@gmail.com> | 2021-11-06 02:59:05 -0400 |
---|---|---|
committer | warren <warren.weckesser@gmail.com> | 2021-11-06 03:20:51 -0400 |
commit | 4b9e56921e6343b980b27e308534ca433a4a1fe8 (patch) | |
tree | bfaf0b87c2dad22890b9629df7a07454b3560ba5 /numpy/array_api/_linear_algebra_functions.py | |
parent | 7c211013d559db238daf76fdb90af1d2f37a341e (diff) | |
download | numpy-4b9e56921e6343b980b27e308534ca433a4a1fe8.tar.gz |
BUG: Get full precision for 32 bit floating point random values.
The formula to convert a 32 bit random integer to a random float32,
(next_uint32(bitgen_state) >> 9) * (1.0f / 8388608.0f)
shifts by one bit too many, resulting in uniform float32 samples always
having a 0 in the least significant bit. The formula is corrected to
(next_uint32(bitgen_state) >> 8) * (1.0f / 16777216.0f)
Occurrences of the incorrect formula in numpy/random/tests/test_direct.py
were also corrected.
Closes gh-17478.
Diffstat (limited to 'numpy/array_api/_linear_algebra_functions.py')
0 files changed, 0 insertions, 0 deletions