1FPCLASSIFY(3)              Linux Programmer's Manual             FPCLASSIFY(3)
2
3
4

NAME

6       fpclassify, isfinite, isnormal, isnan, isinf - floating-point classifi‐
7       cation macros
8

SYNOPSIS

10       #include <math.h>
11
12       int fpclassify(x);
13
14       int isfinite(x);
15
16       int isnormal(x);
17
18       int isnan(x);
19
20       int isinf(x);
21
22       Link with -lm.
23
24   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
25
26       fpclassify(), isfinite(), isnormal():
27           _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
28       isnan():
29           _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
30               || _XOPEN_SOURCE
31               || /* Since glibc 2.19: */ _DEFAULT_SOURCE
32               || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
33       isinf():
34           _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
35               || /* Since glibc 2.19: */ _DEFAULT_SOURCE
36               || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
37

DESCRIPTION

39       Floating point numbers can have special values,  such  as  infinite  or
40       NaN.   With  the  macro  fpclassify(x) you can find out what type x is.
41       The macro takes any floating-point expression as argument.  The  result
42       is one of the following values:
43
44       FP_NAN        x is "Not a Number".
45
46       FP_INFINITE   x is either positive infinity or negative infinity.
47
48       FP_ZERO       x is zero.
49
50       FP_SUBNORMAL  x is too small to be represented in normalized format.
51
52       FP_NORMAL     if nothing of the above is correct then it must be a nor‐
53                     mal floating-point number.
54
55       The other macros provide a short answer to some standard questions.
56
57       isfinite(x)   returns a nonzero value if
58                     (fpclassify(x) != FP_NAN && fpclassify(x) != FP_INFINITE)
59
60       isnormal(x)   returns a nonzero value if (fpclassify(x) == FP_NORMAL)
61
62       isnan(x)      returns a nonzero value if (fpclassify(x) == FP_NAN)
63
64       isinf(x)      returns 1 if x is positive infinity, and -1 if x is nega‐
65                     tive infinity.
66

ATTRIBUTES

68       For   an   explanation   of   the  terms  used  in  this  section,  see
69       attributes(7).
70
71       ┌─────────────────────────────┬───────────────┬─────────┐
72Interface                    Attribute     Value   
73       ├─────────────────────────────┼───────────────┼─────────┤
74fpclassify(), isfinite(),    │ Thread safety │ MT-Safe │
75isnormal(), isnan(), isinf() │               │         │
76       └─────────────────────────────┴───────────────┴─────────┘

CONFORMING TO

78       POSIX.1-2001, POSIX.1-2008, C99.
79
80       For  isinf(), the standards merely say that the return value is nonzero
81       if and only if the argument has an infinite value.
82

NOTES

84       In glibc 2.01 and earlier, isinf() returns a nonzero  value  (actually:
85       1)  if  x is positive infinity or negative infinity.  (This is all that
86       C99 requires.)
87

SEE ALSO

89       finite(3), INFINITY(3), isgreater(3), signbit(3)
90

COLOPHON

92       This page is part of release 4.15 of the Linux  man-pages  project.   A
93       description  of  the project, information about reporting bugs, and the
94       latest    version    of    this    page,    can     be     found     at
95       https://www.kernel.org/doc/man-pages/.
96
97
98
99                                  2017-09-15                     FPCLASSIFY(3)
Impressum