Continued fraction: Difference between revisions

m
Line 65:
=={{header|Axiom}}==
Axiom provides a ContinuedFraction domain:
<lang Axiom>get(obj) == convergents(obj).1000 :: Float -- utility to extract the 1000th value
get continuedFraction(1, repeating [1], repeating [2])
get continuedFraction(2, cons(1,[i for i in 1..]), [i for i in 1..])
Line 77:
(3) 3.1415926538 39792926
Type: Float</lang>
The value of pi has an accuracy to only 9 decimal places after 1000 iterations, with an accuracy to 12 decimal places after 10000 iterations.
 
We could re-implement this, with the same output:<lang Axiom>cf(initial:Integer,a:Stream(Integer),b:Stream(Integer),_
n:PositiveInteger):Fraction(Integer) ==
136

edits