Folks, Here's an attempt at rationalToRealFloat (formerly known as rationalToFloating): rationalToRealFloat:: (RealFloat a) => Rational -> a rationalToRealFloat x = x' where x' = f e f e = if e' == e then y else f e' where y = encodeFloat (round (x * (1 % b::e))) e (_,e') = decodeFloat y (_,e) = decodeFloat (fromInteger (numerator x) `asTypeOf` x' / fromInteger (denominator x)) b = floatRadix x' Again, if anybody has a better idea, I would certainly like to hear about it. Thanks. --Joe
- The last (sic) bug in the Prelude Simon L Peyton Jones