Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,24 @@
|
|||
/* NetRexx */
|
||||
options replace format comments java crossref symbols nobinary
|
||||
|
||||
numeric digits 18
|
||||
parse arg a_ g_ .
|
||||
if a_ = '' | a_ = '.' then a0 = 1
|
||||
else a0 = a_
|
||||
if g_ = '' | g_ = '.' then g0 = 1 / Math.sqrt(2)
|
||||
else g0 = g_
|
||||
|
||||
say agm(a0, g0)
|
||||
|
||||
return
|
||||
|
||||
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
method agm(a0, g0) public static returns Rexx
|
||||
a1 = a0
|
||||
g1 = g0
|
||||
loop while (a1 - g1).abs() >= Math.pow(10, -14)
|
||||
temp = (a1 + g1) / 2
|
||||
g1 = Math.sqrt(a1 * g1)
|
||||
a1 = temp
|
||||
end
|
||||
return a1 + 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue