Arithmetic-geometric mean: Difference between revisions

Arithmetic-geometric mean in Chipmunk Basic
(added Arturo)
(Arithmetic-geometric mean in Chipmunk Basic)
Line 435:
0.84721308479
</pre>
 
==={{header|Chipmunk Basic}}===
{{works with|Chipmunk Basic|3.6.4}}
<syntaxhighlight lang="qbasic">10 print agm(1,1/sqr(2))
20 end
100 sub agm(a,g)
110 do
120 let ta = (a+g)/2
130 let g = sqr(a*g)
140 let x = a
150 let a = ta
160 let ta = x
170 loop until a = ta
180 agm = a
190 end sub</syntaxhighlight>
{{out}}
<pre>0.847213</pre>
 
==={{header|Commodore BASIC}}===
2,122

edits