]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/fpclassify.3
bpf-helpers.7: Refresh against Linux 5.0-rc8
[thirdparty/man-pages.git] / man3 / fpclassify.3
CommitLineData
fea681da 1.\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
2297bf0e 2.\"
38f20bb9
MK
3.\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
4.\" Distributed under GPL
5.\" %%%LICENSE_END
0389adc9 6.\"
fea681da
MK
7.\" This was done with the help of the glibc manual.
8.\"
9.\" 2004-10-31, aeb, corrected
4b8c67d9 10.TH FPCLASSIFY 3 2017-09-15 "" "Linux Programmer's Manual"
fea681da 11.SH NAME
2fd7b9d4
MK
12fpclassify, isfinite, isnormal, isnan, isinf \- floating-point
13classification macros
fea681da
MK
14.SH SYNOPSIS
15.nf
16.B #include <math.h>
68e4db0a 17.PP
fea681da 18.BI "int fpclassify(" x );
68e4db0a 19.PP
fea681da 20.BI "int isfinite(" x );
68e4db0a 21.PP
fea681da 22.BI "int isnormal(" x );
68e4db0a 23.PP
fea681da 24.BI "int isnan(" x );
68e4db0a 25.PP
fea681da
MK
26.BI "int isinf(" x );
27.fi
68e4db0a 28.PP
cc4615cc 29Link with \fI\-lm\fP.
68e4db0a 30.PP
cc4615cc
MK
31.in -4n
32Feature Test Macro Requirements for glibc (see
33.BR feature_test_macros (7)):
34.in
68e4db0a 35.PP
cc4615cc
MK
36.\" I haven't fully grokked the source to determine the FTM requirements;
37.\" in part, the following has been tested by experiment.
38.ad l
39.BR fpclassify (),
40.BR isfinite (),
41.BR isnormal ():
f1f0e4ed 42.RS 4
e464f054 43_ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
542f0ad8 44.RE
cc4615cc 45.BR isnan ():
f1f0e4ed 46.RS 4
636ed4d5
MK
47_ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
48 || _XOPEN_SOURCE
49 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
50 || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
542f0ad8 51.RE
cc4615cc 52.BR isinf ():
542f0ad8 53.RS 4
636ed4d5
MK
54_ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
55 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
56 || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
f1f0e4ed
MK
57.RE
58.ad
fea681da
MK
59.SH DESCRIPTION
60Floating point numbers can have special values, such as
1c44bd5b
MK
61infinite or NaN.
62With the macro
c13182ef 63.BI fpclassify( x )
fea681da
MK
64you can find out what type
65.I x
1c44bd5b
MK
66is.
67The macro takes any floating-point expression as argument.
c13182ef 68The result is one of the following values:
5840de13 69.TP 14
b20979f0 70.B FP_NAN
fea681da
MK
71.I x
72is "Not a Number".
73.TP
b20979f0 74.B FP_INFINITE
fea681da 75.I x
14a05a52 76is either positive infinity or negative infinity.
c13182ef 77.TP
b20979f0 78.B FP_ZERO
fea681da
MK
79.I x
80is zero.
81.TP
b20979f0 82.B FP_SUBNORMAL
fea681da
MK
83.I x
84is too small to be represented in normalized format.
85.TP
b20979f0 86.B FP_NORMAL
6dff8403 87if nothing of the above is correct then it must be a
fea681da 88normal floating-point number.
dd3568a1 89.PP
fea681da 90The other macros provide a short answer to some standard questions.
5840de13 91.TP 14
fea681da 92.BI isfinite( x )
c7094399 93returns a nonzero value if
fea681da
MK
94.br
95(fpclassify(x) != FP_NAN && fpclassify(x) != FP_INFINITE)
96.TP
97.BI isnormal( x )
c7094399 98returns a nonzero value if
fea681da
MK
99(fpclassify(x) == FP_NORMAL)
100.TP
101.BI isnan( x )
c7094399 102returns a nonzero value if
fea681da
MK
103(fpclassify(x) == FP_NAN)
104.TP
105.BI isinf( x )
3243fedf
MK
106returns 1 if
107.I x
108is positive infinity, and \-1 if
109.I x
110is negative infinity.
b5a788d5 111.SH ATTRIBUTES
5746e8c4
MK
112For an explanation of the terms used in this section, see
113.BR attributes (7).
114.ad l
115.TS
116allbox;
117lbw28 lb lb
118l l l.
119Interface Attribute Value
120T{
b5a788d5
PH
121.BR fpclassify (),
122.BR isfinite (),
123.BR isnormal (),
124.BR isnan (),
b5a788d5 125.BR isinf ()
5746e8c4
MK
126T} Thread safety MT-Safe
127.TE
128.ad
47297adb 129.SH CONFORMING TO
d89ae7ee 130POSIX.1-2001, POSIX.1-2008, C99.
847e0d88 131.PP
d41a0a77
MK
132For
133.BR isinf (),
c7094399 134the standards merely say that the return value is nonzero
d41a0a77 135if and only if the argument has an infinite value.
19c98696 136.SH NOTES
3243fedf 137In glibc 2.01 and earlier,
63aa9df0 138.BR isinf ()
c7094399 139returns a nonzero value (actually: 1) if
3243fedf 140.I x
14a05a52 141is positive infinity or negative infinity.
3243fedf 142(This is all that C99 requires.)
47297adb 143.SH SEE ALSO
fea681da
MK
144.BR finite (3),
145.BR INFINITY (3),
61f56d72
MK
146.BR isgreater (3),
147.BR signbit (3)