formatting source-code for c7ff9d66f1

This commit is contained in:
github-actions 2020-06-24 17:14:57 +00:00
parent c7ff9d66f1
commit 4c6b3b86c1

View File

@ -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;