Floor Division Calculator

Enter a dividend and divisor to get the floor-divided quotient ⌊a ÷ b⌋, the remainder, and the exact (unrounded) division for comparison.

Quick Facts

Floor division formula
a ÷ b (floored) = ⌊a / b⌋
Rounds the exact quotient down to the nearest integer, toward negative infinity.
Remainder formula
r = a − b × ⌊a / b⌋
Always has the same sign as the divisor b (or is zero).
Divisor restriction
b ≠ 0
Division by zero is undefined, so b cannot be 0.

Your Results

Calculated
Floor Quotient
-
⌊a ÷ b⌋
Remainder
-
a − b × quotient
Exact Quotient
-
Unrounded a ÷ b, for comparison
Verification
-
b × quotient + remainder

Ready

Enter a dividend and a nonzero divisor, then press Calculate.

How Floor Division Works

Floor division takes a dividend a and a divisor b, computes the exact quotient a ÷ b, and rounds that quotient down to the nearest integer — toward negative infinity, not toward zero. The formula is ⌊a / b⌋, where the ⌊ ⌋ brackets denote the floor function. This calculator also reports the matching remainder and the unrounded exact quotient so you can see exactly how the pieces fit together.

How the calculation works

Enter the dividend and divisor. The calculator first computes the exact division a ÷ b, then applies the floor function to round that value down to the nearest whole number, giving the floor quotient q = ⌊a / b⌋. The remainder is then found from r = a − b × q, which is the amount left over once b has been subtracted from a exactly q times. By construction, the remainder always has the same sign as the divisor (or is zero), and the identity b × q + r = a always holds — the calculator uses this identity as a built-in check on the result.

Common mistakes

  • Confusing floor division with truncation: "integer division" in many programming languages (C, Java, JavaScript's |0) truncates toward zero instead of flooring toward negative infinity. For positive a and b the two agree, but for -17 ÷ 5 truncation gives -3 while floor division gives -4.
  • Dividing by zero: b = 0 makes a ÷ b undefined, so floor division is undefined there too — there is no integer that "rounds down" from an undefined value.
  • Assuming the remainder is always positive when a is negative: with floor division the remainder takes the sign of the divisor, not the dividend, so a negative dividend with a positive divisor still produces a non-negative remainder.

Real-world applications

  • Programming and algorithms use floor division to convert a flat index into a (row, column) pair, to bucket values into fixed-size bins, or to implement modular arithmetic and hashing consistently for negative inputs.
  • Pagination logic uses floor division to compute how many full pages of items exist, then checks the remainder to decide whether a partial extra page is needed.
  • Calendar and time arithmetic uses floor division to convert a total number of minutes, hours, or days into whole larger units (e.g., total minutes ÷ 60 gives whole hours, with the remainder as leftover minutes).
  • Number theory and cryptography rely on floor division and its remainder as the building blocks of the Euclidean algorithm and modular arithmetic.

Frequently Asked Questions

What is floor division?
Floor division divides one number by another and rounds the result down to the nearest integer (toward negative infinity): ⌊a ÷ b⌋. For example, 17 ÷ 5 = 3.4, and the floor division result is ⌊3.4⌋ = 3.
How is floor division different from regular division?
Regular (true) division of 17 by 5 gives the exact value 3.4. Floor division discards the fractional part by rounding down, giving 3, plus a remainder of 2 so that 5 × 3 + 2 = 17.
How does floor division handle negative numbers?
Floor division always rounds toward negative infinity, not toward zero. For example, -17 ÷ 5 = -3.4, and flooring gives -4 (not -3), because -4 is the largest integer that is still less than or equal to -3.4. The remainder is then 3, since 5 × (-4) + 3 = -17.
What's the difference between floor division and truncated division?
Truncated division (used by integer division in languages like C and Java) rounds toward zero, while floor division rounds toward negative infinity. They give the same quotient when both numbers share the same sign, but differ when the dividend and divisor have opposite signs — for -17 ÷ 5, truncation gives -3 while floor division gives -4.