xref: /dragonfly/lib/libm/man/fpclassify.3 (revision 16dd80e4)
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
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.
95Similarly,
96.Fn finite
97and
98.Fn finitef
99are 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
106The
107.Fn fpclassify ,
108.Fn isfinite ,
109.Fn isinf ,
110.Fn isnan ,
111and
112.Fn isnormal
113macros conform to
114.St -isoC-99 .
115.Sh HISTORY
116The
117.Fn fpclassify ,
118.Fn isfinite ,
119.Fn isinf ,
120.Fn isnan ,
121and
122.Fn isnormal
123macros were added in
124.Dx 1.3 .
125.Bx 3
126introduced
127.Fn isinf
128and
129.Fn isnan
130functions, which accepted
131.Vt double
132arguments; these have been superseded by the macros
133described above.
134