diff --git a/math/fibonacci_fast.cpp b/math/fibonacci_fast.cpp index e7582df73..0948276a0 100644 --- a/math/fibonacci_fast.cpp +++ b/math/fibonacci_fast.cpp @@ -19,7 +19,7 @@ #include #include -/** +/** * maximum number that can be computed - The result after 93 cannot be stored * in a `uint64_t` data type. */ @@ -28,16 +28,19 @@ /** Algorithm */ uint64_t fib(uint64_t n) { - static uint64_t f1 = 1, f2 = 1; // using static keyword will retain the values of f1 and f2 for the next function call. - + static uint64_t f1 = 1, + f2 = 1; // using static keyword will retain the values of + // f1 and f2 for the next function call. + if (n <= 2) return f2; if (n >= 93) { - std::cerr << "Cannot compute for n>93 due to limit of 64-bit integers\n"; + std::cerr + << "Cannot compute for n>93 due to limit of 64-bit integers\n"; return 0; } - uint64_t temp = f2; // we do not need temp to be static + uint64_t temp = f2; // we do not need temp to be static f2 += f1; f1 = temp;