xref: /freebsd/lib/libc/gen/fpclassify.3 (revision f9218d3d4fd34f082473b3a021c6d4d109fb47cf)
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$
26.\"
27.Dd February 12, 2003
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 libc
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
48The
49.Fn fpclassify
50macro takes an argument of
51.Va x
52and returns one of the following manifest constants.
53.Bl -tag -width ".Dv FP_SUBNORMAL"
54.It Dv FP_INFINITE
55Indicates that
56.Va x
57is an infinite number.
58.It Dv FP_NAN
59Indicates that
60.Va x
61is not a number (NaN).
62.It Dv FP_NORMAL
63Indicates that
64.Va x
65is a normalized number.
66.It Dv FP_SUBNORMAL
67Indicates that
68.Va x
69is a denormalized number.
70.It Dv FP_ZERO
71Indicates that
72.Va x
73is zero (0 or -0).
74.El
75.Pp
76The
77.Fn isfinite
78macro returns a non-zero value if and only if its argument has
79a finite (zero, subnormal, or normal) value.  The
80.Fn isinf ,
81.Fn isnan ,
82and
83.Fn isnormal
84macros return non-zero if and only if
85.Va x
86is an infinity, NaN,
87or a non-zero normalized number, respectively.
88.Pp
89The symbol
90.Fn isnanf
91is provided as an alias to
92.Fn isnan
93for compatibility, and its use is deprecated.
94.Sh SEE ALSO
95.Xr isgreater 3 ,
96.Xr math 3 ,
97.Xr signbit 3
98.Sh STANDARDS
99The
100.Fn fpclassify ,
101.Fn isfinite ,
102.Fn isinf ,
103.Fn isnan ,
104and
105.Fn isnormal
106macros conform to
107.St -isoC-99 .
108.Sh HISTORY
109The
110.Fn fpclassify ,
111.Fn isfinite ,
112.Fn isinf ,
113.Fn isnan ,
114and
115.Fn isnormal
116macros were added in
117.Fx 5.1 .
118.Bx 3
119introduced
120.Fn isinf
121and
122.Fn isnan
123functions, which accepted
124.Ft double
125arguments; these have been superseded by the macros
126described above.
127.Sh BUGS
128By default, the DEC Alpha architecture does not support IEEE rounding.
129See the compiler documentation for additional details.
130