-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
optimize: convert using continued fractions fundamental recurrence formulas #2220
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
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2220 +/- ##
=======================================
Coverage 99.34% 99.34%
=======================================
Files 32 32
Lines 25614 25616 +2
=======================================
+ Hits 25447 25449 +2
Misses 89 89
Partials 78 78
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
xuri
left a comment
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.
Thanks for your PR. I've left some comments.
xuri
left a comment
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.
LGTM. Thanks for your contribution.
PR Details
Use
fundamental recursion formulasto avoid duplicate calculations.Formula reference: https://en.wikipedia.org/wiki/Continued_fraction#Fundamental_recurrence_formulas, https://oi-wiki.org/math/number-theory/continued-fraction/#%E9%80%92%E6%8E%A8%E5%85%B3%E7%B3%BB
Description
Related Issue
Motivation and Context
benchmark:
old:
BenchmarkNumFmtPlaceHolder-12 410 2789684 ns/op 2068222 B/op 75930 allocs/op
new:
BenchmarkNumFmtPlaceHolder-12 47521 26230 ns/op 11782 B/op 374 allocs/op
How Has This Been Tested
Types of changes
Checklist