-
-
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
Better precision for cispi(::Complex) #45945
Conversation
Can add any tests? |
Done, thanks for nudging me. I also fixed thanks to the existing tests a very fun bug: exp(-pi*v) is wrong because it's really exp((-pi)*v), which converts pi to Float64 (which is bad for higher precisions) |
Sounds like you have to update a doctest as well: https://buildkite.com/julialang/julia-master/builds/13663#0181e2d3-4b6d-4359-8341-a387a685cc86/1260-1268. Just to confirm the goodness of the change, the new result seems to be closer to what multiple precision gives: julia> ComplexF64(cispi(big(0.25 + 1im)))
0.030556854645954555 + 0.030556854645954555im |
technically you could do this faster by combing the reduction steps, but that is probably overkill here. |
The new implementation is already faster than the current one, in addition to being more accurate:
|
Good catch, thanks! (I did look at CI, but it appeared to be broken for some reason so I didn't get very far). |
* Better precision for cispi(::Complex) * Fix bug, add test * Update doctest
* Better precision for cispi(::Complex) * Fix bug, add test * Update doctest
See https://discourse.julialang.org/t/cispi-is-not-accurate/83811/.