RosettaCodeData/Task/Arithmetic-geometric-mean/BASIC256/arithmetic-geometric-mean.basic

15 lines
153 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
print AGM(1, 1 / sqr(2))
end
function AGM(a, g)
Do
ta = (a + g) / 2
g = sqr(a * g)
x = a
a = ta
ta = x
until a = ta
return a
end function