diff options
| author | Craig Jennings <c@cjennings.net> | 2025-08-14 22:58:58 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2025-08-14 22:58:58 -0500 |
| commit | 82ba818ff456bcd6d56a06226e3f27e98fbb55c3 (patch) | |
| tree | 158cfc17b2f644a10f063cb546752cfaae12c97f /devdocs/c/numeric%2Ffenv%2Fferound.html | |
| parent | 9278ddd4ea1a8b1a4c1edaa8894516e3f48d245b (diff) | |
| download | dotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.tar.gz dotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.zip | |
removing all downloaded devdocs files
Diffstat (limited to 'devdocs/c/numeric%2Ffenv%2Fferound.html')
| -rw-r--r-- | devdocs/c/numeric%2Ffenv%2Fferound.html | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/devdocs/c/numeric%2Ffenv%2Fferound.html b/devdocs/c/numeric%2Ffenv%2Fferound.html deleted file mode 100644 index 7bbe06b4..00000000 --- a/devdocs/c/numeric%2Ffenv%2Fferound.html +++ /dev/null @@ -1,88 +0,0 @@ - <h1 id="firstHeading" class="firstHeading">fegetround, fesetround</h1> <table class="t-dcl-begin"> <tr class="t-dsc-header"> <th> Defined in header <code><fenv.h></code> </th> <th> </th> <th> </th> </tr> <tr class="t-dcl t-since-c99"> <td> <pre data-language="c">int fesetround( int round );</pre> -</td> <td> (1) </td> <td> <span class="t-mark-rev t-since-c99">(since C99)</span> </td> </tr> <tr class="t-dcl t-since-c99"> <td> <pre data-language="c">int fegetround();</pre> -</td> <td> (2) </td> <td> <span class="t-mark-rev t-since-c99">(since C99)</span> </td> </tr> </table> <p>1) Attempts to establish the floating-point rounding direction equal to the argument <code>round</code>, which is expected to be one of the <a href="fe_round" title="c/numeric/fenv/FE round">floating-point rounding macros</a>.</p> -<p>2) Returns the value of the <a href="fe_round" title="c/numeric/fenv/FE round">floating-point rounding macro</a> that corresponds to the current rounding direction.</p> -<h3 id="Parameters"> Parameters</h3> <table class="t-par-begin"> <tr class="t-par"> <td> round </td> <td> - </td> <td> rounding direction, one of <a href="fe_round" title="c/numeric/fenv/FE round">floating-point rounding macros</a> </td> -</tr> -</table> <h3 id="Return_value"> Return value</h3> <p>1) <code>0</code> on success, non-zero otherwise.</p> -<p>2) the <a href="fe_round" title="c/numeric/fenv/FE round">floating-point rounding macro</a> describing the current rounding direction or a negative value if the direction cannot be determined.</p> -<h3 id="Notes"> Notes</h3> <p>The current rounding mode, reflecting the effects of the most recent <code>fesetround</code>, can also be queried with <code><a href="../../types/limits/flt_rounds" title="c/types/limits/FLT ROUNDS">FLT_ROUNDS</a></code>.</p> -<h3 id="Example"> Example</h3> <div class="t-example"> <div class="c source-c"><pre data-language="c">#include <fenv.h> -#include <math.h> -#include <stdio.h> - -// #pragma STDC FENV_ACCESS ON - -void show_fe_current_rounding_direction(void) -{ - printf("current rounding direction: "); - switch (fegetround()) { - case FE_TONEAREST: printf ("FE_TONEAREST"); break; - case FE_DOWNWARD: printf ("FE_DOWNWARD"); break; - case FE_UPWARD: printf ("FE_UPWARD"); break; - case FE_TOWARDZERO: printf ("FE_TOWARDZERO"); break; - default: printf ("unknown"); - }; - printf("\n"); -} - -int main(void) -{ - /* Default rounding direction */ - show_fe_current_rounding_direction(); - printf("+11.5 -> %+4.1f\n", rint(+11.5)); /* midway between two integers */ - printf("+12.5 -> %+4.1f\n", rint(+12.5)); /* midway between two integers */ - - /* Save current rounding direction. */ - int curr_direction = fegetround(); - - /* Temporarily change current rounding direction. */ - fesetround(FE_DOWNWARD); - show_fe_current_rounding_direction(); - printf("+11.5 -> %+4.1f\n", rint(+11.5)); - printf("+12.5 -> %+4.1f\n", rint(+12.5)); - - /* Restore default rounding direction. */ - fesetround(curr_direction); - show_fe_current_rounding_direction(); - - return 0; -}</pre></div> <p>Possible output:</p> -<div class="text source-text"><pre data-language="c">current rounding direction: FE_TONEAREST -+11.5 -> +12.0 -+12.5 -> +12.0 -current rounding direction: FE_DOWNWARD -+11.5 -> +11.0 -+12.5 -> +12.0 -current rounding direction: FE_TONEAREST</pre></div> </div> <h3 id="References"> References</h3> <ul> -<li> C23 standard (ISO/IEC 9899:2023): </li> -<ul> -<li> 7.6.3.1 The fegetround function (p: TBD) </li> -<li> 7.6.3.2 The fesetround function (p: TBD) </li> -</ul> -<li> C17 standard (ISO/IEC 9899:2018): </li> -<ul> -<li> 7.6.3.1 The fegetround function (p: TBD) </li> -<li> 7.6.3.2 The fesetround function (p: TBD) </li> -</ul> -<li> C11 standard (ISO/IEC 9899:2011): </li> -<ul> -<li> 7.6.3.1 The fegetround function (p: 212) </li> -<li> 7.6.3.2 The fesetround function (p: 212-213) </li> -</ul> -<li> C99 standard (ISO/IEC 9899:1999): </li> -<ul> -<li> 7.6.3.1 The fegetround function (p: 193) </li> -<li> 7.6.3.2 The fesetround function (p: 193-194) </li> -</ul> -</ul> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td> <div><a href="../math/nearbyint" title="c/numeric/math/nearbyint"> <span class="t-lines"><span>nearbyint</span><span>nearbyintf</span><span>nearbyintl</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><span class="t-mark-rev t-since-c99">(C99)</span></span></span></div> </td> <td> rounds to an integer using current rounding mode <br> <span class="t-mark">(function)</span> </td> -</tr> <tr class="t-dsc"> <td> <div><a href="../math/rint" title="c/numeric/math/rint"> <span class="t-lines"><span>rint</span><span>rintf</span><span>rintl</span><span>lrint</span><span>lrintf</span><span>lrintl</span><span>llrint</span><span>llrintf</span><span>llrintl</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><span class="t-mark-rev t-since-c99">(C99)</span></span><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><span class="t-mark-rev t-since-c99">(C99)</span></span><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><span class="t-mark-rev t-since-c99">(C99)</span></span></span></div> </td> <td> rounds to an integer using current rounding mode with <br> exception if the result differs <br> <span class="t-mark">(function)</span> </td> -</tr> <tr class="t-dsc"> <td colspan="2"> <span><a href="https://en.cppreference.com/w/cpp/numeric/fenv/feround" title="cpp/numeric/fenv/feround">C++ documentation</a></span> for <code>fegetround, fesetround</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/fenv/feround" class="_attribution-link">https://en.cppreference.com/w/c/numeric/fenv/feround</a> - </p> -</div> |
