ieee_set_status

Date:

10-12-2011

NAME

IEEE_SET_STATUS - Restores floating-point status

SYNOPSIS

CALL IEEE_SET_STATUS ([STATUS_VALUE=]status_value)
   TYPE(IEEE_STATUS_TYPE) :: status_value

IMPLEMENTATION

Cray Linux Environment (CLE)

STANDARDS

Fortran

IEEE Standard for Binary Floating-point Arithmetic

DESCRIPTION

The IEEE_SET_STATUS intrinsic subroutine is typically used to restore the caller’s floating-point status just before exiting a procedure. It accepts the following argument:

status_value

Must be scalar and of type TYPE(IEEE_STATUS_TYPE). It is an INTENT(IN) argument.

  • The value in status is assumed to have been produced through an invocation of ieee_get_status().

The name of this intrinsic 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:

IEEE_GET_STATUS is called upon entry to the example’s procedure CALCULATE to capture the current floating-point status. If procedure CALCULATE changes the floating-point status, the original floating-point status can be reset before exiting from CALCULATE by calling IEEE_SET_STATUS.

SUBROUTINE CALCULATE
USE IEEE_EXCEPTIONS
TYPE(IEEE_STATUS_TYPE) IEEE_STATUS

CALL IEEE_GET_STATUS(IEEE_STATUS)  ! Get Current Status
...
CALL IEEE_SET_STATUS(IEEE_STATUS)  ! Restore Current Status
END SUBROUTINE

Example 2:

IEEE_GET_STATUS is called upon entry to the example’s procedure CALCULATE to capture the current floating-point status. If procedure CALCULATE changes the floating-point status, the original floating-point status can be reset before exiting from CALCULATE by calling IEEE_SET_STATUS.

SUBROUTINE CALCULATE
USE IEEE_EXCEPTIONS
TYPE(IEEE_STATUS_TYPE) IEEE_STATUS

CALL IEEE_GET_STATUS(IEEE_STATUS)    ! Get Current status
CALL IEEE_SET_FLAGS(IEEE_ALL,.FALSE.)  ! Turn off all signaling
...
CALL IEEE_SET_STATUS(IEEE_STATUS)    ! Restore Current status
END SUBROUTINE

SEE ALSO

ieee_get_status(3i)