インテル® Fortran コンパイラー 19.0 デベロッパー・ガイドおよびリファレンス

GETCONTROLFPQQ

Portability Subroutine: Returns the floating-point processor control word.

Module

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 processor.

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

FPCW$53

Z'0200'

53-bit precision

FPCW$24

Z'0000'

24-bit precision

FPCW$MCW_RC

Z'0C00'

Rounding control mask

FPCW$CHOP

Z'0C00'

Truncate

FPCW$UP

Z'0800'

Round up

FPCW$DOWN

Z'0400'

Round down

FPCW$NEAR

Z'0000'

Round to nearest

FPCW$MCW_EM

Z'003F'

Exception mask

FPCW$INVALID

Z'0001'

Allow invalid numbers

FPCW$DENORMAL

Z'0002'

Allow denormals (very small numbers)

FPCW$ZERODIVIDE

Z'0004'

Allow divide by zero

FPCW$OVERFLOW

Z'0008'

Allow overflow

FPCW$UNDERFLOW

Z'0010'

Allow underflow

FPCW$INEXACT

Z'0020'

Allow inexact 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. 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.

Example

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

See Also