RosettaCodeData/Task/Arithmetic-geometric-mean/Logo/arithmetic-geometric-mean.logo
2023-07-01 13:44:08 -04:00

9 lines
209 B
Text

to about :a :b
output and [:a - :b < 1e-15] [:a - :b > -1e-15]
end
to agm :arith :geom
if about :arith :geom [output :arith]
output agm (:arith + :geom)/2 sqrt (:arith * :geom)
end
show agm 1 1/sqrt 2