NAN(3) Library Functions Manual NAN(3)

nangenerate a quiet NaN

#include <math.h>

double
nan(const char *tagp);

long double
nanl(const char *tagp);

float
nanf(const char *tagp);

The () functions return a quiet NaN, whose trailing fraction field contains the result of converting tagp to an unsigned integer. If tagp is too large to be contained in the trailing fraction field of the NaN, then the least significant bits of the integer represented by tagp are used.

If tagp contains any non-numeric characters, the function returns a NaN whos trailing fraction field is zero.

If tagp is empty, the function returns a NaN whos trailing fraction field is zero.

The nan() functions conform to ISO/IEC 9899:2011.

July 1, 2008 macOS 15.2