>>298 それってこれと同じじゃないの?
type TPai = Extended;
function getpi: TPai;
function Hypot(x,y:TPai):TPai;
var w:TPai;
begin
x:=x*x+y*y;
Result:=Sqrt(x);
Result:=Result + (x-Result*Result)/Result/2; //精度を少しだけあげる
end;
var x,y ,x1,x2,y1,y2,g,r,len:TPai; i:integer;
begin
x1:=0; y1:=1; x2:=1; y2:=0; //直角2等辺3角形
g:=2;
for i:=0 to 30 do begin
x := (x1 + x2) / 2; y := (y1 + y2) / 2; r :=hypot(x,y);
x1:= x/r; y1:= y/r; len:=Hypot(x2-x1,y2-y1);
g:=g*2;
writeln(i,Format('%22.18f',[g*len]));
end;
Result:=g*len;
end;
var ct: Cardinal;
begin
ct := GetTickCount;
Write(Format('%22.18f',[getPi]));
Writeln(Format('%22.18f',[System.Pi]));
Writeln(' time=', GetTickCount-ct, 'ms');
Readln;
end.