[Previous] [Contents] [Next]

fp_exception_value()

Get the value of the current exception registers

Synopsis:

#include <fpstatus.h>

int fp_exception_value( int mask );

Library:

libm

Description:

The fp_exception_value() function gets the value of the current exception registers. Set bits indicate that the exception has signaled, unset bits indicate that the exception hasn't signaled.

Returns:

The value of the current exception registers based on the values from <fpstatus.h>.

Examples:

#include <fpstatus.h>

int main(int argc, char** argv) 
{
   int ret;

/* Test to see if an operation has set (but not necessarily
 * signaled depending on the exception mask) the
 * division by zero bit:
 */

   if (fp_exception_value(_FP_EXC_DIVZERO) & _FP_EXC_DIVZERO)
      printf("Division by zero has occurred \n");
   else
      printf("Division by zero has not occurred \n");

   return(0);

}

Classification:

ANSI

Safety:
Cancellation point No
Interrupt handler No
Signal handler No
Thread Yes

See also:

fp_precision(), fp_rounding(), fp_exception_mask()


[Previous] [Contents] [Next]