Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/numeric/fenv/feraiseexcept"

From cppreference.com
< cpp‎ | numeric‎ | fenv
m (fix pipe in template)
m (line too long)
Line 31: Line 31:
 
     std::feclearexcept(FE_ALL_EXCEPT);
 
     std::feclearexcept(FE_ALL_EXCEPT);
 
     int r = std::feraiseexcept(FE_UNDERFLOW {{!}} FE_DIVBYZERO);
 
     int r = std::feraiseexcept(FE_UNDERFLOW {{!}} FE_DIVBYZERO);
     std::cout <<  "Raising divbyzero and underflow simultaneously " << (r?"fails":"succeeds") << " and results in\n";
+
     std::cout <<  "Raising divbyzero and underflow simultaneously "
 +
              << (r?"fails":"succeeds") << " and results in\n";
 
     int e = std::fetestexcept(FE_ALL_EXCEPT);
 
     int e = std::fetestexcept(FE_ALL_EXCEPT);
 
     if(e & FE_DIVBYZERO)
 
     if(e & FE_DIVBYZERO)

Revision as of 14:11, 26 February 2012

Template:cpp/numeric/fenv/sidebar Template:ddcl list begin <tr class="t-dsc-header">

<td>
Defined in header <cfenv>
</td>

<td></td> <td></td> </tr> <tr class="t-dcl ">

<td >
int feraiseexcept(int excepts);
</td>

<td class="t-dcl-nopad"> </td> <td > (since C++11) </td> </tr> Template:ddcl list end

Attempts to raise all floating point exceptions listed in excepts (a bitwise OR of the floating point exception macros). If one of the exceptions is FE_OVERFLOW or FE_UNDERFLOW, this function may additionally raise FE_INEXACT. The order in which the exceptions are raised is unspecified, except that FE_OVERFLOW and FE_UNDERFLOW are always raised before FE_INEXACT.

Contents

Parameters

excepts - bitmask listing the exception flags to raise

Return value

Template:cpp if all listed exceptions were raised, non-zero value otherwise.

Example

Template:example cpp

See also

Template:cpp/numeric/fenv/dcl list feclearexceptTemplate:cpp/numeric/fenv/dcl list fetestexcept