9 ms·
If you are doing a fib function that is not valid up to an input of 80, you might as well just have a lookup table with 80 values in it. So much for mathematica
by kazagistar 13y ago
If you are doing a fib function that is not valid up to an input of 80, you might as well just have a lookup table with 80 values in it. So much for mathematical elegance.
- jordigh 13y agoHow 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.