summaryrefslogtreecommitdiff
path: root/numpy/array_api/_manipulation_functions.py
diff options
context:
space:
mode:
authorwarren <warren.weckesser@gmail.com>2023-04-27 11:52:47 -0400
committerwarren <warren.weckesser@gmail.com>2023-04-30 23:28:44 -0400
commit40ae83411b275b68425b5c85a7243c69599edc59 (patch)
treee5a4216104e71b5c321a1031a2bcffb4faf7a4a6 /numpy/array_api/_manipulation_functions.py
parent4335727271708352df532e077baa3c118a8dd5ed (diff)
downloadnumpy-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