Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: PowerPC Numerics / Part 2 - The PowerPC Numerics C Implementation
Chapter 8 - Environmental Control Functions


Controlling the Exception Flags

In MathLib, the following functions control the floating-point exception flags:
feclearexceptClears one or more exceptions.
fegetexceptSaves one or more exception flags.
feraiseexceptRaises one or more exceptions.
fesetexceptRestores the state of one or more exception flags.
fetestexceptReturns the value of one or more exception flags.

The five floating-point exception flags are defined as the constants shown in Table 8-2.
Table 8-2 Floating-point exception flags in MathLib
ExceptionConstant
InexactFE_INEXACT
Divide-by-zeroFE_DIVBYZERO
UnderflowFE_UNDERFLOW
OverflowFE_OVERFLOW
InvalidFE_INVALID

MathLib also defines another constant, FE_ALL_EXCEPT, which is the logical OR of all five exceptions. Using FE_ALL_EXCEPT, you can manipulate all five floating-point exception flags as a single entity. The type fexcept_t also exists so that all
the exception flags may be accessed at once.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
13 JUL 1996