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 March 28, 2020 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 SYNOPSIS 34.In math.h 35.Ft int 36.Fn fpclassify "real-floating x" 37.Ft int 38.Fn isfinite "real-floating x" 39.Ft int 40.Fn isinf "real-floating x" 41.Ft int 42.Fn isnan "real-floating x" 43.Ft int 44.Fn isnormal "real-floating x" 45.Sh DESCRIPTION 46The 47.Fn fpclassify 48macro takes an argument of 49.Fa x 50and returns one of the following manifest constants. 51.Bl -tag -width ".Dv FP_SUBNORMAL" 52.It Dv FP_INFINITE 53Indicates that 54.Fa x 55is an infinite number. 56.It Dv FP_NAN 57Indicates that 58.Fa x 59is not a number (NaN). 60.It Dv FP_NORMAL 61Indicates that 62.Fa x 63is a normalized number. 64.It Dv FP_SUBNORMAL 65Indicates that 66.Fa x 67is a denormalized number. 68.It Dv FP_ZERO 69Indicates that 70.Fa x 71is zero (0 or \-0). 72.El 73.Pp 74The 75.Fn isfinite 76macro returns a non-zero value if and only if its argument has 77a finite (zero, subnormal, or normal) value. 78The 79.Fn isinf , 80.Fn isnan , 81and 82.Fn isnormal 83macros return non-zero if and only if 84.Fa x 85is an infinity, NaN, 86or a non-zero normalized number, respectively. 87.Pp 88The symbol 89.Fn isnanf 90is provided as an alias to 91.Fn isnan 92for compatibility, and its use is deprecated. 93Similarly, 94.Fn finite 95and 96.Fn finitef 97are deprecated versions of 98.Fn isfinite . 99.Sh SEE ALSO 100.Xr isgreater 3 , 101.Xr signbit 3 102.Sh STANDARDS 103The 104.Fn fpclassify , 105.Fn isfinite , 106.Fn isinf , 107.Fn isnan , 108and 109.Fn isnormal 110macros conform to 111.St -isoC-99 . 112.Sh HISTORY 113The 114.Fn fpclassify , 115.Fn isfinite , 116.Fn isinf , 117.Fn isnan , 118and 119.Fn isnormal 120macros were added in 121.Dx 1.3 . 122.Bx 3 123introduced 124.Fn isinf 125and 126.Fn isnan 127functions, which accepted 128.Vt double 129arguments; these have been superseded by the macros 130described above. 131