Arithmetic-geometric mean: Difference between revisions
→{{header|BASIC}}: Dialects in alphabetic order.
m (→{{header|BASIC}}: Dialects in alphabetic order.) |
(→{{header|BASIC}}: Dialects in alphabetic order.) |
||
Line 415:
<pre>
0.84721308479
</pre>▼
==={{header|BBC BASIC}}===▼
{{works with|BBC BASIC for Windows}}▼
<syntaxhighlight lang="bbcbasic"> *FLOAT 64▼
@% = &1010▼
PRINT FNagm(1, 1/SQR(2))▼
END▼
DEF FNagm(a,g)▼
LOCAL ta▼
REPEAT▼
ta = a▼
a = (a+g)/2▼
g = SQR(ta*g)▼
UNTIL a = ta▼
= a▼
</syntaxhighlight>▼
Produces this output:▼
<pre>▼
0.8472130847939792▼
</pre>
Line 445 ⟶ 466:
130 IF A<TA THEN 100
140 RETURN</syntaxhighlight>
▲==={{header|BBC BASIC}}===
▲{{works with|BBC BASIC for Windows}}
▲<syntaxhighlight lang="bbcbasic"> *FLOAT 64
▲ @% = &1010
▲ PRINT FNagm(1, 1/SQR(2))
▲ END
▲ DEF FNagm(a,g)
▲ LOCAL ta
▲ REPEAT
▲ ta = a
▲ a = (a+g)/2
▲ g = SQR(ta*g)
▲ UNTIL a = ta
▲ = a
▲</syntaxhighlight>
▲Produces this output:
▲<pre>
▲0.8472130847939792
▲</pre>
==={{header|GW-BASIC}}===
|