Continued fraction: Difference between revisions
→Julia
(→Julia) |
|||
Line 1,912:
=={{header|Julia}}==
{{works with|Julia|1.
<syntaxhighlight lang="julia">
# julias iterators allow lazy evaluation on demand
using .Iterators, .MathConstants, Printf
function cf(a₀, a, b = repeated(1))
m = BigInt[a₀ 1; 1 0]
coeffs = zip(a, b)
Line 1,929:
for (k, v) in [
:(π) => cf(3, repeated(6), (k^2 for k ∈
@printf "%2s: %.9f ≈ %.9f\n" k v eval(k)
end
{{out}}
|