RosettaCodeData/Task/Arithmetic-geometric-mean/VBScript/arithmetic-geometric-mean.vb

11 lines
145 B
VB.net
Raw Permalink Normal View History

2015-11-18 06:14:39 +00:00
Function agm(a,g)
Do Until a = tmp_a
tmp_a = a
a = (a + g)/2
g = Sqr(tmp_a * g)
Loop
agm = a
End Function
WScript.Echo agm(1,1/Sqr(2))