add some comment and tests (but small bugs still there)
This commit is contained in:
@ -1,13 +1,13 @@
|
||||
def fibonaccit(n)
|
||||
a = 0
|
||||
b = 1
|
||||
while( n > 1 ) do
|
||||
tmp = a
|
||||
a = b
|
||||
b = tmp + b
|
||||
putstring(b)
|
||||
n = n - 1
|
||||
end
|
||||
def fibonaccit(n) # n == r0
|
||||
a = 0 # a == r1
|
||||
b = 1 # b = r2
|
||||
while( n > 1 ) do #BUG comment lines + comments behind function calls
|
||||
tmp = a # r3 <- r1
|
||||
a = b # r1 <- r2
|
||||
b = tmp + b # r4 = r2 + r3 (r4 transient) r2 <- r4
|
||||
putstring(b)
|
||||
n = n - 1 # r2 <- 0 ???? #call ok
|
||||
end #r5 <- r0 - 1 # r0 <- r5
|
||||
end
|
||||
|
||||
fibonaccit( 10 )
|
||||
|
Reference in New Issue
Block a user