[Haskell-cafe] 1/0
Henning Thielemann
lemming at henning-thielemann.de
Tue Jun 17 02:01:42 EDT 2008
On Mon, 16 Jun 2008, Dan Doel wrote:
> On Monday 16 June 2008, Evan Laforge wrote:
>
>> (huge negative number)
>>
>> Ok, so integral types don't have that exceptional value. Shouldn't
>> trying to convert NaN or Infinity to an Integral throw something? Is
>> it a performance thing? I'd think if you're converting to Integer you
>> don't really need hardware level performance anyway, so a couple of
>> checks wouldn't kill anyone.
>
> This is a (known by some) bug of sorts in the various floating point ->
> integral transformations (which ultimately boil down to decodeFloat or
> something like that at some point). It apparently doesn't know about the
> various exceptional values in the IEEE representation, so it just treats the
> representation like any other value. Infinity and NaN look like various huge
> numbers if you interpret them like any other value, so that's what you get
> out of round/ceiling/floor/etc.
>
> It's not ideal, but I guess no one's bothered to fix it. Might be something to
> bring up on the libraries mailing list.
This could be combined with improving performance:
http://hackage.haskell.org/trac/ghc/ticket/2281
http://hackage.haskell.org/trac/ghc/ticket/2271
http://hackage.haskell.org/trac/ghc/ticket/1434
More information about the Libraries
mailing list