Floating-Point Bit Masks

Each bit mask corresponds to a unique floating-point exception that can be masked individually. The following bit mask values are defined in <float.h>.

Bit Mask Description
EM_INVALID Mask exceptions resulting from floating-point operations that are not valid. Such an exception can be caused by a floating-point value that is not valid, such as a signaling NaN, or by a problem with the FPU (floating-point unit) stack.
The corrective action taken by the FPU is to return a quiet NaN.
This type of exception indicates a serious problem and you should not mask it off.
EM_DENORMAL Mask exceptions resulting from the use of floating-point values that have not been normalised. The corrective action is to use these values and allow for gradual underflow.
This type of exception is ignored by the VisualAge C++ compiler and is masked off by default.
EM_ZERODIVIDE Mask the divide-by-zero exception. The FPU returns a value of infinity.
EM_OVERFLOW Mask the overflow exception. The FPU returns a value of infinity.
EM_UNDERFLOW Mask the underflow exception. The FPU returns either a denormalised number or zero.
EM_INEXACT Mask the exception that indicates precision has been lost.
Because this type of exception is only useful when performing integer arithmetic, while the FPU is used for floating-point arithmetic only, the exception is not meaningful and the FPU ignores it.
This exception is masked off by default.

All floating-point exceptions are masked by default.

The first of the following statements masks the floating-point underflow exception from being reported, and the second statement masks it on again.

oldstate = _control87(EM_UNDERFLOW, EM_UNDERFLOW);
oldstate = _control87(0, EM_UNDERFLOW);



Signals and Exceptions


Exception Handling for Floating-Point Exceptions