;example by joachim heintz
giFt ftgen 0, 0, -12, -2, 0
instr 1; calculates first 12 fibonacci values and writes them to giFt
istart = 1
inext = 2
indx = 0
loop:
tableiw istart, indx, giFt ;writes istart to table
istartold = istart ;keep previous value of istart
istart = inext ;reset istart for next loop
inext = istartold + inext ;reset inext for next loop
loop_lt indx, 1, 12, loop
endin
instr 2; prints the values of the table
prints "%nContent of Function Table:%n"
indx init 0
loop:
ival table indx, giFt
prints "Index %d = %f%n", indx, ival
loop_lt indx, 1, ftlen(giFt), loop
endin
i 1 0 0
i 2 0 0