Floor Division

Compute floor division ⌊a/b⌋ (integer division rounding down) of two numbers instantly. Free online floor division calculator returns quotient, remainder, and exact result.

Compute floor division

About This Calculator

This Floor Division Calculator computes ⌊a/b⌋ -- the largest integer less than or equal to the exact division a/b. Unlike truncation (which rounds toward zero), floor division consistently rounds down to the nearest integer, making it essential for modular arithmetic and certain programming paradigms.

Floor division is a core operation in many programming languages. Python uses the // operator (e.g., 7 // 3 = 2), and the behavior differs from C/Java/JavaScript's truncating division when dealing with negative numbers. For example, in Python -7 // 3 = -3 (floor division), while in JavaScript -7 / 3 | 0 = -2 (truncation).

This calculator is useful for programmers learning language differences, students studying modular arithmetic, mathematicians working with integer division properties, and anyone who needs to understand the distinction between floor and truncating division.

Frequently Asked Questions

What is floor division?

Floor division computes ⌊a/b⌋ -- the largest integer less than or equal to the exact division a/b. Unlike truncation (rounding toward zero), floor division always rounds down. For example, ⌊7/3⌋ = 2 and ⌊-7/3⌋ = -3.

How is floor division different from regular division?

Regular division gives the exact floating-point result (e.g., 7/3 = 2.333...), while floor division returns only the integer part rounded down (⌊7/3⌋ = 2). Floor division is commonly used in Python with the // operator.

How does floor division handle negative numbers?

Floor division of negative numbers rounds down, not toward zero. For example, ⌊-10/3⌋ = -4 (not -3) because -4 x 3 = -12 <= -10. This ensures the remainder is always non-negative.

Where is floor division used in programming?

Floor division is used in programming for array indexing, pagination, time calculations, binary search, modular arithmetic, and hash generation. Languages like Python, Ruby, and Dart use // for floor division.

What is the remainder in floor division?

In floor division, a = b x q + r where q = ⌊a/b⌋ and 0 <= r < |b|. For example, with a = -10 and b = 3: ⌊-10/3⌋ = -4, remainder = -10 - (-4)x3 = 2.