[Haskell] Literal for Infinity

Tomasz Zielonka tomasz.zielonka at gmail.com
Thu Sep 29 08:08:35 EDT 2005


On 9/29/05, Yitzchak Gale <gale at sefer.org> 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?


I think it is equivalent to (fromRational 1e100000), and (1e100000 ::
Rational)
can take a substantial amount of space.

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?


Did you try isNaN and isInfinite? I don't have much experience with these
functions myself.

Best regards
Tomasz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org//pipermail/haskell/attachments/20050929/6e7bbe08/attachment.htm


More information about the Haskell mailing list