You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

139 line
6.4KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <title>isgreater (LIBM)</title>
  7. <meta name="description" content="isgreater (LIBM)">
  8. <meta name="keywords" content="isgreater (LIBM)">
  9. <meta name="resource-type" content="document">
  10. <meta name="distribution" content="global">
  11. <meta name="Generator" content="makeinfo">
  12. <link href="index.html#Top" rel="start" title="Top">
  13. <link href="Document-Index.html#Document-Index" rel="index" title="Document Index">
  14. <link href="Document-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
  15. <link href="Math.html#Math" rel="up" title="Math">
  16. <link href="fpclassify.html#fpclassify" rel="next" title="fpclassify">
  17. <link href="infinity.html#infinity" rel="prev" title="infinity">
  18. <style type="text/css">
  19. <!--
  20. a.summary-letter {text-decoration: none}
  21. blockquote.indentedblock {margin-right: 0em}
  22. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  23. blockquote.smallquotation {font-size: smaller}
  24. div.display {margin-left: 3.2em}
  25. div.example {margin-left: 3.2em}
  26. div.lisp {margin-left: 3.2em}
  27. div.smalldisplay {margin-left: 3.2em}
  28. div.smallexample {margin-left: 3.2em}
  29. div.smalllisp {margin-left: 3.2em}
  30. kbd {font-style: oblique}
  31. pre.display {font-family: inherit}
  32. pre.format {font-family: inherit}
  33. pre.menu-comment {font-family: serif}
  34. pre.menu-preformatted {font-family: serif}
  35. pre.smalldisplay {font-family: inherit; font-size: smaller}
  36. pre.smallexample {font-size: smaller}
  37. pre.smallformat {font-family: inherit; font-size: smaller}
  38. pre.smalllisp {font-size: smaller}
  39. span.nolinebreak {white-space: nowrap}
  40. span.roman {font-family: initial; font-weight: normal}
  41. span.sansserif {font-family: sans-serif; font-weight: normal}
  42. ul.no-bullet {list-style: none}
  43. -->
  44. </style>
  45. </head>
  46. <body lang="en">
  47. <a name="isgreater"></a>
  48. <div class="header">
  49. <p>
  50. Next: <a href="fpclassify.html#fpclassify" accesskey="n" rel="next">fpclassify</a>, Previous: <a href="infinity.html#infinity" accesskey="p" rel="prev">infinity</a>, Up: <a href="Math.html#Math" accesskey="u" rel="up">Math</a> &nbsp; [<a href="Document-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Document-Index.html#Document-Index" title="Index" rel="index">Index</a>]</p>
  51. </div>
  52. <hr>
  53. <a name="isgreater_002c-isgreaterequal_002c-isless_002c-islessequal_002c-islessgreater_002c-and-isunordered_002d_002d_002dcomparison-macros"></a>
  54. <h3 class="section">1.31 <code>isgreater</code>, <code>isgreaterequal</code>, <code>isless</code>, <code>islessequal</code>, <code>islessgreater</code>, and <code>isunordered</code>&mdash;comparison macros</h3>
  55. <a name="index-isgreater"></a>
  56. <a name="index-isgreaterequal"></a>
  57. <a name="index-isless"></a>
  58. <a name="index-islessequal"></a>
  59. <a name="index-islessgreater"></a>
  60. <a name="index-isunordered"></a>
  61. <p><strong>Synopsis</strong>
  62. </p><div class="example">
  63. <pre class="example">#include &lt;math.h&gt;
  64. int isgreater(real-floating <var>x</var>, real-floating <var>y</var>);
  65. int isgreaterequal(real-floating <var>x</var>, real-floating <var>y</var>);
  66. int isless(real-floating <var>x</var>, real-floating <var>y</var>);
  67. int islessequal(real-floating <var>x</var>, real-floating <var>y</var>);
  68. int islessgreater(real-floating <var>x</var>, real-floating <var>y</var>);
  69. int isunordered(real-floating <var>x</var>, real-floating <var>y</var>);
  70. </pre></div>
  71. <p><strong>Description</strong><br>
  72. <code>isgreater</code>, <code>isgreaterequal</code>, <code>isless</code>, <code>islessequal</code>,
  73. <code>islessgreater</code>, and <code>isunordered</code> are macros defined for use in
  74. comparing floating-point numbers without raising any floating-point
  75. exceptions.
  76. </p>
  77. <p>The relational operators (i.e. &lt;, &gt;, &lt;=, and &gt;=) support the usual mathematical
  78. relationships between numeric values. For any ordered pair of numeric
  79. values exactly one of the relationships&ndash;less, greater, and equal&ndash;is
  80. true. Relational operators may raise the &quot;invalid&quot; floating-point
  81. exception when argument values are NaNs. For a NaN and a numeric value, or
  82. for two NaNs, just the unordered relationship is true (i.e., if one or both
  83. of the arguments a NaN, the relationship is called unordered). The specified
  84. macros are quiet (non floating-point exception raising) versions of the
  85. relational operators, and other comparison macros that facilitate writing
  86. efficient code that accounts for NaNs without suffering the &quot;invalid&quot;
  87. floating-point exception. In the synopses shown, &quot;real-floating&quot; indicates
  88. that the argument is an expression of real floating type.
  89. </p>
  90. <p>Please note that saying that the macros do not raise floating-point
  91. exceptions, it is referring to the function that they are performing. It
  92. is certainly possible to give them an expression which causes an exception.
  93. For example:
  94. </p><dl compact="compact">
  95. <dt><code>NaN &lt; 1.0</code></dt>
  96. <dd><p>causes an &quot;invalid&quot; exception,
  97. </p></dd>
  98. <dt><code>isless(NaN, 1.0)</code></dt>
  99. <dd><p>does not, and
  100. </p></dd>
  101. <dt><code>isless(NaN*0., 1.0)</code></dt>
  102. <dd><p>causes an exception due to the &quot;NaN*0.&quot;, but not from the
  103. resultant reduced comparison of isless(NaN, 1.0).
  104. </p></dd>
  105. </dl>
  106. <br>
  107. <p><strong>Returns</strong><br>
  108. No floating-point exceptions are raised for any of the macros.<br>
  109. The <code>isgreater</code> macro returns the value of (x) &gt; (y).<br>
  110. The <code>isgreaterequal</code> macro returns the value of (x) &gt;= (y).<br>
  111. The <code>isless</code> macro returns the value of (x) &lt; (y).<br>
  112. The <code>islessequal</code> macro returns the value of (x) &lt;= (y).<br>
  113. The <code>islessgreater</code> macro returns the value of (x) &lt; (y) || (x) &gt; (y).<br>
  114. The <code>isunordered</code> macro returns 1 if either of its arguments is NaN and 0 otherwise.
  115. </p>
  116. <br>
  117. <p><strong>Portability</strong><br>
  118. C99, POSIX.
  119. </p>
  120. <br>
  121. <hr>
  122. <div class="header">
  123. <p>
  124. Next: <a href="fpclassify.html#fpclassify" accesskey="n" rel="next">fpclassify</a>, Previous: <a href="infinity.html#infinity" accesskey="p" rel="prev">infinity</a>, Up: <a href="Math.html#Math" accesskey="u" rel="up">Math</a> &nbsp; [<a href="Document-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Document-Index.html#Document-Index" title="Index" rel="index">Index</a>]</p>
  125. </div>
  126. </body>
  127. </html>