Arithmetic-geometric mean: Difference between revisions
Content added Content deleted
(Arithmetic-geometric mean in Chipmunk Basic) |
(add RPL) |
||
Line 2,708: | Line 2,708: | ||
return gn |
return gn |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
=={{header|RPL}}== |
|||
≪ 1E-10 → epsilon |
|||
≪ '''WHILE''' DUP2 - ABS epsilon > '''REPEAT''' |
|||
DUP2 + 2 / ROT ROT * √ |
|||
'''END''' DROP |
|||
≫ ≫ ‘'''AGM'''’ STO |
|||
{{in}} |
|||
<pre> |
|||
1 2 / √ AGM |
|||
</pre> |
|||
{{out}} |
|||
<pre> |
|||
1: .847213084835 |
|||
</pre> |
|||
=={{header|Ruby}}== |
=={{header|Ruby}}== |