Continued fraction/Arithmetic/Construct from rational number: Difference between revisions
Content deleted Content added
Line 3,423:
then (CF = lazy_list(delay((func) = nil)))
else (CF = lazy_list(delay(Cons)),
((func) =
▲ CF1 = cons(Quotient, r2cf(Denominator, Remainder)),
▲ %% What follows is division with truncation towards
▲ divide_with_rem(Numerator, Denominator,
%%%-------------------------------------------------------------------
Line 3,532 ⟶ 3,529:
{{out}}
<pre>$ mmc --use-subdirs continued_fraction_from_rational_lazy.m && ./continued_fraction_from_rational_lazy
1/2 => [0;2]
3 => [3]
|