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