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