summaryrefslogtreecommitdiffstats
path: root/upstream/fedora-40/man3/isgreater.3
blob: 82dff9b59f91a73c10f13e443fff1a371c8d53b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
'\" t
.\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
.\"
.\" SPDX-License-Identifier: GPL-1.0-or-later
.\"
.\" 2002-07-27 Walter Harms
.\" this was done with the help of the glibc manual
.\"
.TH isgreater 3 2023-10-31 "Linux man-pages 6.06"
.SH NAME
isgreater, isgreaterequal, isless, islessequal, islessgreater,
isunordered \- floating-point relational tests without exception for NaN
.SH LIBRARY
Math library
.RI ( libm ", " \-lm )
.SH SYNOPSIS
.nf
.B #include <math.h>
.P
.BI "int isgreater(" x ", " y );
.BI "int isgreaterequal(" x ", " y );
.BI "int isless(" x ", " y );
.BI "int islessequal(" x ", " y );
.BI "int islessgreater(" x ", " y );
.BI "int isunordered(" x ", " y );
.fi
.P
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.RE
.P
.nf
    All functions described here:
        _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
.fi
.SH DESCRIPTION
The normal relational operations (like
.BR < ,
"less than")
fail if one of the operands is NaN.
This will cause an exception.
To avoid this, C99 defines the macros listed below.
.P
These macros are guaranteed to evaluate their arguments only once.
The arguments must be of real floating-point type (note: do not pass
integer values as arguments to these macros, since the arguments will
.I not
be promoted to real-floating types).
.TP
.BR isgreater ()
determines \fI(x)\ >\ (y)\fP without an exception
if
.I x
or
.I y
is NaN.
.TP
.BR isgreaterequal ()
determines \fI(x)\ >=\ (y)\fP without an exception
if
.I x
or
.I y
is NaN.
.TP
.BR isless ()
determines \fI(x)\ <\ (y)\fP without an exception
if
.I x
or
.I y
is NaN.
.TP
.BR islessequal ()
determines \fI(x)\ <=\ (y)\fP without an exception
if
.I x
or
.I y
is NaN.
.TP
.BR islessgreater ()
determines \fI(x)\ < (y) || (x) >\ (y)\fP
without an exception if
.I x
or
.I y
is NaN.
This macro is not equivalent to \fIx\ !=\ y\fP because that expression is
true if
.I x
or
.I y
is NaN.
.TP
.BR isunordered ()
determines whether its arguments are unordered, that is, whether
at least one of the arguments is a NaN.
.SH RETURN VALUE
The macros other than
.BR isunordered ()
return the result of the relational comparison;
these macros return 0 if either argument is a NaN.
.P
.BR isunordered ()
returns 1 if
.I x
or
.I y
is NaN and 0 otherwise.
.SH ERRORS
No errors occur.
.SH ATTRIBUTES
For an explanation of the terms used in this section, see
.BR attributes (7).
.TS
allbox;
lbx lb lb
l l l.
Interface	Attribute	Value
T{
.na
.nh
.BR isgreater (),
.BR isgreaterequal (),
.BR isless (),
.BR islessequal (),
.BR islessgreater (),
.BR isunordered ()
T}	Thread safety	MT-Safe
.TE
.SH VERSIONS
Not all hardware supports these functions,
and where hardware support isn't provided, they will be emulated by macros.
This will result in a performance penalty.
Don't use these functions if NaN is of no concern for you.
.SH STANDARDS
C11, POSIX.1-2008.
.SH HISTORY
POSIX.1-2001, C99.
.SH SEE ALSO
.BR fpclassify (3),
.BR isnan (3)