xref: /freebsd/lib/libc/gen/fpclassify.3 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
18cf5ed51SMike Barcroft.\" Copyright (c) 2003 Mike Barcroft <mike@FreeBSD.org>
28cf5ed51SMike Barcroft.\" All rights reserved.
38cf5ed51SMike Barcroft.\"
48cf5ed51SMike Barcroft.\" Redistribution and use in source and binary forms, with or without
58cf5ed51SMike Barcroft.\" modification, are permitted provided that the following conditions
68cf5ed51SMike Barcroft.\" are met:
78cf5ed51SMike Barcroft.\" 1. Redistributions of source code must retain the above copyright
88cf5ed51SMike Barcroft.\"    notice, this list of conditions and the following disclaimer.
98cf5ed51SMike Barcroft.\" 2. Redistributions in binary form must reproduce the above copyright
108cf5ed51SMike Barcroft.\"    notice, this list of conditions and the following disclaimer in the
118cf5ed51SMike Barcroft.\"    documentation and/or other materials provided with the distribution.
128cf5ed51SMike Barcroft.\"
138cf5ed51SMike Barcroft.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
148cf5ed51SMike Barcroft.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
158cf5ed51SMike Barcroft.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
168cf5ed51SMike Barcroft.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
178cf5ed51SMike Barcroft.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
188cf5ed51SMike Barcroft.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
198cf5ed51SMike Barcroft.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
208cf5ed51SMike Barcroft.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
218cf5ed51SMike Barcroft.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
228cf5ed51SMike Barcroft.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
238cf5ed51SMike Barcroft.\" SUCH DAMAGE.
248cf5ed51SMike Barcroft.\"
2529bf6af8SDavid Schultz.Dd January 26, 2005
268cf5ed51SMike Barcroft.Dt FPCLASSIFY 3
278cf5ed51SMike Barcroft.Os
288cf5ed51SMike Barcroft.Sh NAME
295d62092fSMike Barcroft.Nm fpclassify , isfinite , isinf , isnan , isnormal
308cf5ed51SMike Barcroft.Nd "classify a floating-point number"
318cf5ed51SMike Barcroft.Sh LIBRARY
323bdf0265SDavid Schultz.Lb libm
338cf5ed51SMike Barcroft.Sh SYNOPSIS
348cf5ed51SMike Barcroft.In math.h
358cf5ed51SMike Barcroft.Ft int
368cf5ed51SMike Barcroft.Fn fpclassify "real-floating x"
375d62092fSMike Barcroft.Ft int
385d62092fSMike Barcroft.Fn isfinite "real-floating x"
395d62092fSMike Barcroft.Ft int
405d62092fSMike Barcroft.Fn isinf "real-floating x"
415d62092fSMike Barcroft.Ft int
425d62092fSMike Barcroft.Fn isnan "real-floating x"
435d62092fSMike Barcroft.Ft int
445d62092fSMike Barcroft.Fn isnormal "real-floating x"
458cf5ed51SMike Barcroft.Sh DESCRIPTION
468cf5ed51SMike BarcroftThe
478cf5ed51SMike Barcroft.Fn fpclassify
488cf5ed51SMike Barcroftmacro takes an argument of
490e35e492SRuslan Ermilov.Fa x
508cf5ed51SMike Barcroftand returns one of the following manifest constants.
518cf5ed51SMike Barcroft.Bl -tag -width ".Dv FP_SUBNORMAL"
528cf5ed51SMike Barcroft.It Dv FP_INFINITE
538cf5ed51SMike BarcroftIndicates that
540e35e492SRuslan Ermilov.Fa x
558cf5ed51SMike Barcroftis an infinite number.
568cf5ed51SMike Barcroft.It Dv FP_NAN
578cf5ed51SMike BarcroftIndicates that
580e35e492SRuslan Ermilov.Fa x
598cf5ed51SMike Barcroftis not a number (NaN).
608cf5ed51SMike Barcroft.It Dv FP_NORMAL
618cf5ed51SMike BarcroftIndicates that
620e35e492SRuslan Ermilov.Fa x
638cf5ed51SMike Barcroftis a normalized number.
648cf5ed51SMike Barcroft.It Dv FP_SUBNORMAL
658cf5ed51SMike BarcroftIndicates that
660e35e492SRuslan Ermilov.Fa x
678cf5ed51SMike Barcroftis a denormalized number.
688cf5ed51SMike Barcroft.It Dv FP_ZERO
698cf5ed51SMike BarcroftIndicates that
700e35e492SRuslan Ermilov.Fa x
710e35e492SRuslan Ermilovis zero (0 or \-0).
728cf5ed51SMike Barcroft.El
735d62092fSMike Barcroft.Pp
745d62092fSMike BarcroftThe
755d62092fSMike Barcroft.Fn isfinite
765d62092fSMike Barcroftmacro returns a non-zero value if and only if its argument has
770e35e492SRuslan Ermilova finite (zero, subnormal, or normal) value.
780e35e492SRuslan ErmilovThe
795d62092fSMike Barcroft.Fn isinf ,
805d62092fSMike Barcroft.Fn isnan ,
815d62092fSMike Barcroftand
825d62092fSMike Barcroft.Fn isnormal
835d62092fSMike Barcroftmacros return non-zero if and only if
840e35e492SRuslan Ermilov.Fa x
855d62092fSMike Barcroftis an infinity, NaN,
865d62092fSMike Barcroftor a non-zero normalized number, respectively.
875d62092fSMike Barcroft.Pp
885d62092fSMike BarcroftThe symbol
895d62092fSMike Barcroft.Fn isnanf
905d62092fSMike Barcroftis provided as an alias to
915d62092fSMike Barcroft.Fn isnan
925d62092fSMike Barcroftfor compatibility, and its use is deprecated.
9329bf6af8SDavid SchultzSimilarly,
9429bf6af8SDavid Schultz.Fn finite
9529bf6af8SDavid Schultzand
9629bf6af8SDavid Schultz.Fn finitef
9729bf6af8SDavid Schultzare deprecated versions of
9829bf6af8SDavid Schultz.Fn isfinite .
998cf5ed51SMike Barcroft.Sh SEE ALSO
1005d62092fSMike Barcroft.Xr isgreater 3 ,
1015d62092fSMike Barcroft.Xr math 3 ,
1025d62092fSMike Barcroft.Xr signbit 3
1038cf5ed51SMike Barcroft.Sh STANDARDS
1048cf5ed51SMike BarcroftThe
1055d62092fSMike Barcroft.Fn fpclassify ,
1065d62092fSMike Barcroft.Fn isfinite ,
1075d62092fSMike Barcroft.Fn isinf ,
1085d62092fSMike Barcroft.Fn isnan ,
1095d62092fSMike Barcroftand
1105d62092fSMike Barcroft.Fn isnormal
1115d62092fSMike Barcroftmacros conform to
1128cf5ed51SMike Barcroft.St -isoC-99 .
1138cf5ed51SMike Barcroft.Sh HISTORY
1148cf5ed51SMike BarcroftThe
1155d62092fSMike Barcroft.Fn fpclassify ,
1165d62092fSMike Barcroft.Fn isfinite ,
1175d62092fSMike Barcroft.Fn isinf ,
1185d62092fSMike Barcroft.Fn isnan ,
1195d62092fSMike Barcroftand
1205d62092fSMike Barcroft.Fn isnormal
1215d62092fSMike Barcroftmacros were added in
1228cf5ed51SMike Barcroft.Fx 5.1 .
1235d62092fSMike Barcroft.Bx 3
1245d62092fSMike Barcroftintroduced
1255d62092fSMike Barcroft.Fn isinf
1265d62092fSMike Barcroftand
1275d62092fSMike Barcroft.Fn isnan
1285d62092fSMike Barcroftfunctions, which accepted
1290e35e492SRuslan Ermilov.Vt double
1305d62092fSMike Barcroftarguments; these have been superseded by the macros
1315d62092fSMike Barcroftdescribed above.
132