REM

Purpose:

Determine the remainder from a division.

Syntax:

REM(num, den)

num

-

A scalar, series, or table. The numerator value.

den

-

A scalar, series, or table. The denominator value.

Returns:

A scalar, series, or table.

Example:

rem(5,3)

 

returns 2.

Example:

W1: 1..10

W2: ravel(W1,5)

rem(W1,5)

 

returns the series: {1,2,3,4,0,1,2,3,4,0}

Example:

rem(W2,5)

 

returns the 5x2 array:

 

{{1, 1}, 

 {2, 2}, 

 {3, 3}, 

 {4, 4}, 

 {0, 0})  

Example:

rem(12.3, 3)  returns 0.3

rem(-12.3, 3) returns –0.3

mod(-12.3, 3) returns –2.7

Remarks:

rem(a, b) has the same sign as a and mod(a, b) has the same sign as b. Both are equal if the inputs have the same sign, but differ by b if the signs differ, i.e.:

 

rem(-a, b) == mod(-a, b) - b

 

REM works for scalars, series, and tables.

See Also:

CEILING

FIX

FLOOR

MOD

ROUND