How this calculator works
Integer division separates a dividend into a whole multiple of the divisor plus a leftover. Euclidean division chooses a remainder at least zero and smaller than the divisor's absolute value, even for negative inputs. Truncation instead moves the quotient toward zero and leaves a remainder with the dividend's sign. A third equivalent pair uses a nonpositive remainder. All pairs satisfy the displayed division identity. Text entry preserves large integer digits exactly.
Formula
a = bq + r, with 0 <= r < |b| for Euclidean division. The divisor b must be nonzero. The alternative nonpositive remainder lies in (-|b|, 0].
Worked example
23 = 5 x 4 + 3 gives quotient 4 and remainder 3. For -23 divided by 5, Euclidean division gives -23 = 5 x (-5) + 2, while truncation gives -23 = 5 x (-4) - 3.
Advertisement
Frequently asked questions
Can the divisor be negative?
Yes. The Euclidean remainder still lies from zero inclusive to the absolute divisor exclusive. Its quotient changes to preserve the identity.
Which remainder convention does programming use?
It depends on the language and operator. Compare the Euclidean and truncation outputs with your language's documented convention.
Can I enter decimal fractions?
This page is for exact integer division. Enter digits with an optional minus sign, without decimal points, exponents or grouping commas.