summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/bench/shootout/obsolete/takfp.pp
blob: 6fc772003c625a80a6ec258c8132e54d6bf0289f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
program takfp;

{$mode objfpc}

uses SysUtils;

function Tak(const x, y, z: double): double;
begin
  if y >= x then Tak:=z else
    Tak:=Tak(Tak(x-1,y,z), Tak(y-1,z,x), Tak(z-1,x,y));
end;

var n: integer;
begin
  if paramcount<1 then n:=1
    else n:=StrToInt(paramstr(1));
  writeln(Tak(n*3, n*2, n*1):0:1);
end.