2004-11-03 13:51:07 +00:00
|
|
|
.\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
|
|
|
|
.\" Distributed under GPL
|
|
|
|
.\" 2002-07-27 Walter Harms
|
|
|
|
.\" this was done with the help of the glibc manual
|
|
|
|
.\"
|
2008-08-01 05:54:27 +00:00
|
|
|
.TH ISGREATER 3 2008-08-05 "" "Linux Programmer's Manual"
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH NAME
|
2008-07-24 15:19:12 +00:00
|
|
|
isgreater, isgreaterequal, isless, islessequal, islessgreater,
|
|
|
|
isunordered \- floating-point relational tests without exception for NaN
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH SYNOPSIS
|
|
|
|
.nf
|
|
|
|
.B #include <math.h>
|
|
|
|
.sp
|
2008-07-24 15:19:12 +00:00
|
|
|
.BI "int isgreater(" x ", " y );
|
2004-11-03 13:51:07 +00:00
|
|
|
.sp
|
2008-07-24 15:19:12 +00:00
|
|
|
.BI "int isgreaterequal(" x ", " y );
|
2004-11-03 13:51:07 +00:00
|
|
|
.sp
|
2008-07-24 15:19:12 +00:00
|
|
|
.BI "int isless(" x ", " y );
|
2004-11-03 13:51:07 +00:00
|
|
|
.sp
|
2008-07-24 15:19:12 +00:00
|
|
|
.BI "int islessequal(" x ", " y );
|
2004-11-03 13:51:07 +00:00
|
|
|
.sp
|
2008-07-24 15:19:12 +00:00
|
|
|
.BI "int islessgreater(" x ", " y );
|
2004-11-03 13:51:07 +00:00
|
|
|
.sp
|
2008-07-24 15:19:12 +00:00
|
|
|
.BI "int isunordered(" x ", " y );
|
2004-11-03 13:51:07 +00:00
|
|
|
.fi
|
|
|
|
.sp
|
2008-07-24 15:19:12 +00:00
|
|
|
Link with \fI\-lm\fP.
|
|
|
|
.sp
|
|
|
|
.in -4n
|
|
|
|
Feature Test Macro Requirements for glibc (see
|
|
|
|
.BR feature_test_macros (7)):
|
|
|
|
.in
|
|
|
|
.sp
|
|
|
|
.ad l
|
|
|
|
All functions described here:
|
|
|
|
_XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE; or
|
|
|
|
.I cc\ -std=c99
|
|
|
|
.ad b
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH DESCRIPTION
|
2008-07-24 15:19:12 +00:00
|
|
|
The normal relation operations (like \fB<\fP, "less than")
|
|
|
|
will fail if one of the operands is NaN.
|
2007-04-12 22:42:49 +00:00
|
|
|
This will cause an exception.
|
2008-07-24 15:19:12 +00:00
|
|
|
To avoid this, C99 defines these macros.
|
2007-04-12 22:42:49 +00:00
|
|
|
The macros are guaranteed to evaluate their operands only once.
|
2008-07-24 15:19:12 +00:00
|
|
|
The operands can be of any real floating-point type.
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
2008-07-24 15:19:12 +00:00
|
|
|
.BR isgreater ()
|
2007-12-24 15:08:20 +00:00
|
|
|
determines \fI(x)\ >\ (y)\fP without an exception
|
|
|
|
if \fIx\fP or \fIy\fP is NaN.
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
2008-07-24 15:19:12 +00:00
|
|
|
.BR isgreaterequal ()
|
2007-12-24 15:08:20 +00:00
|
|
|
determines \fI(x)\ >=\ (y)\fP without an exception
|
|
|
|
if \fIx\fP or \fIy\fP is NaN.
|
2007-04-12 22:42:49 +00:00
|
|
|
.TP
|
2008-07-24 15:19:12 +00:00
|
|
|
.BR isless ()
|
2007-12-24 15:08:20 +00:00
|
|
|
determines \fI(x)\ <\ (y)\fP without an exception
|
|
|
|
if \fIx\fP or \fIy\fP is NaN.
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
2008-07-24 15:19:12 +00:00
|
|
|
.BR islessequal ()
|
2007-12-24 15:08:20 +00:00
|
|
|
determines \fI(x)\ <=\ (y)\fP without an exception
|
|
|
|
if \fIx\fP or \fIy\fP is NaN.
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
2008-07-24 15:19:12 +00:00
|
|
|
.BR islessgreater ()
|
2007-12-24 15:08:20 +00:00
|
|
|
determines \fI(x)\ < (y) || (x) >\ (y)\fP
|
|
|
|
without an exception if \fIx\fP or \fIy\fP is NaN.
|
|
|
|
This macro is not equivalent to \fIx\ !=\ y\fP because that expression is
|
|
|
|
true if \fIx\fP or \fIy\fP is NaN.
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
2008-07-24 15:19:12 +00:00
|
|
|
.BR isunordered ()
|
|
|
|
determines whether its arguments are unordered, that is, whether
|
|
|
|
at least one of the arguments is a NaN.
|
|
|
|
.SH RETURN VALUE
|
|
|
|
The macros other than
|
|
|
|
.BR isunordered ()
|
|
|
|
return the result of the relational comparison;
|
|
|
|
these macros return 0 if either argument is a NaN.
|
|
|
|
|
|
|
|
.BR isunordered ()
|
|
|
|
returns 1 if \fIx\fP or \fIy\fP is NaN and 0 otherwise.
|
|
|
|
.SH ERRORS
|
|
|
|
No errors occur.
|
2007-05-19 04:30:20 +00:00
|
|
|
.SH "CONFORMING TO"
|
2008-07-24 15:19:12 +00:00
|
|
|
C99, POSIX.1-2001.
|
2007-05-16 02:54:18 +00:00
|
|
|
.SH NOTES
|
2008-07-24 15:19:12 +00:00
|
|
|
Not all hardware supports these functions,
|
|
|
|
and where hardware support isn't provided, they will be emulated by macros.
|
|
|
|
This will result in a performance penalty.
|
2004-11-03 13:51:07 +00:00
|
|
|
Don't use these functions if NaN is of no concern for you.
|
|
|
|
.SH "SEE ALSO"
|
2006-12-27 04:17:45 +00:00
|
|
|
.BR fpclassify (3),
|
2004-11-12 16:25:23 +00:00
|
|
|
.BR isnan (3)
|