-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
BUG: np.expm1 returns unexpected values in special cases with complex numbers #21746
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
Do you know if there is a reference implementation for a complex However, I did a brief search right now, and did not yet find a complex expm1 implementation, does one of the other libs pass these tests and include one that we can "steal"? EDIT: I suppose our implementation may be good, and just needs a few special cases. But it would still be nice to find a reference implementation for comparison. |
@steff456 I updated data-apis/array-api#452 and, in the process, found 2 additional special cases in which NumPy's behavior for certain special cases deviates from the naive @seberg I think the main concern is that special case behavior for |
After digging a little bit and trying these cases in multiple OS with different architectures I found that this corner cases are present in macOS Intel, macOS ARM and Windows x64, but the corner cases are working as expected in Linux Intel and Linux ARM so probably the issue is related with the compiler of C99. Hope this info is useful! |
Thanks @steff456. As far as I understand for the API test-suite the idea is currently to try to inform about failing corner cases but not fail on it. |
Describe the issue:
Writing the spec for complex number support in the Array API we found that NumPy currently fails in 4 special cases. The behavior is inconsistent with
np.exp(z)-1
and C99 as shown in the code example.The full list of special cases and specification is detailed in data-apis/array-api#452
cc @kgryte
Reproduce the code example:
Error message:
NumPy/Python version information:
v1.22.4
The text was updated successfully, but these errors were encountered: