OSDN Git Service

(split) LDP: Update original to LDP v3.50.
[linuxjm/LDP_man-pages.git] / original / man3 / fpclassify.3
1 .\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
2 .\"
3 .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
4 .\" Distributed under GPL
5 .\" %%%LICENSE_END
6 .\"
7 .\" This was done with the help of the glibc manual.
8 .\"
9 .\" 2004-10-31, aeb, corrected
10 .TH FPCLASSIFY 3  2010-09-20 "" "Linux Programmer's Manual"
11 .SH NAME
12 fpclassify, isfinite, isnormal, isnan, isinf \- floating-point
13 classification macros
14 .SH SYNOPSIS
15 .nf
16 .B #include <math.h>
17 .sp
18 .BI "int fpclassify(" x );
19 .sp
20 .BI "int isfinite(" x );
21 .sp
22 .BI "int isnormal(" x );
23 .sp
24 .BI "int isnan(" x );
25 .sp
26 .BI "int isinf(" x );
27 .fi
28 .sp
29 Link with \fI\-lm\fP.
30 .sp
31 .in -4n
32 Feature Test Macro Requirements for glibc (see
33 .BR feature_test_macros (7)):
34 .in
35 .sp
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 ():
42 .RS 4
43 _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
44 _POSIX_C_SOURCE\ >=\ 200112L;
45 .br
46 or
47 .I cc\ -std=c99
48 .RE
49 .BR isnan ():
50 .RS 4
51 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE || _ISOC99_SOURCE ||
52 _POSIX_C_SOURCE\ >=\ 200112L;
53 .br
54 or
55 .I cc\ -std=c99
56 .RE
57 .BR isinf ():
58 .RS 4
59 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
60 _POSIX_C_SOURCE\ >=\ 200112L;
61 .br
62 or
63 .I cc\ -std=c99
64 .RE
65 .ad
66 .SH DESCRIPTION
67 Floating point numbers can have special values, such as
68 infinite or NaN.
69 With the macro
70 .BI fpclassify( x )
71 you can find out what type
72 .I x
73 is.
74 The macro takes any floating-point expression as argument.
75 The result is one of the following values:
76 .TP 14
77 .B FP_NAN
78 .I x
79 is "Not a Number".
80 .TP
81 .B FP_INFINITE
82 .I x
83 is either positive infinity or negative infinity.
84 .TP
85 .B FP_ZERO
86 .I x
87 is zero.
88 .TP
89 .B FP_SUBNORMAL
90 .I x
91 is too small to be represented in normalized format.
92 .TP
93 .B FP_NORMAL
94 if nothing of the above is correct then it must be a
95 normal floating-point number.
96 .LP
97 The other macros provide a short answer to some standard questions.
98 .TP 14
99 .BI isfinite( x )
100 returns a nonzero value if
101 .br
102 (fpclassify(x) != FP_NAN && fpclassify(x) != FP_INFINITE)
103 .TP
104 .BI isnormal( x )
105 returns a nonzero value if
106 (fpclassify(x) == FP_NORMAL)
107 .TP
108 .BI isnan( x )
109 returns a nonzero value if
110 (fpclassify(x) == FP_NAN)
111 .TP
112 .BI isinf( x )
113 returns 1 if
114 .I x
115 is positive infinity, and \-1 if
116 .I x
117 is negative infinity.
118 .SH CONFORMING TO
119 C99, POSIX.1.
120
121 For
122 .BR isinf (),
123 the standards merely say that the return value is nonzero
124 if and only if the argument has an infinite value.
125 .SH NOTES
126 In glibc 2.01 and earlier,
127 .BR isinf ()
128 returns a nonzero value (actually: 1) if
129 .I x
130 is positive infinity or negative infinity.
131 (This is all that C99 requires.)
132 .SH SEE ALSO
133 .BR finite (3),
134 .BR INFINITY (3),
135 .BR isgreater (3),
136 .BR signbit (3)