Double -> CDouble, realToFrac doesn't work

Ketil Malde ketil+haskell at
Fri Nov 5 08:33:42 EST 2004

With GHCi, I get:

    Prelude Ratio> toRational (1.0/0) :: Ratio Integer
    179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216 % 1

My personal gut feeling is that converting a NaN/Inf/etc to a fraction
should be an error (although I see the point of being able to convert
a e.g. Float to a Double and preserve such special values).

Is it possible to provide a conversion function in the Floating or
RealFloat class instead?

If I haven't seen further, it is by standing in the footprints of giants

More information about the Glasgow-haskell-users mailing list