summaryrefslogtreecommitdiff
path: root/devdocs/c/numeric%2Ffenv%2Fferaiseexcept.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/c/numeric%2Ffenv%2Fferaiseexcept.html')
-rw-r--r--devdocs/c/numeric%2Ffenv%2Fferaiseexcept.html55
1 files changed, 55 insertions, 0 deletions
diff --git a/devdocs/c/numeric%2Ffenv%2Fferaiseexcept.html b/devdocs/c/numeric%2Ffenv%2Fferaiseexcept.html
new file mode 100644
index 00000000..ca35e49d
--- /dev/null
+++ b/devdocs/c/numeric%2Ffenv%2Fferaiseexcept.html
@@ -0,0 +1,55 @@
+ <h1 id="firstHeading" class="firstHeading">feraiseexcept</h1> <table class="t-dcl-begin"> <tr class="t-dsc-header"> <th> Defined in header <code>&lt;fenv.h&gt;</code> </th> <th> </th> <th> </th> </tr> <tr class="t-dcl t-since-c99"> <td> <pre data-language="c">int feraiseexcept( int excepts );</pre>
+</td> <td class="t-dcl-nopad"> </td> <td> <span class="t-mark-rev t-since-c99">(since C99)</span> </td> </tr> </table> <p>Attempts to raise all floating-point exceptions listed in <code>excepts</code> (a bitwise OR of the <a href="fe_exceptions" title="c/numeric/fenv/FE exceptions">floating-point exception macros</a>). If one of the exceptions is <code><a href="fe_exceptions" title="c/numeric/fenv/FE exceptions">FE_OVERFLOW</a></code> or <code><a href="http://en.cppreference.com/w/c/numeric/fenv/FE_exceptions"><span class="kw733">FE_UNDERFLOW</span></a></code>, this function may additionally raise <code><a href="fe_exceptions" title="c/numeric/fenv/FE exceptions">FE_INEXACT</a></code>. The order in which the exceptions are raised is unspecified, except that <code><a href="fe_exceptions" title="c/numeric/fenv/FE exceptions">FE_OVERFLOW</a></code> and <code><a href="http://en.cppreference.com/w/c/numeric/fenv/FE_exceptions"><span class="kw733">FE_UNDERFLOW</span></a></code> are always raised before <code><a href="fe_exceptions" title="c/numeric/fenv/FE exceptions">FE_INEXACT</a></code>.</p>
+<h3 id="Parameters"> Parameters</h3> <table class="t-par-begin"> <tr class="t-par"> <td> excepts </td> <td> - </td> <td> bitmask listing the exception flags to raise </td>
+</tr>
+</table> <h3 id="Return_value"> Return value</h3> <p><code>​0​</code> if all listed exceptions were raised, non-zero value otherwise.</p>
+<h3 id="Example"> Example</h3> <div class="t-example"> <div class="c source-c"><pre data-language="c">#include &lt;stdio.h&gt;
+#include &lt;fenv.h&gt;
+
+#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");
+ feclearexcept(FE_ALL_EXCEPT);
+ printf("\n");
+}
+
+double some_computation(void)
+{
+ /* Computation reaches a state that causes overflow. */
+ int r = feraiseexcept(FE_OVERFLOW | FE_INEXACT);
+ printf("feraiseexcept() %s\n", (r?"fails":"succeeds"));
+ return 0.0;
+}
+
+int main(void)
+{
+ some_computation();
+ show_fe_exceptions();
+
+ return 0;
+}</pre></div> <p>Output:</p>
+<div class="text source-text"><pre data-language="c">feraiseexcept() succeeds
+current exceptions raised: FE_INEXACT FE_OVERFLOW</pre></div> </div> <h3 id="References"> References</h3> <ul>
+<li> C11 standard (ISO/IEC 9899:2011): </li>
+<ul><li> 7.6.2.3 The feraiseexcept function (p: 210) </li></ul>
+<li> C99 standard (ISO/IEC 9899:1999): </li>
+<ul><li> 7.6.2.3 The feraiseexcept function (p: 191) </li></ul>
+</ul> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td> <div><a href="feclearexcept" title="c/numeric/fenv/feclearexcept"> <span class="t-lines"><span>feclearexcept</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> clears the specified floating-point status flags <br> <span class="t-mark">(function)</span> </td>
+</tr> <tr class="t-dsc"> <td> <div><a href="fetestexcept" title="c/numeric/fenv/fetestexcept"> <span class="t-lines"><span>fetestexcept</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> determines which of the specified floating-point status flags are set <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/feraiseexcept" title="cpp/numeric/fenv/feraiseexcept">C++ documentation</a></span> for <code>feraiseexcept</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/fenv/feraiseexcept" class="_attribution-link">https://en.cppreference.com/w/c/numeric/fenv/feraiseexcept</a>
+ </p>
+</div>