Blame man3/isgreater.3

Packit 7cfc04
.\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
Packit 7cfc04
.\"
Packit 7cfc04
.\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
Packit 7cfc04
.\" Distributed under GPL
Packit 7cfc04
.\" %%%LICENSE_END
Packit 7cfc04
.\"
Packit 7cfc04
.\" 2002-07-27 Walter Harms
Packit 7cfc04
.\" this was done with the help of the glibc manual
Packit 7cfc04
.\"
Packit 7cfc04
.TH ISGREATER 3  2017-09-15 "" "Linux Programmer's Manual"
Packit 7cfc04
.SH NAME
Packit 7cfc04
isgreater, isgreaterequal, isless, islessequal, islessgreater,
Packit 7cfc04
isunordered \- floating-point relational tests without exception for NaN
Packit 7cfc04
.SH SYNOPSIS
Packit 7cfc04
.nf
Packit 7cfc04
.B #include <math.h>
Packit 7cfc04
.PP
Packit 7cfc04
.BI "int isgreater(" x ", " y );
Packit 7cfc04
.PP
Packit 7cfc04
.BI "int isgreaterequal(" x ", " y );
Packit 7cfc04
.PP
Packit 7cfc04
.BI "int isless(" x ", " y );
Packit 7cfc04
.PP
Packit 7cfc04
.BI "int islessequal(" x ", " y );
Packit 7cfc04
.PP
Packit 7cfc04
.BI "int islessgreater(" x ", " y );
Packit 7cfc04
.PP
Packit 7cfc04
.BI "int isunordered(" x ", " y );
Packit 7cfc04
.fi
Packit 7cfc04
.PP
Packit 7cfc04
Link with \fI\-lm\fP.
Packit 7cfc04
.PP
Packit 7cfc04
.in -4n
Packit 7cfc04
Feature Test Macro Requirements for glibc (see
Packit 7cfc04
.BR feature_test_macros (7)):
Packit 7cfc04
.in
Packit 7cfc04
.PP
Packit 7cfc04
.ad l
Packit 7cfc04
All functions described here:
Packit 7cfc04
.RS
Packit 7cfc04
_ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
Packit 7cfc04
.RE
Packit 7cfc04
.ad b
Packit 7cfc04
.SH DESCRIPTION
Packit 7cfc04
The normal relational operations (like
Packit 7cfc04
.BR < ,
Packit 7cfc04
"less than")
Packit 7cfc04
fail if one of the operands is NaN.
Packit 7cfc04
This will cause an exception.
Packit 7cfc04
To avoid this, C99 defines the macros listed below.
Packit 7cfc04
.PP
Packit 7cfc04
These macros are guaranteed to evaluate their arguments only once.
Packit 7cfc04
The arguments must be of real floating-point type (note: do not pass
Packit 7cfc04
integer values as arguments to these macros, since the arguments will
Packit 7cfc04
.I not
Packit 7cfc04
be promoted to real-floating types).
Packit 7cfc04
.TP
Packit 7cfc04
.BR isgreater ()
Packit 7cfc04
determines \fI(x)\ >\ (y)\fP without an exception
Packit 7cfc04
if
Packit 7cfc04
.IR x
Packit 7cfc04
or
Packit 7cfc04
.I y
Packit 7cfc04
is NaN.
Packit 7cfc04
.TP
Packit 7cfc04
.BR isgreaterequal ()
Packit 7cfc04
determines \fI(x)\ >=\ (y)\fP without an exception
Packit 7cfc04
if
Packit 7cfc04
.IR x
Packit 7cfc04
or
Packit 7cfc04
.I y
Packit 7cfc04
is NaN.
Packit 7cfc04
.TP
Packit 7cfc04
.BR isless ()
Packit 7cfc04
determines \fI(x)\ <\ (y)\fP without an exception
Packit 7cfc04
if
Packit 7cfc04
.IR x
Packit 7cfc04
or
Packit 7cfc04
.I y
Packit 7cfc04
is NaN.
Packit 7cfc04
.TP
Packit 7cfc04
.BR islessequal ()
Packit 7cfc04
determines \fI(x)\ <=\ (y)\fP without an exception
Packit 7cfc04
if
Packit 7cfc04
.IR x
Packit 7cfc04
or
Packit 7cfc04
.I y
Packit 7cfc04
is NaN.
Packit 7cfc04
.TP
Packit 7cfc04
.BR islessgreater ()
Packit 7cfc04
determines \fI(x)\ < (y) || (x) >\ (y)\fP
Packit 7cfc04
without an exception if
Packit 7cfc04
.IR x
Packit 7cfc04
or
Packit 7cfc04
.I y
Packit 7cfc04
is NaN.
Packit 7cfc04
This macro is not equivalent to \fIx\ !=\ y\fP because that expression is
Packit 7cfc04
true if
Packit 7cfc04
.IR x
Packit 7cfc04
or
Packit 7cfc04
.I y
Packit 7cfc04
is NaN.
Packit 7cfc04
.TP
Packit 7cfc04
.BR isunordered ()
Packit 7cfc04
determines whether its arguments are unordered, that is, whether
Packit 7cfc04
at least one of the arguments is a NaN.
Packit 7cfc04
.SH RETURN VALUE
Packit 7cfc04
The macros other than
Packit 7cfc04
.BR isunordered ()
Packit 7cfc04
return the result of the relational comparison;
Packit 7cfc04
these macros return 0 if either argument is a NaN.
Packit 7cfc04
.PP
Packit 7cfc04
.BR isunordered ()
Packit 7cfc04
returns 1 if
Packit 7cfc04
.IR x
Packit 7cfc04
or
Packit 7cfc04
.I y
Packit 7cfc04
is NaN and 0 otherwise.
Packit 7cfc04
.SH ERRORS
Packit 7cfc04
No errors occur.
Packit 7cfc04
.SH ATTRIBUTES
Packit 7cfc04
For an explanation of the terms used in this section, see
Packit 7cfc04
.BR attributes (7).
Packit 7cfc04
.ad l
Packit 7cfc04
.TS
Packit 7cfc04
allbox;
Packit 7cfc04
lbw30 lb lb
Packit 7cfc04
l l l.
Packit 7cfc04
Interface	Attribute	Value
Packit 7cfc04
T{
Packit 7cfc04
.BR isgreater (),
Packit 7cfc04
.BR isgreaterequal (),
Packit 7cfc04
.BR isless (),
Packit 7cfc04
.BR islessequal (),
Packit 7cfc04
.BR islessgreater (),
Packit 7cfc04
.BR isunordered ()
Packit 7cfc04
T}	Thread safety	MT-Safe
Packit 7cfc04
.TE
Packit 7cfc04
.ad
Packit 7cfc04
.SH CONFORMING TO
Packit 7cfc04
POSIX.1-2001, POSIX.1-2008, C99.
Packit 7cfc04
.SH NOTES
Packit 7cfc04
Not all hardware supports these functions,
Packit 7cfc04
and where hardware support isn't provided, they will be emulated by macros.
Packit 7cfc04
This will result in a performance penalty.
Packit 7cfc04
Don't use these functions if NaN is of no concern for you.
Packit 7cfc04
.SH SEE ALSO
Packit 7cfc04
.BR fpclassify (3),
Packit 7cfc04
.BR isnan (3)
Packit 7cfc04
.SH COLOPHON
Packit 7cfc04
This page is part of release 4.15 of the Linux
Packit 7cfc04
.I man-pages
Packit 7cfc04
project.
Packit 7cfc04
A description of the project,
Packit 7cfc04
information about reporting bugs,
Packit 7cfc04
and the latest version of this page,
Packit 7cfc04
can be found at
Packit 7cfc04
\%https://www.kernel.org/doc/man\-pages/.