Arithmetic-geometric mean: Difference between revisions
m
→{{header|Lambdatalk}}
No edit summary |
|||
Line 1,549:
=={{header|Lambdatalk}}==
<syntaxhighlight lang="Scheme">
{def eps 1e-15}
-> eps
{def agm
{
else :
▲ {lambda {:a0 :g0}
-> agm
Line 1,562 ⟶ 1,563:
-> 0.8472130847939792
{BN.DEC 70} ▼
-> 70 digits▼
-> EPS
{def AGM
{if {= {BN.compare {BN.abs {BN.- :a :g}} {EPS}} 1}
▲ {lambda {:a0 :g0}
▲ {BN./ 1 {BN.pow 10 45}}}}}
-> AGM
▲{BN.DEC 70}
▲-> 70 digits
{AGM 1 {BN./ 1 {BN.sqrt 2}}}
-> 0.8472130847939790866064991234821916364814459103269421850605793726597339
</syntaxhighlight>
=={{header|LFE}}==
|