xref: /freebsd/lib/libc/gen/fpclassify.3 (revision 5d62092f9440cea08dd1af170f272671d36499b9)
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.\"
258cf5ed51SMike Barcroft.\" $FreeBSD$
268cf5ed51SMike Barcroft.\"
275d62092fSMike Barcroft.Dd February 12, 2003
288cf5ed51SMike Barcroft.Dt FPCLASSIFY 3
298cf5ed51SMike Barcroft.Os
308cf5ed51SMike Barcroft.Sh NAME
315d62092fSMike Barcroft.Nm fpclassify , isfinite , isinf , isnan , isnormal
328cf5ed51SMike Barcroft.Nd "classify a floating-point number"
338cf5ed51SMike Barcroft.Sh LIBRARY
348cf5ed51SMike Barcroft.Lb libc
358cf5ed51SMike Barcroft.Sh SYNOPSIS
368cf5ed51SMike Barcroft.In math.h
378cf5ed51SMike Barcroft.Ft int
388cf5ed51SMike Barcroft.Fn fpclassify "real-floating x"
395d62092fSMike Barcroft.Ft int
405d62092fSMike Barcroft.Fn isfinite "real-floating x"
415d62092fSMike Barcroft.Ft int
425d62092fSMike Barcroft.Fn isinf "real-floating x"
435d62092fSMike Barcroft.Ft int
445d62092fSMike Barcroft.Fn isnan "real-floating x"
455d62092fSMike Barcroft.Ft int
465d62092fSMike Barcroft.Fn isnormal "real-floating x"
478cf5ed51SMike Barcroft.Sh DESCRIPTION
488cf5ed51SMike BarcroftThe
498cf5ed51SMike Barcroft.Fn fpclassify
508cf5ed51SMike Barcroftmacro takes an argument of
518cf5ed51SMike Barcroft.Va x
528cf5ed51SMike Barcroftand returns one of the following manifest constants.
538cf5ed51SMike Barcroft.Bl -tag -width ".Dv FP_SUBNORMAL"
548cf5ed51SMike Barcroft.It Dv FP_INFINITE
558cf5ed51SMike BarcroftIndicates that
568cf5ed51SMike Barcroft.Va x
578cf5ed51SMike Barcroftis an infinite number.
588cf5ed51SMike Barcroft.It Dv FP_NAN
598cf5ed51SMike BarcroftIndicates that
608cf5ed51SMike Barcroft.Va x
618cf5ed51SMike Barcroftis not a number (NaN).
628cf5ed51SMike Barcroft.It Dv FP_NORMAL
638cf5ed51SMike BarcroftIndicates that
648cf5ed51SMike Barcroft.Va x
658cf5ed51SMike Barcroftis a normalized number.
668cf5ed51SMike Barcroft.It Dv FP_SUBNORMAL
678cf5ed51SMike BarcroftIndicates that
688cf5ed51SMike Barcroft.Va x
698cf5ed51SMike Barcroftis a denormalized number.
708cf5ed51SMike Barcroft.It Dv FP_ZERO
718cf5ed51SMike BarcroftIndicates that
728cf5ed51SMike Barcroft.Va x
738cf5ed51SMike Barcroftis zero (0 or -0).
748cf5ed51SMike Barcroft.El
755d62092fSMike Barcroft.Pp
765d62092fSMike BarcroftThe
775d62092fSMike Barcroft.Fn isfinite
785d62092fSMike Barcroftmacro returns a non-zero value if and only if its argument has
795d62092fSMike Barcrofta finite (zero, subnormal, or normal) value.  The
805d62092fSMike Barcroft.Fn isinf ,
815d62092fSMike Barcroft.Fn isnan ,
825d62092fSMike Barcroftand
835d62092fSMike Barcroft.Fn isnormal
845d62092fSMike Barcroftmacros return non-zero if and only if
855d62092fSMike Barcroft.Va x
865d62092fSMike Barcroftis an infinity, NaN,
875d62092fSMike Barcroftor a non-zero normalized number, respectively.
885d62092fSMike Barcroft.Pp
895d62092fSMike BarcroftThe symbol
905d62092fSMike Barcroft.Fn isnanf
915d62092fSMike Barcroftis provided as an alias to
925d62092fSMike Barcroft.Fn isnan
935d62092fSMike Barcroftfor compatibility, and its use is deprecated.
948cf5ed51SMike Barcroft.Sh SEE ALSO
955d62092fSMike Barcroft.Xr isgreater 3 ,
965d62092fSMike Barcroft.Xr math 3 ,
975d62092fSMike Barcroft.Xr signbit 3
988cf5ed51SMike Barcroft.Sh STANDARDS
998cf5ed51SMike BarcroftThe
1005d62092fSMike Barcroft.Fn fpclassify ,
1015d62092fSMike Barcroft.Fn isfinite ,
1025d62092fSMike Barcroft.Fn isinf ,
1035d62092fSMike Barcroft.Fn isnan ,
1045d62092fSMike Barcroftand
1055d62092fSMike Barcroft.Fn isnormal
1065d62092fSMike Barcroftmacros conform to
1078cf5ed51SMike Barcroft.St -isoC-99 .
1088cf5ed51SMike Barcroft.Sh HISTORY
1098cf5ed51SMike BarcroftThe
1105d62092fSMike Barcroft.Fn fpclassify ,
1115d62092fSMike Barcroft.Fn isfinite ,
1125d62092fSMike Barcroft.Fn isinf ,
1135d62092fSMike Barcroft.Fn isnan ,
1145d62092fSMike Barcroftand
1155d62092fSMike Barcroft.Fn isnormal
1165d62092fSMike Barcroftmacros were added in
1178cf5ed51SMike Barcroft.Fx 5.1 .
1185d62092fSMike Barcroft.Bx 3
1195d62092fSMike Barcroftintroduced
1205d62092fSMike Barcroft.Fn isinf
1215d62092fSMike Barcroftand
1225d62092fSMike Barcroft.Fn isnan
1235d62092fSMike Barcroftfunctions, which accepted
1245d62092fSMike Barcroft.Ft double
1255d62092fSMike Barcroftarguments; these have been superseded by the macros
1265d62092fSMike Barcroftdescribed above.
1278cf5ed51SMike Barcroft.Sh BUGS
1288cf5ed51SMike BarcroftBy default, the DEC Alpha architecture does not support IEEE rounding.
1295d62092fSMike BarcroftSee the compiler documentation for additional details.
130