 program pimachin;  {1000 Stellen, mit der Formel von Machin berechnet}
 uses crt,dos;      { pi/4 = 4 arctan(1/5) - arctan(1/239) }

  const n=1005;{5 Sicherheitsstellen}
  var i,j,k,m,nr,di:integer;
      c,d,q,u,x:word;
      a:array[1..2,1..n+1] of word;
      ta,te:real;h,mi,se,hs:word;

 procedure divi(y:word);
 begin
  c:=0;for j:=1 to n+1 do
  begin x:=a[nr,j]+c;q:=x div y;a[nr,j]:=q;
  d:=x-y*q;c:=10*d;end;
 end;

 procedure mult(y:word);
 begin
  for j:=1 to n+1 do a[nr,j]:=y*a[nr,j];
  for j:=n+1 downto 2 do
  begin u:=a[nr,j] div 10;a[nr,j-1]:=a[nr,j-1]+u;
  a[nr,j]:=a[nr,j] mod 10;end;
 end;

 procedure atn;
 begin
  a[nr,1]:=1;k:=trunc(n*ln(10)/ln(m)/2);
  for i:=k downto 1 do
  begin
   divi(2*i+1);mult(2*i-1);divi(m);divi(m);
   for j:=2 to n-1 do a[nr,j]:=9-a[nr,j];
   a[nr,n]:=10-a[nr,n];
  end;
  divi(m);
 end;

  Begin
   gettime(h,mi,se,hs);ta:=3600*h+60*mi+se+hs/100;
   clrscr;writeln;
   nr:=1;m:=5;atn;mult(4);
   nr:=2;m:=239;atn;
   for i:=n downto 2 do
   begin
    di:=a[1,i]-a[2,i];
    if di<0 then
    begin di:=di+10;a[1,i-1]:=a[1,i-1]-1;end;
    a[1,i]:=di;
   end;
   nr:=1;mult(4);
   writeln('    ô=3.');write('    ');
   gettime(h,mi,se,hs);te:=3600*h+60*mi+se+hs/100;
   for i:=2 to n-4 do
   begin
    write(a[1,i]);
    if ((i-1) mod 10=0) then write(' ');
    if ((i-1) mod 50=0) then begin write('(',i-1,')');
    writeln;write('    ');end;
   end;
   write('Rechenzeit ',te-ta:3:2,' s');
   repeat until keypressed;
  End.


























</XMP></BODY></HTML>
