# idivide

Integer division with rounding option

## Syntax

`C = idivide(A, B, opt)C = idivide(A, B)C = idivide(A, B, 'fix')C = idivide(A, B, 'round')C = idivide(A, B, 'floor')C = idivide(A, B, 'ceil')`

## Description

`C = idivide(A, B, opt)` is the same as `A./B` for integer classes except that fractional quotients are rounded to integers using the optional rounding mode specified by `opt`. The default rounding mode is `'fix'`. Inputs `A` and `B` must be real and must have the same dimensions unless one is a scalar. The arguments `A` and `B` must belong to the same integer class. Alternatively, one of the arguments can be a scalar double, while the other can be any integer type except `int64` or `uint64`. The result `C` belongs to the integer class of the input arguments.

`C = idivide(A, B)` is the same as `A./B` except that fractional quotients are rounded toward zero to the nearest integers.

`C = idivide(A, B, 'fix')` is the same as the syntax shown immediately above.

`C = idivide(A, B, 'round')` is the same as `A./B` for integer classes. Fractional quotients are rounded to the nearest integers.

`C = idivide(A, B, 'floor')` is the same as `A./B` except that fractional quotients are rounded toward negative infinity to the nearest integers.

`C = idivide(A, B, 'ceil')` is the same as `A./B` except that the fractional quotients are rounded toward infinity to the nearest integers.

## Examples

```a = int32([-2 2]); b = int32(3); idivide(a,b) % Returns [0 0] idivide(a,b,'floor') % Returns [-1 0] idivide(a,b,'ceil') % Returns [0 1] idivide(a,b,'round') % Returns [-1 1]```