[Haskell] Literal for Infinity

Yitzchak Gale gale at sefer.org
Thu Sep 29 07:49:14 EDT 2005


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


More information about the Haskell mailing list