diff options
Diffstat (limited to 'devdocs/c/numeric%2Ffenv%2Ffeexceptflag.html')
| -rw-r--r-- | devdocs/c/numeric%2Ffenv%2Ffeexceptflag.html | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/devdocs/c/numeric%2Ffenv%2Ffeexceptflag.html b/devdocs/c/numeric%2Ffenv%2Ffeexceptflag.html deleted file mode 100644 index 04da8f88..00000000 --- a/devdocs/c/numeric%2Ffenv%2Ffeexceptflag.html +++ /dev/null @@ -1,68 +0,0 @@ - <h1 id="firstHeading" class="firstHeading">fegetexceptflag, fesetexceptflag</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 fegetexceptflag( fexcept_t* flagp, int excepts );</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 fesetexceptflag( const fexcept_t* flagp, int excepts );</pre> -</td> <td> (2) </td> <td> <span class="t-mark-rev t-since-c99">(since C99)</span> </td> </tr> </table> <p>1) Attempts to obtain the full contents of the floating-point exception flags that are listed in the bitmask argument <code>excepts</code>, which is a bitwise OR of the <a href="fe_exceptions" title="c/numeric/fenv/FE exceptions">floating-point exception macros</a>.</p> -<p>2) Attempts to copy the full contents of the floating-point exception flags that are listed in <code>excepts</code> from <code>flagp</code> into the floating-point environment. Does not raise any exceptions, only modifies the flags.</p> -<p>The full contents of a floating-point exception flag is not necessarily a boolean value indicating whether the exception is raised or cleared. For example, it may be a struct which includes the boolean status and the address of the code that triggered the exception. These functions obtain all such content and obtain/store it in <code>flagp</code> in implementation-defined format.</p> -<h3 id="Parameters"> Parameters</h3> <table class="t-par-begin"> <tr class="t-par"> <td> flagp </td> <td> - </td> <td> pointer to an <code>fexcept_t</code> object where the flags will be stored or read from </td> -</tr> <tr class="t-par"> <td> excepts </td> <td> - </td> <td> bitmask listing the exception flags to get/set </td> -</tr> -</table> <h3 id="Return_value"> Return value</h3> <p><code>0</code> on success, non-zero otherwise.</p> -<h3 id="Example"> Example</h3> <div class="t-example"> <div class="c source-c"><pre data-language="c">#include <stdio.h> -#include <fenv.h> - -#pragma STDC FENV_ACCESS ON - -void show_fe_exceptions(void) -{ - printf("current exceptions raised: "); - if(fetestexcept(FE_DIVBYZERO)) printf(" FE_DIVBYZERO"); - if(fetestexcept(FE_INEXACT)) printf(" FE_INEXACT"); - if(fetestexcept(FE_INVALID)) printf(" FE_INVALID"); - if(fetestexcept(FE_OVERFLOW)) printf(" FE_OVERFLOW"); - if(fetestexcept(FE_UNDERFLOW)) printf(" FE_UNDERFLOW"); - if(fetestexcept(FE_ALL_EXCEPT)==0) printf(" none"); - printf("\n"); -} - -int main(void) -{ - fexcept_t excepts; - - /* Setup a "current" set of exception flags. */ - feraiseexcept(FE_INVALID); - show_fe_exceptions(); - - /* Save current exception flags. */ - fegetexceptflag(&excepts,FE_ALL_EXCEPT); - - /* Temporarily raise two other exceptions. */ - feclearexcept(FE_ALL_EXCEPT); - feraiseexcept(FE_OVERFLOW | FE_INEXACT); - show_fe_exceptions(); - - /* Restore previous exception flags. */ - fesetexceptflag(&excepts,FE_ALL_EXCEPT); - show_fe_exceptions(); - - return 0; -}</pre></div> <p>Output:</p> -<div class="text source-text"><pre data-language="c">current exceptions raised: FE_INVALID -current exceptions raised: FE_INEXACT FE_OVERFLOW -current exceptions raised: FE_INVALID</pre></div> </div> <h3 id="References"> References</h3> <ul> -<li> C11 standard (ISO/IEC 9899:2011): </li> -<ul> -<li> 7.6.2.2 The fegetexceptflag function (p: 210) </li> -<li> 7.6.2.4 The fesetexceptflag function (p: 211) </li> -</ul> -<li> C99 standard (ISO/IEC 9899:1999): </li> -<ul> -<li> 7.6.2.2 The fegetexceptflag function (p: 191) </li> -<li> 7.6.2.4 The fesetexceptflag function (p: 192) </li> -</ul> -</ul> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td colspan="2"> <span><a href="https://en.cppreference.com/w/cpp/numeric/fenv/feexceptflag" title="cpp/numeric/fenv/feexceptflag">C++ documentation</a></span> for <code>fegetexceptflag, fesetexceptflag</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/feexceptflag" class="_attribution-link">https://en.cppreference.com/w/c/numeric/fenv/feexceptflag</a> - </p> -</div> |
