From: Martin Stromberg Message-Id: <200003151350.OAA20480@mars.lu.erisoft.se> Subject: Re: Unnormals??? To: djgpp-workers AT delorie DOT com Date: Wed, 15 Mar 2000 14:50:07 +0100 (MET) In-Reply-To: <200003151300.IAA05344@delorie.com> from "Dieter Buerssner" at Mar 15, 2000 02:00:05 PM X-Mailer: ELM [version 2.5 PL3] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Errors-To: dj-admin AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk 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