1ISGREATER(3)               Linux Programmer's Manual              ISGREATER(3)
2
3
4

NAME

6       isgreater,    isgreaterequal,   isless,   islessequal,   islessgreater,
7       isunordered - floating-point relational tests without exception for NaN
8

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

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

ERRORS

64       No errors occur.
65

ATTRIBUTES

67       For  an  explanation  of  the  terms  used  in  this  section,  see at‐
68       tributes(7).
69
70       ┌────────────────────────────────────────────┬───────────────┬─────────┐
71Interface                                   Attribute     Value   
72       ├────────────────────────────────────────────┼───────────────┼─────────┤
73isgreater(), isgreaterequal(), isless(),    │ Thread safety │ MT-Safe │
74islessequal(), islessgreater(),             │               │         │
75isunordered()                               │               │         │
76       └────────────────────────────────────────────┴───────────────┴─────────┘
77

CONFORMING TO

79       POSIX.1-2001, POSIX.1-2008, C99.
80

NOTES

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

SEE ALSO

88       fpclassify(3), isnan(3)
89

COLOPHON

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)
Impressum