From 55b2f6edac12be5357ca08e7e9b4efb6736788c7 Mon Sep 17 00:00:00 2001 From: Henrique GC Date: Sun, 20 Oct 2024 10:28:32 -0300 Subject: [PATCH] fix: incorrect exception handling in factorial function --- math/factorial.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/math/factorial.cpp b/math/factorial.cpp index acfa053d89a..5b36fef3490 100644 --- a/math/factorial.cpp +++ b/math/factorial.cpp @@ -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) {