Mail Archives: djgpp-workers/2000/03/15/09:13:37
Dieter said:
> On 15 Mar 00, Eli Zaretskii wrote:
> > > The standard seems to say we should print
> > > "[-]nan" or "[-]nan(n-char-sequence)" ("n-char-sequence" is in
> > > italics). What is n-char-sequence supposed to be?
> >
> > I didn't understand this when I read it, either. Anybody?
>
> There are many differen NaNs. A math library can choose, to encode
> some information in the NaN, to help debugging. So when you find
> a NaN at some check-point in your program, you are able to say, that
> this NaN was produced by, say, sqrt(). (When you call sqrt(NaN),
> sqrt() will not return its own NaN, but rather the NaN in the
> argument.)
Ahh...
> When you printf a NaN that was procuced by a sqrt domain error,
> it might print "nan(sqrt)". This, at least is my interpretation.
> Perhaps, it would be preferable, to print "nan(unnormal)" for the
> unnormal case, to be std conform.
Hey, that's brilliant ("nan(unnormal)"), and we get to use that
mysterious n-char-sequence!
> Also, when reading the printf chapter in the C99 draft, (especially
> what Martin has cited) it is clear that the kludge, to suppress the
> sign of the NaN (I added this years ago, when I sent a patch for
> support of long double) is clearly wrong. I did not have any standard
> at that time, and tried to mimic other C implementations, that did
> not print the sign of the NaN.
>
> Martin, are you working at printf implementation?
Not yet. I don't mind if somebody else does it.
Right,
MartinS
- Raw text -