-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
BUG: Inaccurate log1p
for small complex input
#22609
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
Labels
Comments
WarrenWeckesser
added a commit
to WarrenWeckesser/numpy
that referenced
this issue
Aug 14, 2023
Reimplement the complex log1p function. Use the log1p trick from Theorem 4 of Goldberg's paper "What every computer scientist should know about floating-point arithmetic". Include special handling of an input with imaginary part 0.0 to ensure the sign of the imaginary part of the result is correct and consistent with the complex log function. Closes numpygh-22609.
WarrenWeckesser
added a commit
to WarrenWeckesser/numpy
that referenced
this issue
Jun 5, 2024
Reimplement the complex log1p function. Use the log1p trick from Theorem 4 of Goldberg's paper "What every computer scientist should know about floating-point arithmetic". Include special handling of an input with imaginary part 0.0 to ensure the sign of the imaginary part of the result is correct and consistent with the complex log function. Closes numpygh-22609.
WarrenWeckesser
added a commit
to WarrenWeckesser/numpy
that referenced
this issue
Jun 18, 2024
Closes numpygh-22609 [skip circle]
WarrenWeckesser
added a commit
to WarrenWeckesser/numpy
that referenced
this issue
Jun 22, 2024
Reimplement the complex log1p function. Use the log1p trick from Theorem 4 of Goldberg's paper "What every computer scientist should know about floating-point arithmetic". Include special handling of an input with imaginary part 0.0 to ensure the sign of the imaginary part of the result is correct and consistent with the complex log function. Closes numpygh-22609.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the issue:
The reason for
log1p
existence is to provide a more numerically stable function for small input, compared tolog(1 + x)
.If the input is real valued,
np.log1p
can serve its purpose.However, when the input is complex and small,
np.log1p
loses its accuracy.Reproduce the code example:
Error message:
No response
NumPy/Python version information:
1.23.4 3.9.15 (main, Nov 4 2022, 16:13:54) [GCC 11.2.0]
Context for the issue:
No response
The text was updated successfully, but these errors were encountered: