feclearexcept Function

Clears the supported floating-point exceptions represented by its argument.

Attention: This function is implemented only by MPLAB XC32 C compilers.

Include

<fenv.h>

Prototype

void feclearexcept(int excepts);

Argument

excepts
a value being the bitwise OR of one or more floating-point exception macros, representing the exceptions to clear

Example

See the notes at the beginning of this chapter or section for information on using printf() or scanf() (and other functions reading and writing the stdin or stdout streams) in the example code.

#include <fenv.h>
#include <stdio.h>
#include <math.h>

volatile double result;

int main(void)
{ 
  feclearexcept(FE_ALL_EXCEPT);       // clear all exceptions
  result = sqrt(-1);                  // possibly generate an exeception
  if(fetestexcept(FE_INVALID))        // was an exception raised?
    printf("FE_INVALID exception raised by sqrt() function\n");
} 

Example Output

FE_INVALID exception raised by sqrt() function