]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/fpclassify.3
round.3: Fix feature test macro requirements
[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
d41a0a77 6.TH FPCLASSIFY 3 2008-08-07 "" "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:
5840de13 59.TP 14
b20979f0 60.B FP_NAN
fea681da
MK
61.I x
62is "Not a Number".
63.TP
b20979f0 64.B FP_INFINITE
fea681da 65.I x
14a05a52 66is either positive infinity or negative 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.
5840de13 81.TP 14
fea681da 82.BI isfinite( x )
c7094399 83returns a nonzero value if
fea681da
MK
84.br
85(fpclassify(x) != FP_NAN && fpclassify(x) != FP_INFINITE)
86.TP
87.BI isnormal( x )
c7094399 88returns a nonzero value if
fea681da
MK
89(fpclassify(x) == FP_NORMAL)
90.TP
91.BI isnan( x )
c7094399 92returns a nonzero 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 101.SH "CONFORMING TO"
9ebd8588 102C99, POSIX.1.
d41a0a77
MK
103
104For
105.BR isinf (),
c7094399 106the standards merely say that the return value is nonzero
d41a0a77 107if and only if the argument has an infinite value.
19c98696 108.SH NOTES
3243fedf 109In glibc 2.01 and earlier,
63aa9df0 110.BR isinf ()
c7094399 111returns a nonzero value (actually: 1) if
3243fedf 112.I x
14a05a52 113is positive infinity or negative infinity.
3243fedf 114(This is all that C99 requires.)
fea681da
MK
115.SH "SEE ALSO"
116.BR finite (3),
117.BR INFINITY (3),
61f56d72
MK
118.BR isgreater (3),
119.BR signbit (3)