Double -> CDouble, realToFrac doesn't work

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


On Fri, 5 Nov 2004, Keith Wansbrough 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).
> 
> Denorms are handled fine by ordinary Rationals, but collapsing all NaNs 
> down to 0:%0 is not necessarily the right thing to do.

Yep. Given
 a % b == c % d     iff    a*d == b*c

then 0 % 0 is equivalent to each other rational. :-)

> Surely we should add another fractional type, like Rational but with some extra stuff to make it a superset of Double.

One could define 2x2 types: {finit, infinit} x {rational, float}
 Every type containing infinity misses some fundamental mathematical
properties, like a natural order and closedness with respect to (+), (-),
(*), whereas the types including infinity may be of more interest for
numerical applications.




More information about the Libraries mailing list