Continued fraction: Difference between revisions
m
→{{header|Perl 6}}: fixed my own typo
SqrtNegInf (talk | contribs) |
SqrtNegInf (talk | contribs) m (→{{header|Perl 6}}: fixed my own typo) |
||
Line 1,392:
printf "√2 ≈%.9f\n", continued-fraction(:a(1, |(2 xx *)), :b(Nil, |(1 xx *)));
printf "e ≈%.9f\n", continued-fraction(:a(2, |(1 .. *)), :b(Nil, 1, |(1 .. *)));
printf "π ≈%.9f\n", continued-fraction(:a(3, |(6 xx *)), :b(Nil, |((1, 3, 5 ... *) X** 2)));</lang>
{{out}}
<pre>√2 ≈ 1.414213562
|