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