John Meacham (Sun, Mar 13, 2005 at 08:08:56PM -0800):
On Sun, Mar 13, 2005 at 11:08:26PM +, Thomas Davie wrote:
[...] We could define maxBound as
(2^(mantisa_space))^(2^(exponent_space)) and min bound pretty
similarly... But I'm sure that everyone will agree that this is a
horrible
Interesting. In that case, I would agree that portability seems like
another reason to define a Bounded instance for Double. That way users
could call 'maxBound' and 'minBound' rather than 1/0 and -(1/0)...
Frederik
On Fri, Mar 11, 2005 at 11:10:33AM +0100, Lennart Augustsson wrote:
Haskell
And what would you have minBound and maxBound be?
I guess you could use +/- the maximum value representable.
Going for infinity is rather dodgy, and assumes an FP
representation that has infinity.
-- Lennart
Frederik Eaton wrote:
Interesting. In that case, I would agree that portability
I may be barking up the wrong tree here, but I think the key to this
discussion is that real numbers are not bounded, while doubles are
bounded. One cannot say what the smallest or largest real number are,
but one can say what the smallest or largest double are (and it is
unfortunately
I agree with all of that. :)
-- Lennart
Thomas Davie wrote:
I may be barking up the wrong tree here, but I think the key to this
discussion is that real numbers are not bounded, while doubles are
bounded. One cannot say what the smallest or largest real number are,
but one can say what
On Sun, Mar 13, 2005 at 11:08:26PM +, Thomas Davie wrote:
I may be barking up the wrong tree here, but I think the key to this
discussion is that real numbers are not bounded, while doubles are
bounded. One cannot say what the smallest or largest real number are,
but one can say what
Haskell does not guarantee that 1/0 is well defined,
nor that -(1/0) is different from 1/0.
While the former is true for IEEE floating point numbers,
the latter is only true when using affine infinities.
-- Lennart
Frederik Eaton wrote:
Shouldn't Double, Float, etc. be instances of
Shouldn't Double, Float, etc. be instances of Bounded?
I've declared e.g.
instance Bounded Double where
minBound = -(1/0)
maxBound = 1/0
in a module where I needed it and there doesn't seem to be any issue
with the definition...
Frederik
--
http://ofb.net/~frederik/