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

DESCRIPTION

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

ATTRIBUTES

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

CONFORMING TO

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

NOTES

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

SEE ALSO

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

COLOPHON

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