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