There are multiple ways to define integer division and modulo. Each handles rounding differently, especially for negative numbers.
Floor Division (F-division)
Rounds down to the nearest integer. Remainder has same sign as divisor.
Example: -7 div 3 = -3, remainder = 2
Truncation Division (T-division)
Rounds toward zero. Remainder has same sign as dividend.
Example: -7 div 3 = -2, remainder = -1
Euclidean Division
Chooses remainder to always be non-negative.
Example: -7 mod 3 = 2
Rounding / Ceiling Variants
Some systems use rounding or ceiling instead of floor/truncation (e.g., Common Lisp).
Different programming languages may define division differently.
Important Note
For positive numbers, all definitions agree. Differences only appear with negative inputs.
However, the identity i = (i div j × j) + (i mod j) still holds in all common systems.