I was curious about different representations of rational numbers and came across the finite continued fraction (see wp:Finite_continued_fractions ).
Note: I will refer to traditional rational representation with two integers as fractional representation and to reduced fractions ($gcd(n,d)=1$, where $n$ is the numerator, and $d$ is the denominator) of this sort as reduced fractional representation.
Bellow I will make some comparisons between continued fractions and the other representations.
- Linear time ordering, for example
x<y(vs. $O(M(|n|+|d|))$ for fractional representation representation).
- Arithmetic using Gosper's algorithms for continued fraction arithmetic seems to grow at a much worse rate than the fractional representation.
- In reading Big Integers and Complexity Issues in Exact Real Arithmetic (view), Heckmann describes Linear Fractional Transformations (LFTs). They look very similar to Gosper's algorithms for arithmetic on continued fractions. Are they the same? How are they different?
Edit: some links to continued fraction arithmetic
- Pretty good (slideshow) but missing some examples at the end, also source codes in C
- http://perl.plover.com/yak/cftalk/INFO/gosper.txt By Bill Gosper.
- Example of cf arithmetic with visualizations: http://paul-mccarthy.us/Cfrac/CF_Arithmetic.htm