1nan(3) Library Functions Manual nan(3)
2
3
4
6 nan, nanf, nanl - return 'Not a Number'
7
9 Math library (libm, -lm)
10
12 #include <math.h>
13
14 double nan(const char *tagp);
15 float nanf(const char *tagp);
16 long double nanl(const char *tagp);
17
18 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
19
20 nan(), nanf(), nanl():
21 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
22
24 These functions return a representation (determined by tagp) of a quiet
25 NaN. If the implementation does not support quiet NaNs, these func‐
26 tions return zero.
27
28 The call nan("char-sequence") is equivalent to:
29
30 strtod("NAN(char-sequence)", NULL);
31
32 Similarly, calls to nanf() and nanl() are equivalent to analogous calls
33 to strtof(3) and strtold(3).
34
35 The argument tagp is used in an unspecified manner. On IEEE 754 sys‐
36 tems, there are many representations of NaN, and tagp selects one. On
37 other systems it may do nothing.
38
40 For an explanation of the terms used in this section, see at‐
41 tributes(7).
42
43 ┌─────────────────────────────────────┬───────────────┬────────────────┐
44 │Interface │ Attribute │ Value │
45 ├─────────────────────────────────────┼───────────────┼────────────────┤
46 │nan(), nanf(), nanl() │ Thread safety │ MT-Safe locale │
47 └─────────────────────────────────────┴───────────────┴────────────────┘
48
50 C11, POSIX.1-2008.
51
52 See also IEC 559 and the appendix with recommended functions in IEEE
53 754/IEEE 854.
54
56 glibc 2.1. C99, POSIX.1-2001.
57
59 isnan(3), strtod(3), math_error(7)
60
61
62
63Linux man-pages 6.04 2023-03-30 nan(3)