Double -> CDouble, realToFrac doesn't work

Henning Thielemann iakd0 at clusterf.urz.uni-halle.de
Fri Nov 5 07:34:06 EST 2004


On Fri, 5 Nov 2004, Ross Paterson wrote:

> On Fri, Nov 05, 2004 at 10:53:36AM +0100, Marcin 'Qrczak' Kowalczyk wrote:
> > ross at soi.city.ac.uk writes:
> > > [The proposal is to add 0:%0, 1:%0 and -1:%0 to Rational.]
> > >
> > > Changing Rational from meaning rational numbers would also be bad.  I'd
> > > prefer to redefine realToFrac to go through a new type that is the union
> > > of Rational and these values.
> > 
> > It's not enough if you care about preserving -0.0.
> 
> True, and denormalized values (whatever they are).

Denormalized numbers are not really special, they are just there to fill
the gap between the smallest normalized number and 0. If there were only
normalized numbers, we could only represent the numbers

0, 1.000000 * 10^-e, 1.000001 * 10^-e, 1.000010 * 10^-e, ...
 (everything binary)

As you can see the gap from 0 to 1.000000 * 10^-e is much larger than that
from 1.000000 * 10^-e to 1.000001 * 10^-e, that's why unnormalized numbers
like 0.111111 * 10^-e are inserted. They are common numbers in an uncommon
representation. In practice if you encounter them you have made something
wrong, because they are so close to zero ...



More information about the Libraries mailing list