Subject: Re: scanf misses NAN and INF (patch to review)
To: Emmanuel Dreyfus <>
From: Greg Troxel <>
List: tech-userlevel
Date: 04/04/2007 10:30:43 (Emmanuel Dreyfus) writes:

> Thor Lancelot Simon <> wrote:
>> > What do you mean? The case where the object is not a float? I'm in case
>> > CT_FLOAT, so this should be adressed...
>> No.  Not all floating-point formats have "not a number" or IEEE-style
>> infinities, and we run on at least two machines where there is no
>> floating point format that does, plus at least one where one of the
>> available floating points doesn't (though we don't support it).
> Please give more details, I'm really clueless on this topic.

NaN is defined by IEEE 754.  The Vax has its own format, inherited from
the PDP-11.  There's also an IBM floating point format, but I don't know
if that's used on any machines NetBSD runs on.

This is an interesting historical perspective:

So basically the point is that saying "There is such a thing as NaN." is
only valid in the context of a particular floating point implemnetation.
Maybe the nan-reading code needs to be ifdefed for HAVE_NAN, and I'd
think that output code would have this same issue already.