Variants of Integer Division

Overview
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.

Quiz (Instant Check)

1. What does F-division use?



2. T-division rounds toward?



3. Euclidean division ensures remainder is?



4. When do all division variants agree?



5. What identity is always preserved?