From: Joel Eidsath (jeidsath_at_[hidden])
Date: 2005-09-06 12:12:15


Andy Little wrote:

>On the contrary, conversion from rational to float is an example of a "lossy
>conversion".
>
>
Wrong. It is sometimes lossy, it is sometimes exact.

Numbers like 1.3, 134.5858, -0.87, are all rational numbers. They can
all be stored exactly in float. 1/3 is a rational number that cannot be
stored exactly as a float.

Where you keep going wrong for some reason is thinking anarbitrary
precision rational class should store _any_ rational number with
infinite precision. It's an arbitrary precision class, not an infinite
precision class. Numbers like 1/3 will be stored to an approximation
only (however many of digits of accuracy you ask for).

Joel Eidsath