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