Continued fraction: Difference between revisions
m
→{{header|Picat}}: Added subsections, added {{out}}
Drkameleon (talk | contribs) |
m (→{{header|Picat}}: Added subsections, added {{out}}) |
||
Line 2,306:
For Pi a test is added with a higher precision (200 -> 2000) to get a better result.
===Recursion===
{{trans|Prolog}}
<lang Picat>go =>
Line 2,353 ⟶ 2,354:
V is (2 * N - 1)*(2 * N - 1).</lang>
{{out}}
<pre>
sqrt(2) = 1.414213562373095 (diff: 0.000000000000000)
Line 2,361 ⟶ 2,362:
</pre>
===Iterative===
Then an iterative version (from Python's Fast Iterative version)▼
{{trans|Python}}
<lang Picat>continued_fraction_it(Fun, N) = Ret =>
Temp = 0.0,
|