Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
62
Task/Pi/NetRexx/pi.netrexx
Normal file
62
Task/Pi/NetRexx/pi.netrexx
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
/* NetRexx */
|
||||
options replace format comments java crossref symbols binary
|
||||
import java.math.BigInteger
|
||||
|
||||
runSample(arg)
|
||||
return
|
||||
|
||||
-- 07:11, 27 August 2022 (UTC)07:11, 27 August 2022 (UTC)07:11, 27 August 2022 (UTC)07:11, 27 August 2022 (UTC)07:11, 27 August 2022 (UTC)07:11, 27 August 2022 (UTC)07:11, 27 August 2022 (UTC)07:11, 27 August 2022 (UTC)07:11, 27 August 2022 (UTC)07:11, 27 August 2022 (UTC)07:11, 27 August 2022 (UTC)07:11, 27 August 2022 (UTC)07:11, 27 August 2022 (UTC)07:11, 27 August 2022 (UTC)07:11, 27 August 2022 (UTC)~~
|
||||
method runSample(arg) private static
|
||||
parse arg places .
|
||||
if places = '' then places = -1
|
||||
|
||||
TWO = BigInteger.valueOf(2)
|
||||
THREE = BigInteger.valueOf(3)
|
||||
FOUR = BigInteger.valueOf(4)
|
||||
SEVEN = BigInteger.valueOf(7)
|
||||
|
||||
q_ = BigInteger.ONE
|
||||
r_ = BigInteger.ZERO
|
||||
t_ = BigInteger.ONE
|
||||
k_ = BigInteger.ONE
|
||||
n_ = BigInteger.valueOf(3)
|
||||
l_ = BigInteger.valueOf(3)
|
||||
|
||||
nn = BigInteger
|
||||
nr = BigInteger
|
||||
|
||||
first = isTrue()
|
||||
digitCt = 0
|
||||
loop forever
|
||||
if FOUR.multiply(q_).add(r_).subtract(t_).compareTo(n_.multiply(t_)) == -1 then do
|
||||
digitCt = digitCt + 1
|
||||
if places > 0 & digitCt - 1 > places then leave
|
||||
say n_'\-'
|
||||
if first then do
|
||||
say '.\-'
|
||||
first = isFalse()
|
||||
end
|
||||
nr = BigInteger.TEN.multiply(r_.subtract(n_.multiply(t_)))
|
||||
n_ = BigInteger.TEN.multiply(THREE.multiply(q_).add(r_)).divide(t_).subtract(BigInteger.TEN.multiply(n_))
|
||||
q_ = q_.multiply(BigInteger.TEN)
|
||||
r_ = nr
|
||||
end
|
||||
else do
|
||||
nr = TWO.multiply(q_).add(r_).multiply(l_)
|
||||
nn = q_.multiply((SEVEN.multiply(k_))).add(TWO).add(r_.multiply(l_)).divide(t_.multiply(l_))
|
||||
q_ = q_.multiply(k_)
|
||||
t_ = t_.multiply(l_)
|
||||
l_ = l_.add(TWO)
|
||||
k_ = k_.add(BigInteger.ONE)
|
||||
n_ = nn
|
||||
r_ = nr
|
||||
end
|
||||
end
|
||||
say
|
||||
|
||||
return
|
||||
|
||||
method isTrue() private static returns boolean
|
||||
return (1 == 1)
|
||||
method isFalse() private static returns boolean
|
||||
return \isTrue()
|
||||
Loading…
Add table
Add a link
Reference in a new issue