Returns a quiet NaN.
Include
<math.h>
Prototype
float nanf(const char * tagp);
Arguments
tagp
Return Value
The call nan("n-char-sequence")
is equivalent to
strtof("NAN(n-char- sequence)", (char**) NULL);
the call
nan("")
is equivalent to strtof("NAN()", (char**)
NULL)
. When tagp
does not point to an n-char sequence or
an empty string, the equivalent call to strtof
would have a first
argument of "NAN"
.
Example
#include <math.h>
#include <stdio.h>
int main(void)
{
float x;
z = nanf(NULL);
printf("Here is our not-a-number: %f\n", z);
}
Example Output
Here is our not-a-number: nan