[Haskell-cafe] Why aren't Float and Double Bounded?
Isaac Dupree
isaacdupree at charter.net
Tue Nov 27 20:37:11 EST 2007
>>>> Among numeric types, it seems that only integer types are Bounded.
>>> Maybe because IEEE format supports Infinity?
>> therefore, maxBound is Infinity and minBound negative infinity?
> But IEEE can be run with projective infinity in which case there is only one
> of them.
Well, if Double becomes a proper member of Ord (which it already almost
never is, because of NaN), then, since it is defined by a finite number
of bits, it can be Bounded. Maybe this means "projective infinity"
breaks Ord like NaN does. Any of this potential variation in Double
obviously breaks referential transparency too, if it depends on what
implementation you're using.
succ/pred are odd for Double too; even if Bounded and defined by a
finite number of bits, you would not be able to have a finite
[minBound..0] or [minBound..maxBound].
Basically, it's not Bounded, not for a particular reason, but just
because it's rather broken from a Haskell point of view anyway, IMHO.
Isaac
More information about the Haskell-Cafe
mailing list