RosettaCodeData/Task/Arithmetic-geometric-mean/Logo/arithmetic-geometric-mean.logo

10 lines
209 B
Text
Raw Permalink Normal View History

2013-06-05 21:47:54 +00:00
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