Re: Fibonacci implementation



Richard Heathfield wrote:
gw7rib@xxxxxxx said:

<snip>
If you want single, large values however it
might be quicker to calculate them directly, as follows:

FUNCTION fib (k)
r = (1 + SQR(5)) / 2
t = 1 - r
fib = (r ^ k - t ^ k) / (r - t)
END FUNCTION

Oops. That was what I intended to offer the OP. I appear to have given him Stirling's Approximation for factorials instead.

Oh, I hate it when I mean to give someone a direct method for
calculating the N-th Fibonacci number and accidentally give them
Stirling's Approximation for factorials by mistake! And I am
always making that mistake, too...

- Logan
.