forked from numpy/numpy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 numpy#12841.
- Loading branch information
1 parent
8063fa6
commit 56bf38b
Showing
3 changed files
with
22 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters