ieee_rem

Date:

10-12-2011

NAME

IEEE_REM - Returns the remainder of x divided by y

SYNOPSIS

IEEE_REM ([X=]x [,Y=]y)

IMPLEMENTATION

Cray Linux Environment (CLE)

STANDARDS

Fortran

IEEE Standard for Binary Floating-point Arithmetic

DESCRIPTION

The IEEE_REM intrinsic function returns the remainder of the operation x divided by y. Note that this function does not have precisely the same definition as either of the Fortran 90 intrinsic functions mod(3i) or modulo(3i).

The IEEE_REM function accepts the following arguments:

x

Must be of type real.

y

Must be of type real.

IEEE_REM is an elemental function. The name of this intrinsic cannot be passed as an argument.

IEEE_REM is not invoked is the value of the IEEE_SUPPORT_DATATYPE(x) or IEEE_SUPPORT_DATATYPE(y) is false.

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

The result type and kind type parameter is the same as the argument with the largest precision and range. For example, if x is type REAL(KIND=4) and y is type REAL(KIND=8), the result is of type REAL(KIND=8).

The result value will be exactly x - y*n, where n is the integer nearest to the exact value x/y; whenever |(n - x/y)| = 1/2, n will be even. If the result value is zero, the sign is that of x.

EXAMPLES

USE, INTRINSIC :: IEEE_ARITHMETIC
REAL  x, y, r
   !Compute x and y
r = IEEE_REM(x, y)
IF (r /= 0.0) THEN
   ...
END IF

SEE ALSO

mod(3i), modulo(3i), ieee_support_datatype(3i)