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