Scripting competition

Andre Garzia andre at andregarzia.com
Tue May 12 02:53:25 EDT 2009


Folks,
I am coming late for this thread and I do have a cute implementation
of Fibonacci series!!! it is the smallest I have ever seen but I think
it's overflowing somewhere, but it should be awarded "fib
implementation I want printed on a shirt" award.

function fib k
    put (1 + sqrt(5)) / 2 into r
    put 1 - r into t
    return (r ^ k - t ^ k) / (r - t)
end fib

yes that is it, 3 lines... I know it to be running accurate up to
fib(65) then very accurate until fib(70), then it overflows
somewhere... silly powers, always exploding my integers.

and before someone think I am a math genius, that implementation is
not mine, I came across it sometime ago and ported it to rev.

cheers
andre



More information about the use-livecode mailing list