Jump to content

Arithmetic-geometric mean: Difference between revisions

Added Easylang
imported>Schraf
(Shorter version)
(Added Easylang)
Line 1,300:
 
You can change the precision (200 by default)
 
=={{header|EasyLang}}==
{{trans|AWK}}
<syntaxhighlight lang=easylang>
func agm a g .
repeat
a0 = a
a = (a0 + g) / 2
g = sqrt (a0 * g)
until abs (a0 - a) < abs (a) * 1e-15
.
return a
.
print agm 1 sqrt 0.5
</syntaxhighlight>
 
=={{header|EchoLisp}}==
1,988

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.