Pi: Difference between revisions
→{{header|Scala}}
(→{{header|Scala}}: added dots and some spaces) |
|||
Line 4,635:
var q, t, k: BigInt = 1
var n, l: BigInt = 3
def iterator: Iterator[BigInt] = new Iterator[BigInt] {
Line 4,642 ⟶ 4,641:
def next(): BigInt = {
while ((4 * q + r - t) >= (n * t)) {
val nr = (2 * q + r) * l
val nn = (q * (7 * k) + 2 + (r * l)) / (t * l)
q = q * k
t = t * l
Line 4,652 ⟶ 4,651:
}
val ret = n
val nr = 10 * (r - n * t)
n = ((10 * (3 * q + r)) / t) - (10 * n)
q = q * 10
|