Re: [Haskell] Literal for Infinity

2005-10-03 Thread Frederik Eaton
But they all have a largest and smallest possible value, as I have already indicated. On Sun, Oct 02, 2005 at 04:35:02PM +0200, Lennart Augustsson wrote: > Not all FP representations have infinity, and even if > they do, they might only have one infinity. > > -- Lennart > > Frederik Eaton

Re: [Haskell] Literal for Infinity

2005-10-02 Thread Lennart Augustsson
Not all FP representations have infinity, and even if they do, they might only have one infinity. -- Lennart Frederik Eaton wrote: I've previously mentioned that I would like to see an 'instance Bounded Double' etc., as part of the standard, which would use 1/0 for maxBound, or the larg

Re: [Haskell] Literal for Infinity

2005-10-02 Thread Frederik Eaton
I've previously mentioned that I would like to see an 'instance Bounded Double' etc., as part of the standard, which would use 1/0 for maxBound, or the largest possible value (there must be one!) for platforms where that is not possible. I don't see a problem with looking at Double values as if the

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