Skip to content

Commit

Permalink
fix: incorrect exception handling in factorial function
Browse files Browse the repository at this point in the history
  • Loading branch information
henriq4 committed Oct 20, 2024
1 parent d438f0f commit 55b2f6e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion math/factorial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace math {
* cannot be represented in 64 bit unsigned int
*/
uint64_t factorial(uint8_t n) {
if (n < 20) {
if (n > 20) {
throw std::invalid_argument("maximum value is 20\n");
}
if (n == 0) {
Expand Down

0 comments on commit 55b2f6e

Please sign in to comment.