Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 9/08/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

SETCONTROLFPQQ

Portability Subroutine: Sets the value of the floating-point processor control word.

Module

USE IFPORT

CALL SETCONTROLFPQQ (controlword)

controlword

(Input) INTEGER(2). Floating-point processor control word.

The floating-point control word specifies how various exception conditions are handled by the floating-point math processor, sets the floating-point precision, and specifies the floating-point rounding mechanism used.

The control word can be any of the following constants (defined in IFPORT.F90):

Parameter name

Hex value

Description

FPCW$MCW_IC

Z'1000'

Infinity control mask

FPCW$AFFINE

Z'1000'

Affine infinity

FPCW$PROJECTIVE

Z'0000'

Projective infinity

FPCW$MCW_PC

Z'0300'

Precision control mask

FPCW$64

Z'0300'

64-bit precision

An exception is disabled if its control bit is set to 1. An exception is enabled if its control bit is cleared to 0.

Setting the floating-point precision and rounding mechanism can be useful if you are reusing old code that is sensitive to the floating-point precision standard used and you want to get the same results as on the old machine.

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. If you need to change the control word, always use SETCONTROLFPQQ to make sure that special routines handling floating-point stack exceptions and abnormal propagation work correctly.

NOTE:

The Intel® Fortran exception handler allows for software masking of invalid operations, but does not allow the math chip to mask them. If you choose to use the software masking, be aware that this can affect program performance if you compile code written for Intel Fortran with another compiler.

Example
USE IFPORT INTEGER(2) status, control, controlo CALL GETCONTROLFPQQ(control) WRITE (*, 9000) 'Control word: ', control ! Save old control word controlo = control ! Clear all flags control = control .AND. Z'0000' ! Set new control to round up control = control .OR. FPCW$UP CALL SETCONTROLFPQQ(control) CALL GETCONTROLFPQQ(control) WRITE (*, 9000) 'Control word: ', control 9000 FORMAT (1X, A, Z4) END