ieee_set_flag

Date:

10-12-2011

NAME

IEEE_SET_FLAG - Sets a floating-point exception flag

SYNOPSIS

CALL IEEE_SET_FLAG ( [FLAG=] flag [, [FLAG_VALUE=] flag_value] )
   TYPE(IEEE_FLAG_TYPE) :: flag = flag_constant
   LOGICAL :: flag_value

IMPLEMENTATION

Cray Linux Environment (CLE)

STANDARDS

Fortran

IEEE Standard for Binary Floating-point Arithmetic

DESCRIPTION

The IEEE_SET_FLAG intrinsic subroutine is called to set a flag that for a particular floating point exception. It accepts the following arguments:

flag

May be a scalar or an array of type TYPE(IEEE_FLAG_TYPE). It specifies which exception flag will be set to flag_value. The flag may be one of the named constants:

  • IEEE_DIVIDE_BY_ZERO

  • IEEE_INEXACT

  • IEEE_INVALID

  • IEEE_OVERFLOW

  • IEEE_UNDERFLOW

  • No two elements of the flag can have the same named constant.

flag_value

Must be of type logical and conformable with flag. It is an INTENT(IN) argument. If an element has the value of true, the corresponding flag is set to signaling. Otherwise, the flag is set to be quiet.

The name of this intrinsic subroutine cannot be passed as an argument.

NOTES

The IEEE intrinsic procedures use the named constants contained in a system module, so you must include the following statement in your program:

USE, INTRINSIC :: IEEE_EXCEPTIONS

EXAMPLES

Example 1:

USE, INTRINSIC :: IEEE_ARITHMETIC
USE, INTRINSIC :: IEEE_EXCEPTIONS
LOGICAL excep_current, excep_signal
REAL xdeflt
TYPE(IEEE_FLAG_TYPE) :: ovflo_signal = IEEE_OVERFLOW
CALL IEEE_GET_FLAG(ovflo_signal, excep_current)
IF ( .NOT. excep_current ) THEN
excep_signal = .TRUE.
CALL IEEE_SET_FLAG(ovflo_signal, excep_signal)
ENDIF
.   ! floatingpt operation on xdeflt
IF ( .NOT. excep_current ) THEN
excep_signal = .FALSE.
CALL IEEE_SET_FLAG(ovflo_signal, excep_signal)
ENDIF
END

SEE ALSO

IEEE_GET_FLAG(3i)