We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bec06c9 commit 0ac1508Copy full SHA for 0ac1508
math/fibonacci_fast.cpp
@@ -40,9 +40,9 @@ uint64_t fib(uint64_t n) {
40
// f1 and f2 for the next function call.
41
static uint64_t f1 = 1, f2 = 1;
42
43
- if (n <= 2)
+ if (n <= 2) {
44
return f2;
45
- if (n >= MAX) {
+ } if (n >= MAX) {
46
throw std::invalid_argument("Cannot compute for n>=" + std::to_string(MAX) +
47
" due to limit of 64-bit integers");
48
return 0;
0 commit comments