[Haskell-cafe] Why is toRational a method of Real?
alexey.skladnoy at gmail.com
Thu Aug 5 05:56:56 EDT 2010
On 05.08.2010 13:35, Henning Thielemann wrote:
> On Wed, 4 Aug 2010, John Meacham wrote:
>> The numeric classes are sort of messed up when it comes to non integral
>> values. (not that they are perfect for other things) for instance,
>> realToFrac doesn't preserve NaN or Infinity,
> Why should realToFrac do this? NaN, Infinity and +/-0 are IEEE hacks for
> the common numerical applications you do with floating point numbers.
> These special values could be supported by floating point specific, or
> even IEEE specific type classes, but they should not be part of
> mathematically motivated type classes .
But they are. isNaN, isInfinite, isNegativeZero are all members of
RealFloat type class and there is no generic for type conversion which
conserves NaNs. Numeric type classes are really messed up.
More information about the Haskell-Cafe