OSDN Git Service

LDP: Update original to LDP v3.79
[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  2013-08-06 "" "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 ATTRIBUTES
119 .SS Multithreading (see pthreads(7))
120 The
121 .BR fpclassify (),
122 .BR isfinite (),
123 .BR isnormal (),
124 .BR isnan (),
125 and
126 .BR isinf ()
127 macros are thread-safe.
128 .SH CONFORMING TO
129 C99, POSIX.1.
130
131 For
132 .BR isinf (),
133 the standards merely say that the return value is nonzero
134 if and only if the argument has an infinite value.
135 .SH NOTES
136 In glibc 2.01 and earlier,
137 .BR isinf ()
138 returns a nonzero value (actually: 1) if
139 .I x
140 is positive infinity or negative infinity.
141 (This is all that C99 requires.)
142 .SH SEE ALSO
143 .BR finite (3),
144 .BR INFINITY (3),
145 .BR isgreater (3),
146 .BR signbit (3)
147 .SH COLOPHON
148 This page is part of release 3.79 of the Linux
149 .I man-pages
150 project.
151 A description of the project,
152 information about reporting bugs,
153 and the latest version of this page,
154 can be found at
155 \%http://www.kernel.org/doc/man\-pages/.