[Haskell-cafe] NaN as Integer value

wren ng thornton wren at freegeek.org
Sun Apr 14 10:28:01 CEST 2013


On 4/13/13 1:18 PM, Jerzy Karczmarczuk wrote:
> 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.

Also, the necessity of NaN for floats comes from the fact that floats
include values for Infinity and -Infinity, which leads to various
equations which cannot be resolved sensibly. This is different than mere
undefinedness. Undefined values are underspecified, but that can often be
resolved by choosing some arbitrary specification (often chosen via
arguing from limits or combinatorial convenience). Whereas the problematic
values due to infinities are overspecified, so no matter which answer you
pick it's guaranteed to be the wrong answer half the time.

Part of this whole problem comes from the fact that floats *do* decide to
give a meaning to 1/0 (namely Infinity). That's the gateway drug,...

-- 
Live well,
~wren




More information about the Haskell-Cafe mailing list