X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=testub10.git;a=blobdiff_plain;f=codeb%2Fgeorg_fib_028.0;fp=codeb%2Fgeorg_fib_028.0;h=a0e88d7a4ea061357ee169376124c42b3325c427;hp=0000000000000000000000000000000000000000;hb=27a25a801685b1155b267461e0db013e97c30d64;hpb=d2375fee6a547b3dab989f24818a4290c4091d54 diff --git a/codeb/georg_fib_028.0 b/codeb/georg_fib_028.0 new file mode 100644 index 0000000..a0e88d7 --- /dev/null +++ b/codeb/georg_fib_028.0 @@ -0,0 +1,23 @@ +/* fibonacci */ + +/* F_0 = 0 */ +/* F_1 = 1 */ +/* F_n = F_{n-1} + F_{n-2} */ + +method fib(x) + var a := 0; + var b := 1; + if x < 2 + then + return x; + end; + while not (x < 2) + do + var A := a; + a := b; + b := 0-b; + b := A-b; + x := x-1; + end; + return b; +end;