I hated coding in cobol. Never again I said!
I came across a method recently that made clever use of an array and modulo for an iterative method.
dim f(30)
f(0) = 0
f(1) = 1
f(2) = 1
for i = 2 to 10
f(i mod 3) = f((i+1) mod 3) + f((i+2) mod 3)
print i, ". ", f(i mod 3)
next i
This method is non-iterative nor recursive, but seems to lose precision after the 32nd number in the series. Maybe a DB limitation?
function getFibonacci(n)
f# = sqrt(5)
f1# = ((1+f#) / 2.0) ^ n
f2# = ((1-f#) / 2.0) ^ n
f = floor((f1# - f2#) / f#)
endfunction f