Skip to content

Conversation

@camille-lanuel
Copy link
Contributor

Because

When testing 25!, there could be rounding errors when the implemented solution was different from the solution provided by TOP, which resulted in the test to fail despite having a correct implementation.

This PR

  • Replaced 25! instead of 18!: 18! is the largest factorial less than 2^53-1 (the precision of a double). Testing with 18! instead of 25! ensures that there will be no such fail.

Issue

Closes #604

Additional Information

Pull Request Requirements

  • I have thoroughly read and understand The Odin Project Contributing Guide
  • The title of this PR follows the location of change: brief description of change format, e.g. 01_helloWorld: Update test cases
  • The Because section summarizes the reason for this PR
  • The This PR section has a bullet point list describing the changes in this PR
  • If this PR addresses an open issue, it is linked in the Issue section
  • If this PR includes any changes that affect the solution of an exercise, I've also updated the solution in the /solutions folder

rationale: 18! is the largest factorial less than 2^53-1 (the precision of a double). When testing 25!, there could be rounding errors when the implemented solution was different from the solution provided by TOP, which resulted in the test to fail despite having a correct algorithm. Testing with 18! instead of 25! ensures that there will be no such fail.
Copy link
Contributor

@JoshDevHub JoshDevHub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thank you for fixing this 🚀

@JoshDevHub JoshDevHub merged commit 65d711f into TheOdinProject:main Dec 16, 2025
1 check passed
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: computer_science/recursion/1_factorial: test fails for 25! when using terminal recursion

2 participants