Adds runtime warning on divide-by-zero, fixes use of "out" and "where" in arctan2#5315
Open
drculhane wants to merge 3 commits intoBears-R-Us:mainfrom
Open
Adds runtime warning on divide-by-zero, fixes use of "out" and "where" in arctan2#5315drculhane wants to merge 3 commits intoBears-R-Us:mainfrom
drculhane wants to merge 3 commits intoBears-R-Us:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5315 +/- ##
========================================
Coverage ? 100.00%
========================================
Files ? 5
Lines ? 115
Branches ? 0
========================================
Hits ? 115
Misses ? 0
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
8864961 to
566cc9d
Compare
ajpotts
reviewed
Jan 23, 2026
ajpotts
reviewed
Jan 23, 2026
cc36f0b to
8864961
Compare
2eb0ae4 to
a795292
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #5132 and #5149.
This takes the place of PR #5204.
The binops in pdarrayclass.py now give a RuntimeWarning or a Floating Point Error (or nothing) if / or // cause a divide-by-zero, depending on the "divide" setting of ak.errstate.
Because the RuntimeWarning surfaced an issue in
arctan2, I've rewritten that function somewhat. It now has an "out" parameter matching numpy, and uses the "where" parameter correctly.arctan2 now also accepts bool inputs, which requires special handling. np.arctan2, if given bool inputs, returns np.float16, which arkouda doesn't like.
Most of the original arctan2 function remains as
_arctan2_, because (subjective opinion here) I think that calling it as a separate function improves the readability of the code.In doing this rewriting, I removed some mypy ignores that are no longer needed.
I rewrote the unit tests for
arctan2to use our newer assert functions. I think this cleans up that code significantly. In the cases that use "where," I check both the returned result, and the returned "out" pdarray, since they should match.