OSDN Git Service

(split) LDP man-pages の original/ を v3.29 に更新。
[linuxjm/LDP_man-pages.git] / original / 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  2010-09-20 "" "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 .RS 4
39 _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
40 _POSIX_C_SOURCE\ >=\ 200112L;
41 .br
42 or
43 .I cc\ -std=c99
44 .RE
45 .BR isnan ():
46 .RS 4
47 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE || _ISOC99_SOURCE ||
48 _POSIX_C_SOURCE\ >=\ 200112L;
49 .br
50 or
51 .I cc\ -std=c99
52 .RE
53 .BR isinf ():
54 .RS 4
55 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
56 _POSIX_C_SOURCE\ >=\ 200112L;
57 .br
58 or
59 .I cc\ -std=c99
60 .RE
61 .ad
62 .SH DESCRIPTION
63 Floating point numbers can have special values, such as
64 infinite or NaN.
65 With the macro
66 .BI fpclassify( x )
67 you can find out what type
68 .I x
69 is.
70 The macro takes any floating-point expression as argument.
71 The result is one of the following values:
72 .TP 14
73 .B FP_NAN
74 .I x
75 is "Not a Number".
76 .TP
77 .B FP_INFINITE
78 .I x
79 is either positive infinity or negative infinity.
80 .TP
81 .B FP_ZERO
82 .I x
83 is zero.
84 .TP
85 .B FP_SUBNORMAL
86 .I x
87 is too small to be represented in normalized format.
88 .TP
89 .B FP_NORMAL
90 if nothing of the above is correct then it must be a
91 normal floating-point number.
92 .LP
93 The other macros provide a short answer to some standard questions.
94 .TP 14
95 .BI isfinite( x )
96 returns a nonzero value if
97 .br
98 (fpclassify(x) != FP_NAN && fpclassify(x) != FP_INFINITE)
99 .TP
100 .BI isnormal( x )
101 returns a nonzero value if
102 (fpclassify(x) == FP_NORMAL)
103 .TP
104 .BI isnan( x )
105 returns a nonzero value if
106 (fpclassify(x) == FP_NAN)
107 .TP
108 .BI isinf( x )
109 returns 1 if
110 .I x
111 is positive infinity, and \-1 if
112 .I x
113 is negative infinity.
114 .SH "CONFORMING TO"
115 C99, POSIX.1.
116
117 For
118 .BR isinf (),
119 the standards merely say that the return value is nonzero
120 if and only if the argument has an infinite value.
121 .SH NOTES
122 In glibc 2.01 and earlier,
123 .BR isinf ()
124 returns a nonzero value (actually: 1) if
125 .I x
126 is positive infinity or negative infinity.
127 (This is all that C99 requires.)
128 .SH "SEE ALSO"
129 .BR finite (3),
130 .BR INFINITY (3),
131 .BR isgreater (3),
132 .BR signbit (3)