diff options
author | tlatorre <tlatorre@uchicago.edu> | 2019-02-18 10:27:43 -0600 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2019-02-18 10:27:43 -0600 |
commit | 56bf38b018160471dfe88cb6f2a6dc0a5e93c087 (patch) | |
tree | f7209a9d075f6f4ba84abc46dcf101208799ac57 /numpy/lib/tests/test_packbits.py | |
parent | 8063fa6d1b92a755db9727b17428eb19e0ba590f (diff) | |
download | numpy-56bf38b018160471dfe88cb6f2a6dc0a5e93c087.tar.gz |
BUG: fix signed zero behavior in npy_divmod
Previously when doing floor division numpy would sometimes return an incorrect
signed zero. For example:
>>> np.zeros(10)//1
array([-0., -0., -0., -0., -0., -0., -0., -0., -0., -0.])
>>> np.remainder(-1.0,1.0)
-0.0
The reason for this is that whenever div or mod were zero the code was using
the following to pick the sign of zero:
floordiv = (a / b > 0) ? 0.0@c@ : -0.0@c@;
This commit updates these lines to instead use the copysign function which is
how cpython does floor division.
Fixes #12841.
Diffstat (limited to 'numpy/lib/tests/test_packbits.py')
0 files changed, 0 insertions, 0 deletions