Skip to content

mod

Modulo operation (positive result).

C = mod(A, B)

Returns the remainder A - floor(A/B) * B. The result has the same sign as B (so mod(-5, 3) = 1, not -2). Use rem for the C-style truncated form.

mod(7, 3) % 1
mod(-7, 3) % 2 (positive result)
  • rem — Remainder of division (truncated, sign of dividend).
  • quotient — Integer portion of a division.
  • idivide — Integer division with controllable rounding.