RosettaCodeData/Task/Arithmetic-geometric-mean/IS-BASIC/arithmetic-geometric-mean.basic

9 lines
157 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
100 PRINT AGM(1,1/SQR(2))
110 DEF AGM(A,G)
120 DO
130 LET TA=A
140 LET A=(A+G)/2:LET G=SQR(TA*G)
150 LOOP UNTIL A=TA
160 LET AGM=A
170 END DEF