Closed Renjian-buchai closed 4 months ago
I genuinely don't know what the original author was trying to do here, tbh.
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.
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.