X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f From: Martin Str|mberg Message-Id: <200201032140.WAA06212@father.ludd.luth.se> Subject: Re: Function nan() In-Reply-To: <1659-Thu03Jan2002212556+0200-eliz@is.elta.co.il> from Eli Zaretskii at "Jan 3, 2002 09:25:57 pm" To: djgpp-workers AT delorie DOT com Date: Thu, 3 Jan 2002 22:40:48 +0100 (MET) Cc: Kbwms AT aol DOT com X-Mailer: ELM [version 2.4ME+ PL54 (25)] 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: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk According to Eli Zaretskii: > K.B. Williams kindly agreed to work on adding to the DJGPP library > long double math functions mandated by C9x. One of the specifications > of the standard says that the `nan' function accepts a text string > which can modify the result to some extent. But the standard is > silent about the details, saying that the effect of that string is > ``implementation-defined''. > > I'm guessing that they allow to produce the different forms of NaN > (QNaN etc.), but it would be nice to know what do other > implementations do, and whether this is really the intent to begin > with. > > So could people please tell what they know about this, and perhaps > look on other systems to see what they produce? The standard says ``#include double nan(const char *tagp); float nanf(const char *tagp); long double nanl(const char *tagp); Description The call nan("n-char-sequence") is equivalent to strtod("NAN(n-char-sequence)", (char**) NULL); the call nan("") is equivalent to strtod("NAN()", (char**) NULL). If tagp does not point to an n-char-sequence or an empty string, the call is equivalent to strtod("NAN", (char**) NULL). Calls to nanf and nanl are equivalent to the corresponding calls to strtof and strtold. Returns The nan functions returns a quiet NaN, if available, with content indicated through tagp. If the implementation does not support quiet NaNs, the functions return zero.'' Can tagp make a signaling NaN? If so it seems it must be forced into a quiet one after conversion, I guess. Another task needing to be done is make libm compile without warnings while gcc.opt contains "-Wsign-compare" with a 3.x gcc. Please someone who understands the code take a look. Right, MartinS