| 1 |
'\" t |
| 2 |
.\" Copyright 2002, Walter Harms <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: GPL-1.0-or-later |
| 6 |
.\" |
| 7 |
.TH nan 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
nan, nanf, nanl \- return 'Not a Number' |
| 10 |
.SH LIBRARY |
| 11 |
Math library |
| 12 |
.RI ( libm ,\~ \-lm ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.B #include <math.h> |
| 16 |
.P |
| 17 |
.BI "double nan(const char *" tagp ); |
| 18 |
.BI "float nanf(const char *" tagp ); |
| 19 |
.BI "long double nanl(const char *" tagp ); |
| 20 |
.fi |
| 21 |
.P |
| 22 |
.RS -4 |
| 23 |
Feature Test Macro Requirements for glibc (see |
| 24 |
.BR feature_test_macros (7)): |
| 25 |
.RE |
| 26 |
.P |
| 27 |
.BR nan (), |
| 28 |
.BR nanf (), |
| 29 |
.BR nanl (): |
| 30 |
.nf |
| 31 |
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L |
| 32 |
.fi |
| 33 |
.SH DESCRIPTION |
| 34 |
These functions return a representation (determined by |
| 35 |
.IR tagp ) |
| 36 |
of a quiet NaN. |
| 37 |
If the implementation does not support |
| 38 |
quiet NaNs, these functions return zero. |
| 39 |
.P |
| 40 |
The call |
| 41 |
.I nan("char\-sequence") |
| 42 |
is equivalent to: |
| 43 |
.P |
| 44 |
.in +4n |
| 45 |
.EX |
| 46 |
strtod("NAN(char\-sequence)", NULL); |
| 47 |
.EE |
| 48 |
.in |
| 49 |
.P |
| 50 |
Similarly, calls to |
| 51 |
.BR nanf () |
| 52 |
and |
| 53 |
.BR nanl () |
| 54 |
are equivalent to analogous calls to |
| 55 |
.BR strtof (3) |
| 56 |
and |
| 57 |
.BR strtold (3). |
| 58 |
.P |
| 59 |
The argument |
| 60 |
.I tagp |
| 61 |
is used in an unspecified manner. |
| 62 |
On IEEE 754 systems, there are many representations of NaN, and |
| 63 |
.I tagp |
| 64 |
selects one. |
| 65 |
On other systems it may do nothing. |
| 66 |
.SH ATTRIBUTES |
| 67 |
For an explanation of the terms used in this section, see |
| 68 |
.BR attributes (7). |
| 69 |
.TS |
| 70 |
allbox; |
| 71 |
lbx lb lb |
| 72 |
l l l. |
| 73 |
Interface Attribute Value |
| 74 |
T{ |
| 75 |
.na |
| 76 |
.nh |
| 77 |
.BR nan (), |
| 78 |
.BR nanf (), |
| 79 |
.BR nanl () |
| 80 |
T} Thread safety MT-Safe locale |
| 81 |
.TE |
| 82 |
.SH STANDARDS |
| 83 |
C11, POSIX.1-2008. |
| 84 |
.P |
| 85 |
See also IEC 559 and the appendix with |
| 86 |
recommended functions in IEEE 754/IEEE 854. |
| 87 |
.SH HISTORY |
| 88 |
glibc 2.1. |
| 89 |
C99, POSIX.1-2001. |
| 90 |
.SH SEE ALSO |
| 91 |
.BR isnan (3), |
| 92 |
.BR strtod (3), |
| 93 |
.BR math_error (7) |