tolerance; default 1e-6 to make a nicer appearance for
pi.
Value
Either a numeric value, or a list with components cf, numeric vector
representing the continuous fraction $[b_0; b_1, \ldots, b_{n-1}]$;
rat, the rational number as a vector with (numerator, denumerator);
and prec, the difference between x and the value of the
contimuous fraction.
Details
If x is a scalar its continuous fraction will be generated up to
the accuracy prescribed in tol. If it is of length greater 1, the
function assumes this is a continuous fraction and computes its value.
For implementation contfrac uses the representation of continuous
fractions through 2-by-2 matrices, i.e. the recursion formula.
References
Hardy, G. H., and E. M. Wright (1979). An Introduction to the Theory of
Numbers. Fifth Edition, Oxford University Press, New York.