idivide
Integer division with controllable rounding.
Syntax
Section titled “Syntax”C = idivide(A, B)C = idivide(A, B, mode)Description
Section titled “Description”Returns the integer division of A by B elementwise. The optional mode controls how non-integer quotients are rounded:
'fix'(default) — truncate toward zero'round'— round to nearest, ties to even'floor'— round toward negative infinity'ceil'— round toward positive infinity
A and B must be integer types (or convertible to one).
Examples
Section titled “Examples”idivide(int32(7), int32(2)) % 3idivide(int32(-7), int32(2)) % -3 (truncation)idivide(int32(-7), int32(2), 'floor') % -4