C-Plus-Plus icon indicating copy to clipboard operation
C-Plus-Plus copied to clipboard

Fix, Docs, Test: Fibonacci_fast (Renamed to Fibonacci_iterative)

Open Renjian-buchai opened this issue 2 years ago • 4 comments

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

  • [x] Added description of change
  • [x] Added file name matches File name guidelines
  • [x] Added tests and example, test must pass
  • [x] Added documentation so that the program is self-explanatory and educational - Doxygen guidelines
  • [x] Relevant documentation/comments is changed or added
  • [x] PR title follows semantic commit guidelines
  • [x] I acknowledge that all my contributions will be made under the project's license.

Notes: Fixed bugs, added documentation, and unit tests for Fibonacci_fast (Renamed to Fibonacci_iterative to better reflect what it actually does).

For #2456.

Renjian-buchai avatar Oct 09 '23 15:10 Renjian-buchai

I genuinely don't know what the original author was trying to do here, tbh.

Renjian-buchai avatar Oct 09 '23 15:10 Renjian-buchai

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.

github-actions[bot] avatar Nov 15 '23 00:11 github-actions[bot]

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!

github-actions[bot] avatar Dec 06 '23 00:12 github-actions[bot]

@Panquesito7 could we get this merged?

realstealthninja avatar Mar 17 '24 06:03 realstealthninja