RosettaCodeData/Task/Arithmetic-geometric-mean/XPL0/arithmetic-geometric-mean.xpl0
Ingy döt Net d066446780 langs a-z
2013-04-10 22:43:41 -07:00

10 lines
199 B
Text

include c:\cxpl\codesi;
real A, A1, G;
[Format(0, 16);
A:= 1.0; G:= 1.0/sqrt(2.0);
repeat A1:= (A+G)/2.0;
G:= sqrt(A*G);
A:= A1;
RlOut(0, A); RlOut(0, G); RlOut(0, A-G); CrLf(0);
until A=G;
]