ISGREATER(3) NEWLIB ISGREATER(3)NAME
1.30 `isgreater', `isgreaterequal', `isless', `islessequal', `isless‐
greater', and `isunordered'-comparison macros
SYNOPSIS
#include <math.h>
int isgreater(real-floating X, real-floating Y);
int isgreaterequal(real-floating X, real-floating Y);
int isless(real-floating X, real-floating Y);
int islessequal(real-floating X, real-floating Y);
int islessgreater(real-floating X, real-floating Y);
int isunordered(real-floating X, real-floating Y);
DESCRIPTION
`isgreater', `isgreaterequal', `isless', `islessequal', `isless‐
greater', and `isunordered' are macros defined for use in comparing
floating-point numbers without raising any floating-point exceptions.
The relational operators (i.e. <, >, <=, and >=) support the usual
mathematical relationships between numeric values. For any ordered
pair of numeric values exactly one of the relationships-less, greater,
and equal-is true. Relational operators may raise the "invalid" float‐
ing-point exception when argument values are NaNs. For a NaN and a
numeric value, or for two NaNs, just the unordered relationship is true
(i.e., if one or both of the arguments a NaN, the relationship is
called unordered). The specified macros are quiet (non floating-point
exception raising) versions of the relational operators, and other com‐
parison macros that facilitate writing efficient code that accounts for
NaNs without suffering the "invalid" floating-point exception. In the
synopses shown, "real-floating" indicates that the argument is an
expression of real floating type.
Please note that saying that the macros do not raise floating-point
exceptions, it is referring to the function that they are performing.
It is certainly possible to give them an expression which causes an
exception. For example: `NaN < 1.0'
causes an "invalid" exception,
`isless(NaN, 1.0)'
does not, and
`isless(NaN*0., 1.0)'
causes an exception due to the "NaN*0.", but not from the
resultant reduced comparison of isless(NaN, 1.0).
RETURNS
No floating-point exceptions are raised for any of the macros. The
`isgreater' macro returns the value of (x) > (y). The `isgreaterequal'
macro returns the value of (x) >= (y). The `isless' macro returns the
value of (x) < (y). The `islessequal' macro returns the value of (x)
<= (y). The `islessgreater' macro returns the value of (x) < (y) ||
(x) > (y). The `isunordered' macro returns 1 if either of its argu‐
ments is NaN and 0 otherwise.
PORTABILITY
C99, POSIX.
SEE ALSO
isgreater is part of the library. The full documentation for is main‐
tained as a Texinfo manual. If info and are properly installed at your
site, the command
info
will give you access to the complete manual.
NEWLIB April 2010 ISGREATER(3)