]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/fpclassify.3
Global edit: s/nonzero/non-zero/
[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 2004-10-31 "" "Linux Programmer's Manual"
7 .SH NAME
8 fpclassify, isfinite, isnormal, isnan \- floating-point classification macros
9 .SH SYNOPSIS
10 .nf
11 .B #include <math.h>
12 .sp
13 .BI "int fpclassify(" x );
14 .sp
15 .BI "int isfinite(" x );
16 .sp
17 .BI "int isnormal(" x );
18 .sp
19 .BI "int isnan(" x );
20 .sp
21 .BI "int isinf(" x );
22 .fi
23 .sp
24 Compile with -std=c99; link with \-lm.
25 .SH DESCRIPTION
26 Floating point numbers can have special values, such as
27 infinite or NaN. With the macro
28 .BI fpclassify( x )
29 you can find out what type
30 .I x
31 is. The macro takes any floating-point expression as argument.
32 The result takes one of the following values:
33 .TP
34 FP_NAN
35 .I x
36 is "Not a Number".
37 .TP
38 FP_INFINITE
39 .I x
40 is either plus or minus infinity.
41 .TP
42 FP_ZERO
43 .I x
44 is zero.
45 .TP
46 FP_SUBNORMAL
47 .I x
48 is too small to be represented in normalized format.
49 .TP
50 FP_NORMAL
51 if nothing of the above is correct that it must be a
52 normal floating-point number.
53 .LP
54 The other macros provide a short answer to some standard questions.
55 .TP
56 .BI isfinite( x )
57 returns a non-zero value if
58 .br
59 (fpclassify(x) != FP_NAN && fpclassify(x) != FP_INFINITE)
60 .TP
61 .BI isnormal( x )
62 returns a non-zero value if
63 (fpclassify(x) == FP_NORMAL)
64 .TP
65 .BI isnan( x )
66 returns a non-zero value if
67 (fpclassify(x) == FP_NAN)
68 .TP
69 .BI isinf( x )
70 returns a non-zero value if
71 (fpclassify(x) == FP_INFINITE)
72 .SH NOTE
73 On systems conforming to BSD 4.3,
74 .B isinf()
75 will return 1 for positive, and \-1 for negative infinity.
76 .SH "CONFORMING TO"
77 C99
78 .SH "SEE ALSO"
79 .BR finite (3),
80 .BR INFINITY (3),
81 .BR isgreater (3)
82