Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Performance improvements for trig functions with @fastmath #750

Merged
merged 4 commits into from
Nov 22, 2024

Conversation

sostock
Copy link
Collaborator

@sostock sostock commented Nov 21, 2024

#745 improved the accuracy of cis for quantities in ° (degrees), but this unfortunately comes with a performance hit.

Since the @fastmath implementation for cis (and other trig functions) falls back to the normal implementation for some types, this also impacted the performance of @fastmath cis(…). Since users of @fastmath most likely care more about performance and are willing to sacrifice a little numerical accuracy, this PR improves @fastmath performance for sin, cos, tan, sincos, and cis.

Performance with @fastmath is now at least as good as before #745 (in some cases better), except when using BigFloat with °: Before this PR, the conversion from degrees happened with uconvert, which for °rad only has Float64 precision. It now uses deg2rad for that, which is a bit slower but has BigFloat precision. I think that this is fine, since you probably want BigFloat precision if you are using BigFloat.

@sostock sostock merged commit 4478f51 into PainterQubits:master Nov 22, 2024
15 of 16 checks passed
@sostock sostock deleted the fastmath_trig branch November 22, 2024 11:00
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant