Double -> CDouble, realToFrac doesn't work

Ross Paterson ross at
Fri Nov 5 09:45:05 EST 2004

On Fri, Nov 05, 2004 at 12:20:01AM +0000, ross at wrote:
> On Thu, Nov 04, 2004 at 08:32:52PM +0100, Sven Panne wrote:
> > It's an old thread, but nothing has really happened yet, so I'd like to
> > restate and expand the question: What should the behaviour of toRational,
> > fromRational, and decodeFloat for NaN and +/-Infinity be? Even if the report
> > is unclear here, it would be nice if GHC, Hugs, and NHC98 agreed on 
> > something.
> > Can we agree on the special Rational values below?
> [The proposal is to add 0:%0, 1:%0 and -1:%0 to Rational.]

I see that GHC has had this for a while, to handle reading floats:

NHC solves that one by redefining read to bypass Rational on "NaN"
and "Infinity".

The NHC solution seems reasonable for read, but I still think a new type
would be better for realToFrac.

Hugs in CVS throws ArithException Overflow if any of the extra values
are fed to toRational or decodeFloat.  (Released Hugs has a bizarre
bug there.)

More information about the Libraries mailing list