Mail Archives: djgpp-workers/2002/01/03/16:41:07
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 <math.h>
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
- Raw text -