3 ms·
How about a fib function that is valid for an input of 40.5? Binet's formula smoothly interpolates the Fibonnaci numbers. Quite elegant! And even without the in
by jordigh 13y ago
How about a fib function that is valid for an input of 40.5? Binet's formula smoothly interpolates the Fibonnaci numbers. Quite elegant! And even without the interpolation, the original formula is accurate enough if you change the return type from int to double.
Besides, writing Binet's formula is much shorter in the source code than hardwiring the lookup table. Way more elegant.