HP-UX Reference (11i v2 04/09) - 3 Library Functions N-Z (vol 7)

n
nan(3M) nan(3M)
NAME
nan( ), nanf( ), nanl( ), nanw( ), nanq( ) - string-to-NaN conversion functions
SYNOPSIS
#include <math.h>
double nan(const char *tagp);
Itanium(R)-based System Only
float nanf(const char *tagp);
long double nanl(const char *tagp);
extended nanw(const char *tagp);
quad nanq(const char *tagp);
DESCRIPTION
The nan() function creates a quiet NaN from the specified string. If
tagp does not point to an n-char-
sequence or an empty string, the call is equivalent to
strtod("NAN", (char**) NULL).
The ISO/IEC C99 standard specifies n-char-sequence syntax, but the interpretation and extension of the
syntax is implementation defined. The n-char-sequence argument is ignored on HP-UX systems.
Itanium-based System Only
nanf() is a float version of nan(); it returns a float result.
nanl() is a long double version of nan(); it returns a long double result.
nanw() is an extended version of nan(); it returns an extended result.
nanq() is equivalent to nanl() on HP-UX systems.
USAGE
To use these functions, compile either with the default
-Ae option or with the
-Aa and
-D_HPUX_SOURCE options. To use
nanw()or nanq(), compile with the -fpwidetypes option. Make
sure your program includes
<math.h>, and link in the math library by specifying -lm on the compiler
or linker command line.
For more information, see the HP-UX Floating-Point Guide.
RETURN VALUE
The nan() function returns a quiet NaN.
These functions raise no exceptions.
ERRORS
No errors are defined.
SEE ALSO
copysign(3M), isnan(3M), nextafter(3M), math(5).
STANDARDS CONFORMANCE
nan(), nanf(), nanl() : ISO/IEC C99 (including Annex F, "IEC 60559 floating-point arithmetic")
HP-UX 11i Version 2: September 2004 1 Hewlett-Packard Company Section 3643