-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Make expm1(::Complex64)
type stable.
#21896
Conversation
LGTM. |
Should this be backported to 0.6? |
Ah, probably. I wasn't sure if 0.5 has the necessary |
Actually |
(cherry picked from commit a34fd51)
wr = isfinite(er) ? erm1 - 2.0*er*(sin(0.5*zi))^2 : er*cos(zi) | ||
Complex(wr, er*sin(zi)) | ||
if isfinite(er) | ||
wr = erm1 - 2 * er * (sin(convert(Tf, 0.5) * zi))^2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know I'm a bit too late, but why not using zi / 2
instead of converting 0.5? The performance difference is sensible for BigFloat for this operation (not the whole function, though).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just trying to not change the result for machine types and being conservative about this transformation. I assume this transformation is exact for Float16, Float32 and Float64 (though floating point corner cases frequently surprises me...)? If that's the case then I think we can change this to / 2
.
Noticed by accident when debugging #21831 (comment) .... The issue is apparently there ever since
expm1(::Complex)
is defined in 0.3....