Skip to content
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: incorrect exception handling in factorial function #2868

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

henriq4
Copy link

@henriq4 henriq4 commented Oct 20, 2024

Description of Change

This pull request corrects the recursive factorial function by:

  • Fixing the incorrect exception handling (previously throwing an exception for values less than 20 instead of greater than 20).
  • Ensuring that the function throws an exception when n > 20 to prevent overflow in uint64_t.

Checklist

  • Added description of change
  • Added file name matches File name guidelines
  • Added tests and example, test must pass
  • Added documentation so that the program is self-explanatory and educational - Doxygen guidelines
  • Relevant documentation/comments is changed or added
  • PR title follows semantic commit guidelines
  • Search previous suggestions before making a new one, as yours may be a duplicate.
  • I acknowledge that all my contributions will be made under the project's license.

Notes: This is my first good issue, and I’m grateful to contribute to the project. Fixes #2867

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Incorrect Exception Handling in Recursive Factorial Function
1 participant