feclearexcept()

Clears the specified floating-point environment flags

  #include <fenv.h>
  
    void feclearexcept(int e);    
Parameter

e

Zero or more exceptions to reset.

Remarks

This facility may not be available on configurations of the EWL that run on platformsthat do not have floating-point math capabilities.

Listing: Example of feclearexcept()

#include <fenv.h>

#include <stdio.h>

#pragma STDC FENV_ACCESS on

int main(void)

{

double x = 123.0;

double y = 0.0;

double result;

/* Reset flags before starting the calculation. */

feclearexcept(FE_ALL_EXCEPT);

result = x / y; /* Should set the FE_DIVBYZERO flag. */

if (fetestexcept(FE_DIVBYZERO))

printf("Division by zero.\n");

return 0;

}

Output:

Division by zero.