]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/fpclassify.3
Put SEE ALSO section into alphabetical order.
[thirdparty/man-pages.git] / man3 / fpclassify.3
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
6 .TH FPCLASSIFY 3 2007-07-26 "" "Linux Programmer's Manual"
7 .SH NAME
8 fpclassify, isfinite, isnormal, isnan, isinf \- floating-point
9 classification macros
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
24 .sp
25 Link with \fI\-lm\fP.
26 .sp
27 .in -4n
28 Feature 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
49 .SH DESCRIPTION
50 Floating point numbers can have special values, such as
51 infinite or NaN.
52 With the macro
53 .BI fpclassify( x )
54 you can find out what type
55 .I x
56 is.
57 The macro takes any floating-point expression as argument.
58 The result is one of the following values:
59 .TP
60 .B FP_NAN
61 .I x
62 is "Not a Number".
63 .TP
64 .B FP_INFINITE
65 .I x
66 is either plus or minus infinity.
67 .TP
68 .B FP_ZERO
69 .I x
70 is zero.
71 .TP
72 .B FP_SUBNORMAL
73 .I x
74 is too small to be represented in normalized format.
75 .TP
76 .B FP_NORMAL
77 if nothing of the above is correct then it must be a
78 normal floating-point number.
79 .LP
80 The other macros provide a short answer to some standard questions.
81 .TP
82 .BI isfinite( x )
83 returns a non-zero value if
84 .br
85 (fpclassify(x) != FP_NAN && fpclassify(x) != FP_INFINITE)
86 .TP
87 .BI isnormal( x )
88 returns a non-zero value if
89 (fpclassify(x) == FP_NORMAL)
90 .TP
91 .BI isnan( x )
92 returns a non-zero value if
93 (fpclassify(x) == FP_NAN)
94 .TP
95 .BI isinf( x )
96 returns 1 if
97 .I x
98 is positive infinity, and \-1 if
99 .I x
100 is negative infinity.
101 .SH "CONFORMING TO"
102 C99
103 .SH NOTES
104 In glibc 2.01 and earlier,
105 .BR isinf ()
106 returns a non-zero value (actually: 1) if
107 .I x
108 is an infinity (positive or negative).
109 (This is all that C99 requires.)
110 .SH "SEE ALSO"
111 .BR finite (3),
112 .BR INFINITY (3),
113 .BR isgreater (3)