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