Beginner

Floor Division Calculator — ⌊a ÷ b⌋ with Remainder

Compute the floor division quotient ⌊a ÷ b⌋ and the corresponding remainder. Floor division always rounds toward negative infinity — this differs from truncation division for negative numbers and matches the behaviour of Python's // operator.
The number to be divided (can be negative)
The number to divide by (cannot be zero)
Floor division quotient ⌊a ÷ b⌋
3

Greatest integer q such that b × q ≤ a

Exact quotient (a ÷ b)
3.4
Remainder r = a − b × q
2
Verify: b × q + r = a
17 ✓
Truncation division ⌊a/b⌋ toward zero
3 (r = 2)
Step-by-step
1

Divide a by b (exact)

17 ÷ 5 = 3.4
2

Apply floor (round toward −∞)

⌊3.4⌋ = 3
3

Remainder

r = 17 − 5 × 3 = 2
=

Verification

5 × 3 + 2 = 17
22.42.83.13.53.94.34.65a/b⌊a/b⌋Floor division rounds the exact quotient toward −∞
Step by step
  1. 1

    Exact quotient a ÷ b

    17 ÷ 5 = 3.4
  2. 2

    Apply floor ⌊·⌋ — round toward −∞

    ⌊3.4⌋ = 3
  3. 3

    Remainder r = a − b × q

    17 − 5 × 3 = 2
Results are estimates for general information only and are not professional advice — always verify important results independently before relying on them. Read the full disclaimer.
Quick answer

How does this calculator work?

Floor division: q = ⌊a / b⌋ (round toward −∞), r = a − b × q, verify b × q + r = a. Positive numbers: same as truncation. Negative quotients differ: ⌊−7/2⌋ = −4 (floor) vs −3 (truncation). Remainder always has the same sign as the divisor. Used by Python //, Haskell div, and Ruby div.

Formula
q = ⌊a / b⌋ • r = a − b × q • always: b × q + r = a
How this is calculated

Floor division divides two numbers and rounds the exact quotient toward negative infinity (−∞) to obtain an integer quotient q. The remainder r is then defined as r = a − b × q, so that b × q + r = a exactly. For positive operands, floor division and truncation division give the same result: ⌊17 / 5⌋ = ⌊3.4⌋ = 3, remainder 2.

For negative numbers the two operations differ. Consider −7 ÷ 2: the exact quotient is −3.5. Floor division rounds toward −∞ giving q = −4 and r = −7 − 2 × (−4) = 1 (remainder positive, same sign as the divisor). Truncation rounds toward 0 giving q = −3 and r = −7 − 2 × (−3) = −1 (remainder negative, same sign as the dividend). Python's // operator, Haskell's div and Ruby's div all use floor division. C, Java, JavaScript and Python's int() all use truncation division.

The floor-division remainder r = a − b × ⌊a/b⌋ is also called the true modulo or Euclidean modulo. It always has the same sign as the divisor b. The property b × q + r = a holds for any finite non-zero b, making it easy to verify the result.

Frequently asked questions

For positive numbers they agree. For negative quotients they diverge: floor division rounds toward −∞ (further from zero), while truncation rounds toward 0 (closer to zero). For example, ⌊−7 / 2⌋ = −4 (floor) but trunc(−7 / 2) = −3 (truncation). The remainders also differ in sign: floor gives a remainder with the same sign as the divisor; truncation gives one with the same sign as the dividend.

Python's // operator performs floor division for both integers and floats. Haskell's div, Ruby's Integer#div and Dart's ~/ also use floor semantics. Most other languages (C, Java, JavaScript, C++) use truncation division by default. Python's % operator is the corresponding floor-division remainder (true modulo), while C's % is the truncation remainder.

The identity b × q + r = a always holds, regardless of signs. This lets you verify any division result: multiply the divisor by the quotient, add the remainder, and you should recover the dividend exactly. For floor division the remainder r always satisfies 0 ≤ r < |b| when b > 0, and |b| < r ≤ 0 when b < 0.

Also known as

floor division calculator
integer division with remainder
python floor division
floor div modulo calculator
quotient and remainder calculator
euclidean division floor
floor quotient calculator
div mod floor calculator

APA

TG we-Calculate Editorial Team. (2026). Floor Division Calculator — ⌊a ÷ b⌋ with Remainder [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/floor-division-calculator

Chicago

TG we-Calculate Editorial Team. "Floor Division Calculator — ⌊a ÷ b⌋ with Remainder." TG we-Calculate. 2026. https://we-calculate.com/calculator/floor-division-calculator.

IEEE

TG we-Calculate Editorial Team, "Floor Division Calculator — ⌊a ÷ b⌋ with Remainder," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/floor-division-calculator

BibTeX

@misc{wecalculate_floor_division_calculator, title = {Floor Division Calculator — ⌊a ÷ b⌋ with Remainder}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/floor-division-calculator}}, year = {2026}, note = {TG we-Calculate} }

Did this calculator help you?