1fpclassify(3)              Library Functions Manual              fpclassify(3)
2
3
4

NAME

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

LIBRARY

10       Math library (libm, -lm)
11

SYNOPSIS

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

DESCRIPTION

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

ATTRIBUTES

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

STANDARDS

78       C11, POSIX.1-2008.
79

HISTORY

81       POSIX.1-2001, C99.
82
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

NOTES

88       For  isinf(), the standards merely say that the return value is nonzero
89       if and only if the argument has an infinite value.
90

SEE ALSO

92       finite(3), INFINITY(3), isgreater(3), signbit(3)
93
94
95
96Linux man-pages 6.04              2023-03-30                     fpclassify(3)
Impressum