diff options
| author | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
| commit | 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch) | |
| tree | f1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/c/numeric%2Fmath%2Fhuge_val.html | |
new repository
Diffstat (limited to 'devdocs/c/numeric%2Fmath%2Fhuge_val.html')
| -rw-r--r-- | devdocs/c/numeric%2Fmath%2Fhuge_val.html | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/devdocs/c/numeric%2Fmath%2Fhuge_val.html b/devdocs/c/numeric%2Fmath%2Fhuge_val.html new file mode 100644 index 00000000..d95e528b --- /dev/null +++ b/devdocs/c/numeric%2Fmath%2Fhuge_val.html @@ -0,0 +1,52 @@ + <h1 id="firstHeading" class="firstHeading">HUGE_VALF, HUGE_VAL, HUGE_VALL</h1> <table class="t-dcl-begin"> <tr class="t-dsc-header"> <th> Defined in header <code><math.h></code> </th> <th> </th> <th> </th> </tr> <tr class="t-dcl t-since-c99"> <td> <pre data-language="c">#define HUGE_VALF /*implementation defined*/</pre> +</td> <td class="t-dcl-nopad"> </td> <td> <span class="t-mark-rev t-since-c99">(since C99)</span> </td> </tr> <tr class="t-dcl"> <td class="t-dcl-nopad"> <pre data-language="c">#define HUGE_VAL /*implementation defined*/</pre> +</td> <td class="t-dcl-nopad"> </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl t-since-c99"> <td> <pre data-language="c">#define HUGE_VALL /*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>The <code>HUGE_VALF</code>, <code>HUGE_VAL</code> and <code>HUGE_VALL</code> macros expand to positive floating point constant expressions which compare equal to the values returned by floating-point functions and operators in case of overflow (see <a href="math_errhandling" title="c/numeric/math/math errhandling"><code>math_errhandling</code></a>).</p> +<table class="t-dsc-begin"> <tr class="t-dsc-hitem"> <th> Constant </th> <th> Explanation </th> +</tr> <tr class="t-dsc"> <td> <code>HUGE_VALF</code> </td> <td> Expands to positive <code>float</code> expression that indicates overflow </td> +</tr> <tr class="t-dsc"> <td> <code>HUGE_VAL</code> </td> <td> Expands to positive <code>double</code> expression that indicates overflow, not necessarily representable as a <code>float</code> </td> +</tr> <tr class="t-dsc"> <td> <code>HUGE_VALL</code> </td> <td> Expands to positive <code>long double</code> expression that indicates overflow, not necessarily representable as a <code>float</code> or <code>double</code> </td> +</tr> </table> <p>On implementations that support floating-point infinities, these macros always expand to the positive infinities of <code>float</code>, <code>double</code>, and <code>long double</code>, respectively.</p> +<h3 id="Example"> Example</h3> <div class="t-example"> <div class="c source-c"><pre data-language="c">#include <math.h> +#include <stdio.h> + +int main(void) +{ + const double result = 1.0 / 0.0; + printf("1.0/0.0 == %f\n", result); + if (result == HUGE_VAL) + puts("1.0/0.0 == HUGE_VAL"); +}</pre></div> <p>Possible output:</p> +<div class="text source-text"><pre data-language="c">1.0/0.0 == inf +1.0/0.0 == HUGE_VAL</pre></div> </div> <h3 id="References"> References</h3> <ul> +<li> C23 standard (ISO/IEC 9899:2023): </li> +<ul> +<li> 7.12/3 HUGE_VAL, HUGE_VALF, HUGE_VALL (p: TBD) </li> +<li> F.10/2 HUGE_VAL, HUGE_VALF, HUGE_VALL (p: TBD) </li> +</ul> +<li> C17 standard (ISO/IEC 9899:2018): </li> +<ul> +<li> 7.12/3 HUGE_VAL, HUGE_VALF, HUGE_VALL (p: TBD) </li> +<li> F.10/2 HUGE_VAL, HUGE_VALF, HUGE_VALL (p: TBD) </li> +</ul> +<li> C11 standard (ISO/IEC 9899:2011): </li> +<ul> +<li> 7.12/3 HUGE_VAL, HUGE_VALF, HUGE_VALL (p: 231) </li> +<li> F.10/2 HUGE_VAL, HUGE_VALF, HUGE_VALL (p: 517) </li> +</ul> +<li> C99 standard (ISO/IEC 9899:1999): </li> +<ul> +<li> 7.12/3 HUGE_VAL, HUGE_VALF, HUGE_VALL (p: 212) </li> +<li> F.9/2 HUGE_VAL, HUGE_VALF, HUGE_VALL (p: 454) </li> +</ul> +<li> C89/C90 standard (ISO/IEC 9899:1990): </li> +<ul><li> 4.5 HUGE_VAL </li></ul> +</ul> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td> <div><a href="infinity" title="c/numeric/math/INFINITY"> <span class="t-lines"><span>INFINITY</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> evaluates to positive infinity or the value guaranteed to overflow a <code>float</code> <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/HUGE_VAL" title="cpp/numeric/math/HUGE VAL">C++ documentation</a></span> for <code>HUGE_VAL</code> </td> +</tr> </table> <div class="_attribution"> + <p class="_attribution-p"> + © 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/HUGE_VAL" class="_attribution-link">https://en.cppreference.com/w/c/numeric/math/HUGE_VAL</a> + </p> +</div> |
