Re: [Haskell] Literal for Infinity

2005-09-29 Thread Yitzchak Gale
Hi Jacques, Thanks also to you for a most interesting reply. This same discussion has taken place on the discussion list of every modern general-purpose programming language. The same points are always raised and argued, and the conclusion is always the same: floating point exceptions should rai

Re: [Haskell] Literal for Infinity

2005-09-29 Thread Yitzchak Gale
I wrote: > > While checking for floating-point overflow and > > underflow conditions, I tried to create... > > Infinity with the literal "1e10"... Is > > there a better way to check for Infinity? Tomasz Zielonka wrote: > Did you try isNaN and isInfinite? Oops. Thanks! Thanks also to Lennart

Re: [Haskell] Literal for Infinity

2005-09-29 Thread Lennart Augustsson
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 forma

Re: [Haskell] Literal for Infinity

2005-09-29 Thread Jacques Carette
The IEEE 754 standard says (fairly clearly) that +1.0 / +0.0 is one of the most 'stable' definitions of Infinity (in Float at least). Throwing an exception is also regarded as a possibility in IEEE 754, but it is expected that that is not the default, as experience shows that that is a sub-

Re: [Haskell] Literal for Infinity

2005-09-29 Thread Tomasz Zielonka
On 9/29/05, Yitzchak Gale <[EMAIL PROTECTED]> wrote: While checking for floating-point overflow andunderflow conditions, I tried to create a somewhatreliable cross-platform Infinity with the literal"1e10".When GHC 6.4.1 reads this literal, it goes into a deep trance and consumes huge amounts of

[Haskell] Literal for Infinity

2005-09-29 Thread Yitzchak Gale
While checking for floating-point overflow and underflow conditions, I tried to create a somewhat reliable cross-platform Infinity with the literal "1e10". 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