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