Continued fraction: Difference between revisions
Added Quackery.
SqrtNegInf (talk | contribs) m (→{{header|Perl}}: boilerplate, subroutine signature, formatting for clarity) |
(Added Quackery.) |
||
Line 2,361:
2.7182818284590452353602874713526624977572470937000
3.1415926839198062649342019294083175420335002640134</pre>
=={{header|Quackery}}==
<lang Quackery> [ $ "bigrat.qky" loadfile ] now!
[ 1 min
[ table
[ 1 1 ]
[ 2 1 ] ] do ] is sqrt2 ( n --> n/d )
[ dup 2 min
[ table
[ drop 2 1 ]
[ 1 ]
[ dup 1 - ] ] do ] is napier ( n --> n/d )
[ dup 1 min
[ table
[ drop 3 1 ]
[ 2 * 1 - dup *
6 swap ] ] do ] is pi ( n --> n/d )
[ ]'[ temp put
0 1
rot times
[ i 1+
temp share do
v+ 1/v ]
0 temp take do v+ ] is cf ( n --> n/d )
1000 cf sqrt2 10 point$ echo$ cr
1000 cf napier 10 point$ echo$ cr
1000 cf pi 10 point$ echo$ cr</lang>
{{out}}
<pre>1.4142135624
2.7136688544
3.1413776152</pre>
=={{header|Racket}}==
|