There are many effective Rational NUmber implementations but one that has been proposed many times and can even handle some irrationals quite well is Continued Fractions.
OldCurmudgeon
- 231
- 1
- 5