| <html lang="en"> |
| <head> |
| <title>isgreater - Untitled</title> |
| <meta http-equiv="Content-Type" content="text/html"> |
| <meta name="description" content="Untitled"> |
| <meta name="generator" content="makeinfo 4.13"> |
| <link title="Top" rel="start" href="index.html#Top"> |
| <link rel="up" href="Math.html#Math" title="Math"> |
| <link rel="prev" href="infinity.html#infinity" title="infinity"> |
| <link rel="next" href="ldexp.html#ldexp" title="ldexp"> |
| <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> |
| <meta http-equiv="Content-Style-Type" content="text/css"> |
| <style type="text/css"><!-- |
| pre.display { font-family:inherit } |
| pre.format { font-family:inherit } |
| pre.smalldisplay { font-family:inherit; font-size:smaller } |
| pre.smallformat { font-family:inherit; font-size:smaller } |
| pre.smallexample { font-size:smaller } |
| pre.smalllisp { font-size:smaller } |
| span.sc { font-variant:small-caps } |
| span.roman { font-family:serif; font-weight:normal; } |
| span.sansserif { font-family:sans-serif; font-weight:normal; } |
| --></style> |
| </head> |
| <body> |
| <div class="node"> |
| <a name="isgreater"></a> |
| <p> |
| Next: <a rel="next" accesskey="n" href="ldexp.html#ldexp">ldexp</a>, |
| Previous: <a rel="previous" accesskey="p" href="infinity.html#infinity">infinity</a>, |
| Up: <a rel="up" accesskey="u" href="Math.html#Math">Math</a> |
| <hr> |
| </div> |
| |
| <h3 class="section">1.30 <code>isgreater</code>, <code>isgreaterequal</code>, <code>isless</code>, <code>islessequal</code>, <code>islessgreater</code>, and <code>isunordered</code>–comparison macros</h3> |
| |
| <p><a name="index-isgreater-79"></a><a name="index-isgreaterequal-80"></a><a name="index-isless-81"></a><a name="index-islessequal-82"></a><a name="index-islessgreater-83"></a><a name="index-isunordered-84"></a><strong>Synopsis</strong> |
| <pre class="example"> #include <math.h> |
| int isgreater(real-floating <var>x</var>, real-floating <var>y</var>); |
| int isgreaterequal(real-floating <var>x</var>, real-floating <var>y</var>); |
| int isless(real-floating <var>x</var>, real-floating <var>y</var>); |
| int islessequal(real-floating <var>x</var>, real-floating <var>y</var>); |
| int islessgreater(real-floating <var>x</var>, real-floating <var>y</var>); |
| int isunordered(real-floating <var>x</var>, real-floating <var>y</var>); |
| |
| </pre> |
| <p><strong>Description</strong><br> |
| <code>isgreater</code>, <code>isgreaterequal</code>, <code>isless</code>, <code>islessequal</code>, |
| <code>islessgreater</code>, and <code>isunordered</code> are macros defined for use in |
| comparing floating-point numbers without raising any floating-point |
| exceptions. |
| |
| <p>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" floating-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 comparison 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. |
| |
| <p>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: |
| <dl> |
| <dt><code>NaN < 1.0</code><dd>causes an "invalid" exception, |
| <br><dt><code>isless(NaN, 1.0)</code><dd>does not, and |
| <br><dt><code>isless(NaN*0., 1.0)</code><dd>causes an exception due to the "NaN*0.", but not from the |
| resultant reduced comparison of isless(NaN, 1.0). |
| </dl> |
| |
| <p><br> |
| <strong>Returns</strong><br> |
| <!-- Formatting note: "$@" forces a new line --> |
| No floating-point exceptions are raised for any of the macros.<br> |
| The <code>isgreater</code> macro returns the value of (x) > (y).<br> |
| The <code>isgreaterequal</code> macro returns the value of (x) >= (y).<br> |
| The <code>isless</code> macro returns the value of (x) < (y).<br> |
| The <code>islessequal</code> macro returns the value of (x) <= (y).<br> |
| The <code>islessgreater</code> macro returns the value of (x) < (y) || (x) > (y).<br> |
| The <code>isunordered</code> macro returns 1 if either of its arguments is NaN and 0 otherwise. |
| |
| <p><br> |
| <strong>Portability</strong><br> |
| C99, POSIX. |
| |
| <p><br> |
| |
| </body></html> |
| |