Floor division is integer division that always rounds towards −∞. It is what Python’s // operator does and differs from truncation for negative numbers: −7 // 2 = −4, whereas truncating gives −3.
How to use the Floor Division Calculator
- Divide
- by
Results update as you type, and everything is calculated in your browser.
How it works
The exact quotient is computed and the floor function applied. The remainder then has the same sign as the divisor, matching the mathematical modulo operation.
Inputs explained
| Field | What to enter |
|---|---|
| Divide | A number |
| by | A number |
What each result means
- Floor division = floor([Divide]÷[by])
- Remainder (floored) = [Divide] – [by]×floor([Divide]÷[by])
- Truncated division (towards zero) = trunc([Divide]÷[by])
- Exact quotient = [Divide]÷[by]
Example values
How the main result changes when Divide changes and everything else stays at the example values above:
| Divide | Floor division |
|---|---|
| -3.5 | -2 |
| -5.25 | -3 |
| -7 | -4 |
| -8.75 | -5 |
| -10.5 | -6 |
| -14 | -7 |
Formula
Quotient = ⌊dividend ÷ divisor⌋
Remainder = dividend − quotient × divisor
Worked example
Inputs — Divide: -7; by: 2.
Results — Floor division = -4; Remainder (floored) = 1; Truncated division (towards zero) = -3; Exact quotient = -3.5.
Key terms
- Floor function
- ⌊x⌋, the greatest integer ≤ x.
Frequently asked questions
What is 7 // 2?
3.
What is −7 // 2?
−4, because floor(−3.5) = −4.
How is floor division different from truncation?
Truncation rounds towards zero; floor rounds down. They differ only for negative quotients.
Which languages use floor division?
Python (//), Ruby and R (%/%); C and Java truncate.