Skip to content

Commit

Permalink
Update fibonacci_fast.cpp to meet the coding style requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
setbit123 authored Nov 24, 2024
1 parent bec06c9 commit 0ac1508
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions math/fibonacci_fast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ uint64_t fib(uint64_t n) {
// f1 and f2 for the next function call.
static uint64_t f1 = 1, f2 = 1;

if (n <= 2)
if (n <= 2) {
return f2;
if (n >= MAX) {
} if (n >= MAX) {
throw std::invalid_argument("Cannot compute for n>=" + std::to_string(MAX) +
" due to limit of 64-bit integers");
return 0;
Expand Down

0 comments on commit 0ac1508

Please sign in to comment.