summaryrefslogtreecommitdiff
path: root/devdocs/c/numeric%2Fmath%2Finfinity.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/c/numeric%2Fmath%2Finfinity.html
new repository
Diffstat (limited to 'devdocs/c/numeric%2Fmath%2Finfinity.html')
-rw-r--r--devdocs/c/numeric%2Fmath%2Finfinity.html33
1 files changed, 33 insertions, 0 deletions
diff --git a/devdocs/c/numeric%2Fmath%2Finfinity.html b/devdocs/c/numeric%2Fmath%2Finfinity.html
new file mode 100644
index 00000000..e9559f1f
--- /dev/null
+++ b/devdocs/c/numeric%2Fmath%2Finfinity.html
@@ -0,0 +1,33 @@
+ <h1 id="firstHeading" class="firstHeading">INFINITY</h1> <table class="t-dcl-begin"> <tr class="t-dsc-header"> <th> Defined in header <code>&lt;math.h&gt;</code> </th> <th> </th> <th> </th> </tr> <tr class="t-dcl t-since-c99"> <td> <pre data-language="c">#define INFINITY /*implementation defined*/</pre>
+</td> <td class="t-dcl-nopad"> </td> <td> <span class="t-mark-rev t-since-c99">(since C99)</span> </td> </tr> </table> <p>If the implementation supports floating-point infinities, the macro <code>INFINITY</code> expands to constant expression of type <code>float</code> which evaluates to positive or unsigned infinity.</p>
+<p>If the implementation does not support floating-point infinities, the macro <code>INFINITY</code> expands to a positive value that is guaranteed to overflow a <code>float</code> at compile time, and the use of this macro generates a compiler warning.</p>
+<p>The style used to print an infinity is implementation defined.</p>
+<h3 id="Example"> Example</h3> <p>Show style used to print an infinity and IEEE format.</p>
+<div class="t-example"> <div class="c source-c"><pre data-language="c">#include &lt;stdio.h&gt;
+#include &lt;math.h&gt;
+#include &lt;stdint.h&gt;
+#include &lt;inttypes.h&gt;
+#include &lt;string.h&gt;
+
+int main(void)
+{
+ double f = INFINITY;
+ uint64_t fn; memcpy(&amp;fn, &amp;f, sizeof f);
+ printf("INFINITY: %f %" PRIx64 "\n", f, fn);
+}</pre></div> <p>Possible output:</p>
+<div class="text source-text"><pre data-language="c">INFINITY: inf 7ff0000000000000</pre></div> </div> <h3 id="References"> References</h3> <ul>
+<li> C11 standard (ISO/IEC 9899:2011): </li>
+<ul><li> 7.12/4 INFINITY (p: 231-232) </li></ul>
+<li> C99 standard (ISO/IEC 9899:1999): </li>
+<ul><li> 7.12/4 INFINITY (p: 212-213) </li></ul>
+</ul> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td> <div><a href="isinf" title="c/numeric/math/isinf"> <span class="t-lines"><span>isinf</span></span></a></div>
+<div><span class="t-lines"><span><span class="t-mark-rev t-since-c99">(C99)</span></span></span></div> </td> <td> checks if the given number is infinite <br> <span class="t-mark">(function macro)</span> </td>
+</tr> <tr class="t-dsc"> <td> <div><a href="huge_val" title="c/numeric/math/HUGE VAL"> <span class="t-lines"><span>HUGE_VALF</span><span>HUGE_VAL</span><span>HUGE_VALL</span></span></a></div>
+<div><span class="t-lines"><span><span class="t-mark-rev t-since-c99">(C99)</span></span><span><span class="t-mark-rev t-since-c99">(C99)</span></span></span></div> </td> <td> indicates value too big to be representable (infinity) by <code>float</code>, <code>double</code> and <code>long double</code> respectively <br> <span class="t-mark">(macro constant)</span> </td>
+</tr> <tr class="t-dsc"> <td colspan="2"> <span><a href="https://en.cppreference.com/w/cpp/numeric/math/INFINITY" title="cpp/numeric/math/INFINITY">C++ documentation</a></span> for <code>INFINITY</code> </td>
+</tr> </table> <div class="_attribution">
+ <p class="_attribution-p">
+ &copy; cppreference.com<br>Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.<br>
+ <a href="https://en.cppreference.com/w/c/numeric/math/INFINITY" class="_attribution-link">https://en.cppreference.com/w/c/numeric/math/INFINITY</a>
+ </p>
+</div>