Setting and Retrieving Floating-Point Status and Control Words (ia32 only)

The FPU (floating-point unit) on ia32 systems contains eight floating-point registers the system uses for numeric calculations, for status and control words, and for error pointers. You normally need to consider only the status and control words, and then only when customizing your floating-point environment.

The FPU status and control words correspond to 16-bit registers whose bits hold the value of a state of the FPU or control its operation. Visual Fortran defines a set of symbolic constants to set and reset the proper bits in the status and control words. For example:

     USE DFLIB
     CALL SETCONTROLFPQQ(FPCW$OVERFLOW .AND. FPCW$CHOP)
     ! set the floating-point control word to allow overflows
     ! and to round by truncation

The status and control symbolic constants (such as FPCW$OVERFLOW and FPCW$CHOP in the preceding example) are defined as INTEGER(2) parameters in the module DFLIB.F90 in the ...\DF98\INCLUDE folder. The status and control words are made of logical combinations (such as with .AND.) of different parameters for different FPU options.

The name of a symbolic constant takes the general form name$option. The prefix name is one of the following:

Prefixes for Parameter Flags

name Meaning
FPSW Floating-point status word
FPCW Floating-point control word
SIG Signal
FPE Floating-point exception
MTH Math function

The suffix option is one of the options available for that name. The parameter name$option corresponds either to a status or control option (for example, FPSW$ZERODIVIDE, a status word parameter that shows whether a zero-divide exception has occurred or not) or name$option corresponds to a mask, which sets all symbolic constants to 1 for all the options of name. You can use the masks in logical functions (such as IAND, IOR, and NOT) to set or to clear all options for the specified name. The following sections define the options and illustrate their use with examples.

You can control the floating-point processor options (on ia32 systems) and find out its status with the run-time library routines GETSTATUSFPQQ (ia32 only), GETCONTROLFPQQ (ia32 only), SETCONTROLFPQQ (ia32 only), and MATHERRQQ (ia32 only). Examples of using these routines also appear in the following sections.

For more information: