Subject: Re: scanf misses NAN and INF (patch to review)
To: Emmanuel Dreyfus <>
From: None <>
List: tech-userlevel
Date: 04/04/2007 16:52:41
On Wed, Apr 04, 2007 at 10:30:43AM -0400, Greg Troxel wrote:
> (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.

A good "paper" too is included in NetBSD: 

man 3 math

;) it has some interesting notes about VAX and IEEE754, and about some
implementations details that are not widely documented (cf POSIX about
signals, and what is an error or not in floating point arithmetic in
Thierry Laronde (Alceste) <tlaronde +AT+ polynum +dot+ com>
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C