I am an Electrical Engineering fresher at National Institute of
Technology, Srinagar. I have a proposal for a Continued Fraction
class, with all arithmetic implemented through Gosper's HAKMEM
Here are some advantages/applications I can think of right now for a
continued fraction representation:
1. Exact, base-independant representation of rationals AND irrationals
(of course limited by the precision required)
2. Unlike rationals where numerator and denominator need to be
"canonicalized" (i.e. divided by gcd for optimal representation),
continued fraction arithmetic incorporates that naturally.
3. Approximation: Continued fraction give the best possible rational
approximation for a given number
4. Comparison is extremely easy and fast
5. Conversion to float and base-conversion do not require division.
Conversion to float, especially, is extremely fast and simple.
I propose to implement most of the functions supported by the
Although I am sure there are many more applications and advantages, I
would like some feedback on whether this library/extension would be of
enough interest to be included in boost.