notes

Integer division and modulo rounding

Programming languages implement division and modulo with various rounding modes. Most languages use truncated division by default. More information and additional languages can be found on the Wikipedia article for modulo.

Truncated (rounding toward zero)

Floored (rounding down)

Euclidean (non-negative remainder)

Ceiling (rounding up)

Rounding half away from zero

Non-negative remainder