From 27a25a801685b1155b267461e0db013e97c30d64 Mon Sep 17 00:00:00 2001 From: Georg Schiesser Date: Wed, 26 May 2010 18:52:18 +0200 Subject: [PATCH] codeb fibonacci testfaelle --- codeb/georg_fib_000.call | 2 ++ codeb/georg_fib_001.0 | 21 +++++++++++++++++++++ codeb/georg_fib_001.call | 1 + codeb/georg_fib_020.call | 2 ++ codeb/georg_fib_021.0 | 20 ++++++++++++++++++++ codeb/georg_fib_021.call | 1 + codeb/georg_fib_022.0 | 19 +++++++++++++++++++ codeb/georg_fib_022.call | 1 + codeb/georg_fib_023.0 | 21 +++++++++++++++++++++ codeb/georg_fib_023.call | 1 + codeb/georg_fib_024.0 | 20 ++++++++++++++++++++ codeb/georg_fib_024.call | 1 + codeb/georg_fib_025.0 | 19 +++++++++++++++++++ codeb/georg_fib_025.call | 1 + codeb/georg_fib_026.0 | 19 +++++++++++++++++++ codeb/georg_fib_026.call | 1 + codeb/georg_fib_027.0 | 20 ++++++++++++++++++++ codeb/georg_fib_027.call | 1 + codeb/georg_fib_028.0 | 23 +++++++++++++++++++++++ codeb/georg_fib_028.call | 1 + codeb/georg_fib_040.call | 3 +++ codeb/georg_fib_041.0 | 21 +++++++++++++++++++++ codeb/georg_fib_041.call | 1 + codeb/georg_fib_042.0 | 21 +++++++++++++++++++++ codeb/georg_fib_042.call | 1 + codeb/georg_fib_043.0 | 22 ++++++++++++++++++++++ codeb/georg_fib_043.call | 1 + codeb/georg_fib_044.0 | 24 ++++++++++++++++++++++++ codeb/georg_fib_044.call | 1 + 29 files changed, 290 insertions(+) create mode 100644 codeb/georg_fib_000.call create mode 100644 codeb/georg_fib_001.0 create mode 120000 codeb/georg_fib_001.call create mode 100644 codeb/georg_fib_020.call create mode 100644 codeb/georg_fib_021.0 create mode 120000 codeb/georg_fib_021.call create mode 100644 codeb/georg_fib_022.0 create mode 120000 codeb/georg_fib_022.call create mode 100644 codeb/georg_fib_023.0 create mode 120000 codeb/georg_fib_023.call create mode 100644 codeb/georg_fib_024.0 create mode 120000 codeb/georg_fib_024.call create mode 100644 codeb/georg_fib_025.0 create mode 120000 codeb/georg_fib_025.call create mode 100644 codeb/georg_fib_026.0 create mode 120000 codeb/georg_fib_026.call create mode 100644 codeb/georg_fib_027.0 create mode 120000 codeb/georg_fib_027.call create mode 100644 codeb/georg_fib_028.0 create mode 120000 codeb/georg_fib_028.call create mode 100644 codeb/georg_fib_040.call create mode 100644 codeb/georg_fib_041.0 create mode 120000 codeb/georg_fib_041.call create mode 100644 codeb/georg_fib_042.0 create mode 120000 codeb/georg_fib_042.call create mode 100644 codeb/georg_fib_043.0 create mode 120000 codeb/georg_fib_043.call create mode 100644 codeb/georg_fib_044.0 create mode 120000 codeb/georg_fib_044.call diff --git a/codeb/georg_fib_000.call b/codeb/georg_fib_000.call new file mode 100644 index 0000000..e04b865 --- /dev/null +++ b/codeb/georg_fib_000.call @@ -0,0 +1,2 @@ +extern long fib(long); +RET(fib(-1)==-1 && fib(0)==0 && fib(1)==1 && fib(2)==1 && fib(3)==2 && fib(7)+fib(8)==fib(9)); diff --git a/codeb/georg_fib_001.0 b/codeb/georg_fib_001.0 new file mode 100644 index 0000000..17f99e4 --- /dev/null +++ b/codeb/georg_fib_001.0 @@ -0,0 +1,21 @@ +/* fibonacci */ + +/* F_0 = 0 */ +/* F_1 = 1 */ +/* F_n = F_{n-1} + F_{n-2} */ + +method fib() + if this < 2 then return this; end; + var a := 0; + var b := 1; + var c := this; + var x := this; + while not (x < 2) + do + c := a-(0-b); + a := b; + b := c; + x := x-1; + end; + return c; +end; diff --git a/codeb/georg_fib_001.call b/codeb/georg_fib_001.call new file mode 120000 index 0000000..6ee1412 --- /dev/null +++ b/codeb/georg_fib_001.call @@ -0,0 +1 @@ +georg_fib_000.call \ No newline at end of file diff --git a/codeb/georg_fib_020.call b/codeb/georg_fib_020.call new file mode 100644 index 0000000..dbf1d12 --- /dev/null +++ b/codeb/georg_fib_020.call @@ -0,0 +1,2 @@ +extern long fib(long,long); +RET(fib(0,-1)==-1 && fib(0,0)==0 && fib(0,1)==1 && fib(0,2)==1 && fib(0,3)==2 && fib(0,7)+fib(0,8)==fib(0,9)); diff --git a/codeb/georg_fib_021.0 b/codeb/georg_fib_021.0 new file mode 100644 index 0000000..f0c2f9d --- /dev/null +++ b/codeb/georg_fib_021.0 @@ -0,0 +1,20 @@ +/* fibonacci */ + +/* F_0 = 0 */ +/* F_1 = 1 */ +/* F_n = F_{n-1} + F_{n-2} */ + +method fib(x) + if x < 2 then return x; end; + var a := 0; + var b := 1; + var c := x; + while not (x < 2) + do + c := a-(0-b); + a := b; + b := c; + x := x-1; + end; + return c; +end; diff --git a/codeb/georg_fib_021.call b/codeb/georg_fib_021.call new file mode 120000 index 0000000..e41caeb --- /dev/null +++ b/codeb/georg_fib_021.call @@ -0,0 +1 @@ +georg_fib_020.call \ No newline at end of file diff --git a/codeb/georg_fib_022.0 b/codeb/georg_fib_022.0 new file mode 100644 index 0000000..b2ea26c --- /dev/null +++ b/codeb/georg_fib_022.0 @@ -0,0 +1,19 @@ +/* fibonacci */ + +/* F_0 = 0 */ +/* F_1 = 1 */ +/* F_n = F_{n-1} + F_{n-2} */ + +method fib(x) + var a := 0; + var b := 1; + var c := x; + while not (x < 2) + do + c := a-(0-b); + a := b; + b := c; + x := x-1; + end; + return c; +end; diff --git a/codeb/georg_fib_022.call b/codeb/georg_fib_022.call new file mode 120000 index 0000000..e41caeb --- /dev/null +++ b/codeb/georg_fib_022.call @@ -0,0 +1 @@ +georg_fib_020.call \ No newline at end of file diff --git a/codeb/georg_fib_023.0 b/codeb/georg_fib_023.0 new file mode 100644 index 0000000..fe8cb87 --- /dev/null +++ b/codeb/georg_fib_023.0 @@ -0,0 +1,21 @@ +/* fibonacci */ + +/* F_0 = 0 */ +/* F_1 = 1 */ +/* F_n = F_{n-1} + F_{n-2} */ + +method fib(x) + var a := 0; + var b := 1; + var c := x; + while not (x < 2) + do + var A := a; + var B := b; + a := B; + b := A-(0-B); + c := b; + x := x-1; + end; + return c; +end; diff --git a/codeb/georg_fib_023.call b/codeb/georg_fib_023.call new file mode 120000 index 0000000..e41caeb --- /dev/null +++ b/codeb/georg_fib_023.call @@ -0,0 +1 @@ +georg_fib_020.call \ No newline at end of file diff --git a/codeb/georg_fib_024.0 b/codeb/georg_fib_024.0 new file mode 100644 index 0000000..f1b037c --- /dev/null +++ b/codeb/georg_fib_024.0 @@ -0,0 +1,20 @@ +/* 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; + var B := b; + a := B; + b := A-(0-B); + x := x-1; + end; + return b; +end; diff --git a/codeb/georg_fib_024.call b/codeb/georg_fib_024.call new file mode 120000 index 0000000..e41caeb --- /dev/null +++ b/codeb/georg_fib_024.call @@ -0,0 +1 @@ +georg_fib_020.call \ No newline at end of file diff --git a/codeb/georg_fib_025.0 b/codeb/georg_fib_025.0 new file mode 100644 index 0000000..673e43c --- /dev/null +++ b/codeb/georg_fib_025.0 @@ -0,0 +1,19 @@ +/* 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 := A-(0-b); + x := x-1; + end; + return b; +end; diff --git a/codeb/georg_fib_025.call b/codeb/georg_fib_025.call new file mode 120000 index 0000000..e41caeb --- /dev/null +++ b/codeb/georg_fib_025.call @@ -0,0 +1 @@ +georg_fib_020.call \ No newline at end of file diff --git a/codeb/georg_fib_026.0 b/codeb/georg_fib_026.0 new file mode 100644 index 0000000..983f882 --- /dev/null +++ b/codeb/georg_fib_026.0 @@ -0,0 +1,19 @@ +/* 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 := b-(0-A); + x := x-1; + end; + return b; +end; diff --git a/codeb/georg_fib_026.call b/codeb/georg_fib_026.call new file mode 120000 index 0000000..e41caeb --- /dev/null +++ b/codeb/georg_fib_026.call @@ -0,0 +1 @@ +georg_fib_020.call \ No newline at end of file diff --git a/codeb/georg_fib_027.0 b/codeb/georg_fib_027.0 new file mode 100644 index 0000000..d10cd9a --- /dev/null +++ b/codeb/georg_fib_027.0 @@ -0,0 +1,20 @@ +/* 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; diff --git a/codeb/georg_fib_027.call b/codeb/georg_fib_027.call new file mode 120000 index 0000000..e41caeb --- /dev/null +++ b/codeb/georg_fib_027.call @@ -0,0 +1 @@ +georg_fib_020.call \ No newline at end of file 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; diff --git a/codeb/georg_fib_028.call b/codeb/georg_fib_028.call new file mode 120000 index 0000000..e41caeb --- /dev/null +++ b/codeb/georg_fib_028.call @@ -0,0 +1 @@ +georg_fib_020.call \ No newline at end of file diff --git a/codeb/georg_fib_040.call b/codeb/georg_fib_040.call new file mode 100644 index 0000000..29e7471 --- /dev/null +++ b/codeb/georg_fib_040.call @@ -0,0 +1,3 @@ +long s[]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}; +extern long fib(long *,long); +RET(fib(s,-1)==-1 && fib(s,0)==0 && fib(s,1)==1 && fib(s,2)==1 && fib(s,3)==2 && fib(s,7)+fib(s,8)==fib(s,9)); diff --git a/codeb/georg_fib_041.0 b/codeb/georg_fib_041.0 new file mode 100644 index 0000000..1daf7d1 --- /dev/null +++ b/codeb/georg_fib_041.0 @@ -0,0 +1,21 @@ +/* fibonacci */ + +/* F_0 = 0 */ +/* F_1 = 1 */ +/* F_n = F_{n-1} + F_{n-2} */ + +struct f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 end; + +method fib(x) + if x < 0 then return -1; end; f0 := 0; + if x < 1 then return f0; end; f1 := 1; + if x < 2 then return f1; end; f2 := 1; + if x < 3 then return f2; end; f3 := 2; + if x < 4 then return f3; end; f4 := 3; + if x < 5 then return f4; end; f5 := 5; + if x < 6 then return f5; end; f6 := 8; + if x < 7 then return f6; end; f7 := 13; + if x < 8 then return f7; end; f8 := 21; + if x < 9 then return f8; end; f9 := 34; + return f9; +end; diff --git a/codeb/georg_fib_041.call b/codeb/georg_fib_041.call new file mode 120000 index 0000000..add8f28 --- /dev/null +++ b/codeb/georg_fib_041.call @@ -0,0 +1 @@ +georg_fib_040.call \ No newline at end of file diff --git a/codeb/georg_fib_042.0 b/codeb/georg_fib_042.0 new file mode 100644 index 0000000..96c17d7 --- /dev/null +++ b/codeb/georg_fib_042.0 @@ -0,0 +1,21 @@ +/* fibonacci */ + +/* F_0 = 0 */ +/* F_1 = 1 */ +/* F_n = F_{n-1} + F_{n-2} */ + +struct f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 end; + +method fib(x) + if x < 0 then return -1; end; f0 := 0; + if x < 1 then return f0; end; f1 := 1; + if x < 2 then return f1; end; f2 := f0-(0-f1); + if x < 3 then return f2; end; f3 := f1-(0-f2); + if x < 4 then return f3; end; f4 := f2-(0-f3); + if x < 5 then return f4; end; f5 := f3-(0-f4); + if x < 6 then return f5; end; f6 := f4-(0-f5); + if x < 7 then return f6; end; f7 := f5-(0-f6); + if x < 8 then return f7; end; f8 := f6-(0-f7); + if x < 9 then return f8; end; f9 := f7-(0-f8); + return f9; +end; diff --git a/codeb/georg_fib_042.call b/codeb/georg_fib_042.call new file mode 120000 index 0000000..add8f28 --- /dev/null +++ b/codeb/georg_fib_042.call @@ -0,0 +1 @@ +georg_fib_040.call \ No newline at end of file diff --git a/codeb/georg_fib_043.0 b/codeb/georg_fib_043.0 new file mode 100644 index 0000000..4db524a --- /dev/null +++ b/codeb/georg_fib_043.0 @@ -0,0 +1,22 @@ +/* fibonacci */ + +/* F_0 = 0 */ +/* F_1 = 1 */ +/* F_n = F_{n-1} + F_{n-2} */ + +struct f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 end; + +method fib(x) + var t := this; + if x < 0 then return -1; end; t.f0 := 0; + if x < 1 then return f0; end; t.f1 := 1; + if x < 2 then return f1; end; t.f2 := t.f0-(0-t.f1); t := t--8; + if x < 3 then return f2; end; t.f2 := t.f0-(0-t.f1); t := t--8; + if x < 4 then return f3; end; t.f2 := t.f0-(0-t.f1); t := t--8; + if x < 5 then return f4; end; t.f2 := t.f0-(0-t.f1); t := t--8; + if x < 6 then return f5; end; t.f2 := t.f0-(0-t.f1); t := t--8; + if x < 7 then return f6; end; t.f2 := t.f0-(0-t.f1); t := t--8; + if x < 8 then return f7; end; t.f2 := t.f0-(0-t.f1); t := t--8; + if x < 9 then return f8; end; t.f2 := t.f0-(0-t.f1); t := t--8; + return f9; +end; diff --git a/codeb/georg_fib_043.call b/codeb/georg_fib_043.call new file mode 120000 index 0000000..add8f28 --- /dev/null +++ b/codeb/georg_fib_043.call @@ -0,0 +1 @@ +georg_fib_040.call \ No newline at end of file diff --git a/codeb/georg_fib_044.0 b/codeb/georg_fib_044.0 new file mode 100644 index 0000000..c8e1a16 --- /dev/null +++ b/codeb/georg_fib_044.0 @@ -0,0 +1,24 @@ +/* fibonacci */ + +/* F_0 = 0 */ +/* F_1 = 1 */ +/* F_n = F_{n-1} + F_{n-2} */ + +struct a b c end; + +method fib(x) + if x < 0 then return x; end; + a := 0; + if x < 1 then return x; end; + b := 1; + if x < 2 then return x; end; + var t := this; + + while not (x < 2) + do + t.c := t.a-(0-t.b); + t := t--8; + x := x-1; + end; + return (t-8).c; +end; diff --git a/codeb/georg_fib_044.call b/codeb/georg_fib_044.call new file mode 120000 index 0000000..add8f28 --- /dev/null +++ b/codeb/georg_fib_044.call @@ -0,0 +1 @@ +georg_fib_040.call \ No newline at end of file -- 2.25.1