Intel® Fortran Compiler 16.0 User and Reference Guide
Portability Subroutine: Returns the floating-point processor control word.
USE IFPORT
CALL GETCONTROLFPQQ (controlword)
controlword |
(Output) INTEGER(2). Floating-point processor control word. The floating-point control word is a bit flag that controls various modes of the floating-point coprocessor. The control word can be any of the following constants (defined in IFPORT.F90):
|
An exception is disabled if its control bit is set to 1. An exception is enabled if its control bit is cleared to 0. Exceptions can be disabled by setting the control bits to 1 with SETCONTROLFPQQ.
If an exception is disabled, it does not cause an interrupt when it occurs. Instead, floating-point processes generate an appropriate special value (NaN or signed infinity), but the program continues.
You can find out which exceptions (if any) occurred by calling GETSTATUSFPQQ. If errors on floating-point exceptions are enabled (by clearing the control bits to 0 with SETCONTROLFPQQ), the operating system generates an interrupt when the exception occurs. By default, these interrupts cause run-time errors, but you can capture the interrupts with SIGNALQQ and branch to your own error-handling routines.
You can use GETCONTROLFPQQ to retrieve the current control word and SETCONTROLFPQQ to change the control word. Most users do not need to change the default settings.
USE IFPORT INTEGER(2) control CALL GETCONTROLFPQQ (control) ! if not rounding down IF (IAND(control, FPCW$DOWN) .NE. FPCW$DOWN) THEN control = IAND(control, NOT(FPCW$MCW_RC)) ! clear all ! rounding control = IOR(control, FPCW$DOWN) ! set to ! round down CALL SETCONTROLFPQQ(control) END IF END