]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/fpclassify.3
Put SEE ALSO section into alphabetical order.
[thirdparty/man-pages.git] / man3 / fpclassify.3
CommitLineData
fea681da
MK
1.\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
2.\" Distributed under GPL, 2002-07-27 Walter Harms
3.\" This was done with the help of the glibc manual.
4.\"
5.\" 2004-10-31, aeb, corrected
cc4615cc 6.TH FPCLASSIFY 3 2007-07-26 "" "Linux Programmer's Manual"
fea681da 7.SH NAME
2fd7b9d4
MK
8fpclassify, isfinite, isnormal, isnan, isinf \- floating-point
9classification macros
fea681da
MK
10.SH SYNOPSIS
11.nf
12.B #include <math.h>
13.sp
14.BI "int fpclassify(" x );
15.sp
16.BI "int isfinite(" x );
17.sp
18.BI "int isnormal(" x );
19.sp
20.BI "int isnan(" x );
21.sp
22.BI "int isinf(" x );
23.fi
462a7bad 24.sp
cc4615cc
MK
25Link with \fI\-lm\fP.
26.sp
27.in -4n
28Feature Test Macro Requirements for glibc (see
29.BR feature_test_macros (7)):
30.in
31.sp
32.\" I haven't fully grokked the source to determine the FTM requirements;
33.\" in part, the following has been tested by experiment.
34.ad l
35.BR fpclassify (),
36.BR isfinite (),
37.BR isnormal ():
38_XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE; or
39.I cc\ -std=c99
40.br
41.BR isnan ():
42_BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE || _ISOC99_SOURCE; or
43.I cc\ -std=c99
44.br
45.BR isinf ():
46_BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE; or
47.I cc\ -std=c99
48.ad b
fea681da
MK
49.SH DESCRIPTION
50Floating point numbers can have special values, such as
1c44bd5b
MK
51infinite or NaN.
52With the macro
c13182ef 53.BI fpclassify( x )
fea681da
MK
54you can find out what type
55.I x
1c44bd5b
MK
56is.
57The macro takes any floating-point expression as argument.
c13182ef 58The result is one of the following values:
fea681da 59.TP
b20979f0 60.B FP_NAN
fea681da
MK
61.I x
62is "Not a Number".
63.TP
b20979f0 64.B FP_INFINITE
fea681da
MK
65.I x
66is either plus or minus infinity.
c13182ef 67.TP
b20979f0 68.B FP_ZERO
fea681da
MK
69.I x
70is zero.
71.TP
b20979f0 72.B FP_SUBNORMAL
fea681da
MK
73.I x
74is too small to be represented in normalized format.
75.TP
b20979f0 76.B FP_NORMAL
6dff8403 77if nothing of the above is correct then it must be a
fea681da
MK
78normal floating-point number.
79.LP
80The other macros provide a short answer to some standard questions.
81.TP
82.BI isfinite( x )
eba72288 83returns a non-zero value if
fea681da
MK
84.br
85(fpclassify(x) != FP_NAN && fpclassify(x) != FP_INFINITE)
86.TP
87.BI isnormal( x )
eba72288 88returns a non-zero value if
fea681da
MK
89(fpclassify(x) == FP_NORMAL)
90.TP
91.BI isnan( x )
eba72288 92returns a non-zero value if
fea681da
MK
93(fpclassify(x) == FP_NAN)
94.TP
95.BI isinf( x )
3243fedf
MK
96returns 1 if
97.I x
98is positive infinity, and \-1 if
99.I x
100is negative infinity.
2b2581ee
MK
101.SH "CONFORMING TO"
102C99
19c98696 103.SH NOTES
3243fedf 104In glibc 2.01 and earlier,
63aa9df0 105.BR isinf ()
eba72288 106returns a non-zero value (actually: 1) if
3243fedf
MK
107.I x
108is an infinity (positive or negative).
109(This is all that C99 requires.)
fea681da
MK
110.SH "SEE ALSO"
111.BR finite (3),
112.BR INFINITY (3),
113.BR isgreater (3)