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