1ISGREATER(3) Linux Programmer's Manual ISGREATER(3)
2
3
4
6 isgreater, isgreaterequal, isless, islessequal, islessgreater,
7 isunordered - floating-point relational tests without exception for NaN
8
10 #include <math.h>
11
12 int isgreater(x, y);
13
14 int isgreaterequal(x, y);
15
16 int isless(x, y);
17
18 int islessequal(x, y);
19
20 int islessgreater(x, y);
21
22 int isunordered(x, y);
23
24 Link with -lm.
25
26 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
27
28 All functions described here:
29 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
30
32 The normal relational operations (like <, "less than") fail if one of
33 the operands is NaN. This will cause an exception. To avoid this, C99
34 defines the macros listed below.
35
36 These macros are guaranteed to evaluate their arguments only once. The
37 arguments must be of real floating-point type (note: do not pass inte‐
38 ger values as arguments to these macros, since the arguments will not
39 be promoted to real-floating types).
40
41 isgreater()
42 determines (x) > (y) without an exception if x or y is NaN.
43
44 isgreaterequal()
45 determines (x) >= (y) without an exception if x or y is NaN.
46
47 isless()
48 determines (x) < (y) without an exception if x or y is NaN.
49
50 islessequal()
51 determines (x) <= (y) without an exception if x or y is NaN.
52
53 islessgreater()
54 determines (x) < (y) || (x) > (y) without an exception if x or y
55 is NaN. This macro is not equivalent to x != y because that
56 expression is true if x or y is NaN.
57
58 isunordered()
59 determines whether its arguments are unordered, that is, whether
60 at least one of the arguments is a NaN.
61
63 The macros other than isunordered() return the result of the relational
64 comparison; these macros return 0 if either argument is a NaN.
65
66 isunordered() returns 1 if x or y is NaN and 0 otherwise.
67
69 No errors occur.
70
72 For an explanation of the terms used in this section, see
73 attributes(7).
74
75 ┌───────────────────────────────┬───────────────┬─────────┐
76 │Interface │ Attribute │ Value │
77 ├───────────────────────────────┼───────────────┼─────────┤
78 │isgreater(), isgreaterequal(), │ Thread safety │ MT-Safe │
79 │isless(), islessequal(), │ │ │
80 │islessgreater(), isunordered() │ │ │
81 └───────────────────────────────┴───────────────┴─────────┘
83 POSIX.1-2001, POSIX.1-2008, C99.
84
86 Not all hardware supports these functions, and where hardware support
87 isn't provided, they will be emulated by macros. This will result in a
88 performance penalty. Don't use these functions if NaN is of no concern
89 for you.
90
92 fpclassify(3), isnan(3)
93
95 This page is part of release 4.16 of the Linux man-pages project. A
96 description of the project, information about reporting bugs, and the
97 latest version of this page, can be found at
98 https://www.kernel.org/doc/man-pages/.
99
100
101
102 2017-09-15 ISGREATER(3)