ieee_get_rounding_mode
- Date:
10-12-2011
NAME
IEEE_GET_ROUNDING_MODE - Returns current floating-point rounding mode
SYNOPSIS
CALL IEEE_GET_ROUNDING_MODE ([ROUND_VALUE=]round_value)
TYPE(IEEE_ROUND_TYPE) :: round_value
IMPLEMENTATION
Cray Linux Environment (CLE)
STANDARDS
Fortran
IEEE Standard for Binary Floating-point Arithmetic
DESCRIPTION
The IEEE_GET_ROUNDING_MODE intrinsic subroutine is typically called upon entry to a procedure to obtain the current floating-point rounding mode. It accepts the following argument:
- round_value
Must be scalar and of type TYPE(IEEE_FLAG_TYPE). It is an INTENT(OUT) argument.
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_ARITHMETIC
RETURN VALUES
round_value is set to one of the following values. These named constants indicate the possible floating-point rounding modes.
IEEE_NEAREST
IEEE_UP
IEEE_TO_ZERO
IEEE_DOWN
EXAMPLES
Example 1:
USE, INTRINSIC :: IEEE_ARITHMETIC
REAL xdef
REAL(8) x8
LOGICAL x_round_near_supported
TYPE(IEEE_ROUND_TYPE) :: round_nearest_flag = IEEE_NEAREST
TYPE(IEEE_ROUND_TYPE) :: current_round_status
x_round_near_supported = IEEE_SUPPORT_ROUNDING(round_nearest_flag,xdef)
IF (.NOT. x_round_near_supported) STOP "RND_NEAR_UNS"
CALL IEEE_GET_ROUNDING_MODE(round_status)
IF ( round_status == IEEE_NEAREST) then
do calculations expecting round_to_nearest
ENDIF
SEE ALSO
ieee_set_rounding_mode(3i), ieee_support_rounding(3i)