diff options
author | warren <warren.weckesser@gmail.com> | 2023-04-27 11:52:47 -0400 |
---|---|---|
committer | warren <warren.weckesser@gmail.com> | 2023-04-30 23:28:44 -0400 |
commit | 40ae83411b275b68425b5c85a7243c69599edc59 (patch) | |
tree | e5a4216104e71b5c321a1031a2bcffb4faf7a4a6 /numpy/array_api/_manipulation_functions.py | |
parent | 4335727271708352df532e077baa3c118a8dd5ed (diff) | |
download | numpy-40ae83411b275b68425b5c85a7243c69599edc59.tar.gz |
BUG: random: Don't return negative values from Generator.geometric.
In C, when the integer part of a double exceeds the maximum int64, casting
the double to int64_t is undefined behavior. On some platforms, the result
is 2**64-1 and on others it is -2**64. That results in rng.geometric()
returning -2**64 when p was sufficiently small on some platforms.
The fix is to never invoke undefined behavior by ensuring we don't attempt
to cast very large double values to int64_t.
Diffstat (limited to 'numpy/array_api/_manipulation_functions.py')
0 files changed, 0 insertions, 0 deletions