FUNCTION REFERENCE

rem

Remainder using division rounded toward zero.

Remainder using division rounded toward zero.

Syntax

rem(A, B)

For finite inputs and nonzero B, a nonzero remainder has the sign of A. A zero divisor or a nonfinite input gives NaN. Inputs expand implicitly when their sizes match or one size is 1 in each dimension. Real numeric and logical inputs are accepted; complex input is rejected.

Example

rem([-7 7],3)   % [-1 1]

Example

rem([-5;-7],[2 3])   % [-1 -2;-1 -1]

Differences from MATLAB: none known, also for infinite divisors.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.