FUNCTION REFERENCE

mod

Remainder using division rounded toward negative infinity.

Remainder using division rounded toward negative infinity.

Syntax

mod(A, B)

For finite inputs and nonzero B, the nonzero remainder has the sign of B. mod(A,0) returns A. Other nonfinite inputs produce 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

mod([-7 7],3)   % [2 1]

Example

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

Differences from MATLAB: none known, also for infinite divisors and the sign of zero results for exact multiples.

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