The RealFloat class has a number of methods for testing
various properties of a FP number:
  isNaN :: a -> Bool
  isInfinite :: a -> Bool
  isDenormalized :: a -> Bool
  isNegativeZero :: a -> Bool
  isIEEE :: a -> Bool

If you really want to create an Infinity, I suggest 1/0,
but not all FP formats support it (IEEE754 does).

        -- Lennart


Yitzchak Gale wrote:
While checking for floating-point overflow and
underflow conditions, I tried to create a somewhat
reliable cross-platform Infinity with the literal
"1e100000".

When GHC 6.4.1 reads this literal, it goes into a
deep trance and consumes huge amounts of
memory. Shouldn't it immediately recognize such a
thing as Infinity?

Is there a better way to check for Infinity?  I
have not yet figured out how to check for NaN at
all - because it is not equal to itself. Any
suggestions?

BTW, I notice that Simon PJ proposed literals
for Infinity and Nan several years ago:

http://www.haskell.org/pipermail/haskell/2001-August/007753.html

Did anything ever come out of this?

Regards,
Yitzchak
_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to