Remaining Calculator
Remainder
2
Modulo Calculator
Integer quotient
3
Truncated remainder (C / JavaScript)
2
Floored remainder (Python / Excel)
2
Euclidean remainder (never negative)
2
Truncated quotient
3
Floored quotient
3
Euclidean quotient
3
Exact quotient a/n
3.4
Divides exactly
No
Congruence statement
17 = 3 x 5 + 2
Check
17 mod 5 = 2 (truncated convention)
Worked out from D. E. Knuth, The Art of Computer Programming, Vol. 1, ยง1.2.4 (the floored definition of mod) and 3 other sources.
How this is worked out
3 steps
- Exact quotient: 17 / 5 = 3.4.
- Round toward zero to get the integer quotient q = 3.
- Remainder r = a - n x q = 17 - (5 x 3) = 2.
Results are general information, not financial, tax, legal, medical or engineering advice.