-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
Fix, Docs, Test: Fibonacci_fast (Renamed to Fibonacci_iterative) #2614
Fix, Docs, Test: Fibonacci_fast (Renamed to Fibonacci_iterative) #2614
Conversation
(Sorry for long extended commit message) The original algorithm does not calculate the nth fibonacci number, but rather the next fibonacci number after storing it in a static variable. Thus, I abstracted the looping part out of the code that you have to write upon application, into the function itself. The function also does not calculate the nth fibonacci number, but rather the (n+1)th fibonacci number. The "Test" in main does not really test anything, rather demonstrates what it does. Added actual unit tests with test cases. The file brief did not explain what it actually does properly.
I genuinely don't know what the original author was trying to do here, tbh. |
Co-authored-by: realstealthninja <[email protected]>
This pull request has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
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
Please ping one of the maintainers once you commit the changes requested or make improvements on the code. If this is not the case and you need some help, feel free to ask for help in our Gitter channel or our Discord server. Thank you for your contributions! |
@Panquesito7 could we get this merged? |
Description of Change
The original algorithm does not calculate the nth fibonacci number, but rather the next fibonacci number after storing it in a static variable. Thus, I abstracted the looping part out of the code that you have to write upon application, into the function itself.
The "Test" in main does not really test anything, rather demonstrates what it does. Added actual unit tests with test cases.
The "Test" in main also does not calculate the nth fibonacci number, but rather the (n+1)th fibonacci number.
The maximum value that can be computed such that the result is less than UINT64_MAX is also incorrect because of the above error.
The file brief did not explain what it actually does properly.
Checklist
Notes:
Fixed bugs, added documentation, and unit tests for Fibonacci_fast (Renamed to Fibonacci_iterative to better reflect what it actually does).
For #2456.