1 comment

[ 5.6 ms ] story [ 21.6 ms ] thread
There is a solution to this problem which lets you have your cake and eat it to. Continued fractions give you a representation of real numbers that turns into a compact exact representation of all possible fractions. (If you've got a lazy language, like Haskell, you can compactly represent many real numbers as well.) Doing arithmetic with them is tricky, but possible.

If you're interested, http://perl.plover.com/yak/cftalk/ has all of the necessary details, including a sample implementation as a program in C.

I've never heard of anyone using that number system for serious work, but I'd be curious how well that would work out.