REM() |
![]() ![]() ![]() |
The REM() function returns the remainder when one value is divided by another.
Format
REM(dividend, divisor)
where
The REM() function returns the remainder of dividing dividend by divisor. This is defined as
REM(x, y) = SIGN(x) * MOD(ABS(X), ABS(Y))
where the SIGN() function returns 1 for x > 0, -1 for x < 0 and 0 for x = 0.
The REM() function differs from the MOD() function when one of its arguments is negative. The following table shows the result of the REM() function.
If either dividend or divisor is a numeric array (a dynamic array where all elements are numeric), the REM() function operates on each element in turn and returns another numeric array. The structure of this array will be the same as that of the dividend and divisor arrays if they are identical. For arrays of differing structure, the structure of the result depends on whether the REUSE() function is used.
Example
N = REM(T, 30)
This statement finds the remainder of dividing T by 30 and assigns this to N.
See also: |