

   CCaallccuullaattee aa RRaattiioonnaall AApppprrooxxiimmaattiioonn bbyy CCoonnttiinnuueedd FFrraaccttiioonnss

        rat(x, leng=6, maxm=100, name="rational.so")

   AArrgguummeennttss::

          x: numeric data object for which the rational approx-
             imation is needed.

       leng: maximum length of the continued fraction used.

       maxm: maximum partial denominator.  If any partial
             denominator exceeds `maxm' the continued fraction
             terminates at that point.

       name: name of object file containing the dynamically
             loaded C function.

   VVaalluuee::

        list of two components, $a and $b, containing the
        numerators and the denominators of the rational approx-
        imations respectively.

        `rat()' can be viewed as providing a speculative way of
        removing roundoff error if the correct answer should be
        rational numbers with "small" denominators.

   SSeeee AAllssoo::

        `rational()' and `fractions()' which use `rat()'

   EExxaammpplleess::

        # solve() accuracy check using a small Hilbert Matrix
            x <- matrix(0,5,5); x <- 1/(row(x) + col(x) -1)
        # confirm:
            rat(x)

            x1 <- solve(solve(x)); x2 <- rat(x1)
        # compare:
            x-x1
        # with:
            x-x2$num/x2$den

