[Haskell-cafe] NaN as Integer value

Jerzy Karczmarczuk jerzy.karczmarczuk at unicaen.fr
Sat Apr 13 19:18:55 CEST 2013

Franco answers a question :
>> Hello haskellers,is there a reason why Integer doesn't have 'NaN' as
> value?I think it would be very convenient to be able to handle (1 `div` 0)
> as regular NaN value and not as exception.Thanks.
> I think because, if you need NaN like values, `Maybe Int` does the same job
> without tainting the definition of `Int`.
This is not a Haskell problem. For Ints, ALL representations are valid 
numbers, a NaN is a specific float object, unless I'm mistaken, so the 
introduction of such an abnormal number would require some serious 
modifications of the representation.

Jerzy Karczmarczuk

More information about the Haskell-Cafe mailing list