Bring in FreeBSD's msun code for our libm.
[dragonfly.git] / lib / libc / gen / fpclassify.3
1 .\" Copyright (c) 2003 Mike Barcroft <mike@FreeBSD.org>
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\"
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 .\" SUCH DAMAGE.
24 .\"
25 .\" $FreeBSD: head/lib/libc/gen/fpclassify.3 140890 2005-01-27 05:46:17Z das $
26 .\"
27 .Dd January 26, 2005
28 .Dt FPCLASSIFY 3
29 .Os
30 .Sh NAME
31 .Nm fpclassify , isfinite , isinf , isnan , isnormal
32 .Nd "classify a floating-point number"
33 .Sh LIBRARY
34 .Lb libm
35 .Sh SYNOPSIS
36 .In math.h
37 .Ft int
38 .Fn fpclassify "real-floating x"
39 .Ft int
40 .Fn isfinite "real-floating x"
41 .Ft int
42 .Fn isinf "real-floating x"
43 .Ft int
44 .Fn isnan "real-floating x"
45 .Ft int
46 .Fn isnormal "real-floating x"
47 .Sh DESCRIPTION
48 The
49 .Fn fpclassify
50 macro takes an argument of
51 .Fa x
52 and returns one of the following manifest constants.
53 .Bl -tag -width ".Dv FP_SUBNORMAL"
54 .It Dv FP_INFINITE
55 Indicates that
56 .Fa x
57 is an infinite number.
58 .It Dv FP_NAN
59 Indicates that
60 .Fa x
61 is not a number (NaN).
62 .It Dv FP_NORMAL
63 Indicates that
64 .Fa x
65 is a normalized number.
66 .It Dv FP_SUBNORMAL
67 Indicates that
68 .Fa x
69 is a denormalized number.
70 .It Dv FP_ZERO
71 Indicates that
72 .Fa x
73 is zero (0 or \-0).
74 .El
75 .Pp
76 The
77 .Fn isfinite
78 macro returns a non-zero value if and only if its argument has
79 a finite (zero, subnormal, or normal) value.
80 The
81 .Fn isinf ,
82 .Fn isnan ,
83 and
84 .Fn isnormal
85 macros return non-zero if and only if
86 .Fa x
87 is an infinity, NaN,
88 or a non-zero normalized number, respectively.
89 .Pp
90 The symbol
91 .Fn isnanf
92 is provided as an alias to
93 .Fn isnan
94 for compatibility, and its use is deprecated.
95 Similarly,
96 .Fn finite
97 and
98 .Fn finitef
99 are deprecated versions of
100 .Fn isfinite .
101 .Sh SEE ALSO
102 .Xr isgreater 3 ,
103 .Xr math 3 ,
104 .Xr signbit 3
105 .Sh STANDARDS
106 The
107 .Fn fpclassify ,
108 .Fn isfinite ,
109 .Fn isinf ,
110 .Fn isnan ,
111 and
112 .Fn isnormal
113 macros conform to
114 .St -isoC-99 .
115 .Sh HISTORY
116 The
117 .Fn fpclassify ,
118 .Fn isfinite ,
119 .Fn isinf ,
120 .Fn isnan ,
121 and
122 .Fn isnormal
123 macros were added in
124 .Dx 1.3 .
125 .Bx 3
126 introduced
127 .Fn isinf
128 and
129 .Fn isnan
130 functions, which accepted
131 .Vt double
132 arguments; these have been superseded by the macros
133 described above.