Re: [Haskell-cafe] NaN as Integer value

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

On Sun, Apr 14, 2013 at 3:28 PM, wren ng thornton
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).
I'm not sure what you mean about overspecification here, but in setting 1/0 as +infinity (as opposed to -infinity), there's an easily overlooked assumption that the limit is obtained "from above" as opposed to "from below." -- Kim-Ee

On Sun, Apr 14, 2013 at 7:53 PM, Kim-Ee Yeoh
On Sun, Apr 14, 2013 at 3:28 PM, wren ng thornton
wrote: 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).
I'm not sure what you mean about overspecification here, but in setting 1/0 as +infinity (as opposed to -infinity), there's an easily overlooked assumption that the limit is obtained "from above" as opposed to "from below."
Not quite. 0.0 designates "positive zero" or +0.0 in IEEE 754 notation. There is also "negative zero" or -0.0 in IEEE 754 notation. If you want the limit from below, use negative zero. This is all standard IEEE 754 concepts. -- Gaby
participants (3)
-
Gabriel Dos Reis
-
Kim-Ee Yeoh
-
wren ng thornton