qdunkan at gmail.com
Mon Jun 16 22:29:05 EDT 2008
>> ... so I see from the archives that Infinity is mandated by ieee754
>> even though my intuition says both should be NaN.
> Other people have other intuitions. It may be that your intuition
> is telling you that neither result should be an ordinary number,
> and if that's what it's really telling you, it's right: the C
> function isfinite(x) is true of all signed zero, subnormal, or
> normal x, false of signed infinities and NaNs.
Yeah, on reflection, I think my "intuition" derives from me asking a
math teacher back in high school "isn't n/0 infinity?" after looking
at a graph, to which he said "no, it's undefined, you can only say it
approaches infinity in the limit, but it isn't infinity".
>> Every other language throws an exception, even C will crash the
> Not true. C99 *definitely* allows both infinities and NaNs (see
> Annex F of the C99 standard) and C89 practice also allowed it.
> Some C89 systems required you to use signal() with SIGFPE to
> turn IEEE extended results into exceptions; others required you
> to use signal() to disable this; others used yet other means.
Yes, I was mistaken here, as has been pointed out.
And I should definitely know better than to make some generalization
about "every other language" among this crowd :)
> (Of course, in C what you typically get is garbage, but that can
> be put more generally...)
Heh, one for the C-bashing quotes file...
More information about the Haskell-Cafe