-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
BUG: Invalid corner cases (resulting in nan+nanj) in complex division #26560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
For a bit of context the PR that @skirpichev mentions, python/cpython#119372, is a currently open PR against core Python that (if merged) will change the semantics of complex division for Python |
Some libraries may test against NumPy and copy us bug-for-bug, but those should just keep up. In any case, long story short: I think you can change this and NumPy should also fix it in either case. Neither does it sound like a burning issue or an issue if NumPy "diverges". |
Thanks, @seberg! |
JFR:
I'll work on a patch. |
Describe the issue:
It seems, that numpy uses Smith's algorithm to do complex true division. In some cases (see below) it produces
(nan+nanj)
, but meaningful components could be recovered. See e.g. C11 Annex G.5.2,_Cdivd()
's example.FYI: see also CPython's issue python/cpython#119372
Reproduce the code example:
Error message:
No response
Python and NumPy Versions:
>>> np.__version__ '1.26.4'
Runtime Environment:
No response
Context for the issue:
No response
The text was updated successfully, but these errors were encountered: