Pi: Difference between revisions
→{{header|Ruby}}: Adapted to use Enumerator; simplified handling of dot.
(Added Visual Basic.NET translation from C#) |
(→{{header|Ruby}}: Adapted to use Enumerator; simplified handling of dot.) |
||
Line 3,794:
=={{header|Ruby}}==
{{trans|Icon}}
<lang ruby>
q, r, t, k, n, l = 1, 0, 1, 1, 3, 3
loop do
if 4*q+r-t < n*t
nr = 10*(r-n*t)
n = ((10*(3*q+r)) / t) - 10*n
Line 3,821 ⟶ 3,816:
end
print pi_digits.next, "."
loop { print pi_digits.next }</lang>
=={{header|Scala}}==
<lang scala>object Pi {
|