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