xref: /freebsd/lib/libc/gen/isgreater.3 (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1.\" Copyright (c) 2003 David Schultz <das@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.Dd February 12, 2003
26.Dt ISGREATER 3
27.Os
28.Sh NAME
29.Nm isgreater , isgreaterequal , isless , islessequal ,
30.Nm islessgreater , isunordered
31.Nd "compare two floating-point numbers"
32.Sh LIBRARY
33.Lb libc
34.Sh SYNOPSIS
35.In math.h
36.Ft int
37.Fn isgreater "real-floating x" "real-floating y"
38.Ft int
39.Fn isgreaterequal "real-floating x" "real-floating y"
40.Ft int
41.Fn isless "real-floating x" "real-floating y"
42.Ft int
43.Fn islessequal "real-floating x" "real-floating y"
44.Ft int
45.Fn islessgreater "real-floating x" "real-floating y"
46.Ft int
47.Fn isunordered "real-floating x" "real-floating y"
48.Sh DESCRIPTION
49Each of the macros
50.Fn isgreater ,
51.Fn isgreaterequal ,
52.Fn isless ,
53.Fn islessequal ,
54and
55.Fn islessgreater
56take arguments
57.Fa x
58and
59.Fa y
60and return a non-zero value if and only if its nominal
61relation on
62.Fa x
63and
64.Fa y
65is true.
66These macros always return zero if either
67argument is not a number (NaN), but unlike the corresponding C
68operators, they never raise a floating point exception.
69.Pp
70The
71.Fn isunordered
72macro takes arguments
73.Fa x
74and
75.Fa y
76and returns non-zero if and only if any of
77.Fa x
78or
79.Fa y
80are NaNs.
81For any pair of floating-point values, one
82of the relationships (less, greater, equal, unordered) holds.
83.Sh SEE ALSO
84.Xr fpclassify 3 ,
85.Xr math 3 ,
86.Xr signbit 3
87.Sh STANDARDS
88The
89.Fn isgreater ,
90.Fn isgreaterequal ,
91.Fn isless ,
92.Fn islessequal ,
93.Fn islessgreater ,
94and
95.Fn isunordered
96macros conform to
97.St -isoC-99 .
98.Sh HISTORY
99The relational macros described above first appeared in
100.Fx 5.1 .
101