Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,31 @@
{def eps 1e-15}
-> eps
{def agm
{lambda {:a :g}
{if {> {abs {- :a :g}} {eps}}
then {agm {/ {+ :a :g} 2}
{sqrt {* :a :g}}}
else :a }}}
-> agm
{agm 1 {/ 1 {sqrt 2}}}
-> 0.8472130847939792
Multi-precision version using the lib_BN library
{BN.DEC 70}
-> 70 digits
{def EPS {BN./ 1 {BN.pow 10 45}}}
-> EPS
{def AGM
{lambda {:a :g}
{if {= {BN.compare {BN.abs {BN.- :a :g}} {EPS}} 1}
then {AGM {BN./ {BN.+ :a :g} 2}
{BN.sqrt {BN.* :a :g}}}
else :a }}}
-> AGM
{AGM 1 {BN./ 1 {BN.sqrt 2}}}
-> 0.8472130847939790866064991234821916364814459103269421850605793726597339