Free · Arithmetic calculators ➗
Euclidean Residues and Signed Remainder Conventions
Calculate the nonnegative residue and the retained alternative signed-remainder conventions for a nonzero divisor.
- Formula & worked example
- Private in your browser
- No signup
Calculator inputs
Loading calculator…
How to use this calculator
- Enter the known values in the units shown. Results update as you type.
- Where results are editable, change one to solve backwards. Lock a value to hold it fixed.
- Use the worked example to check the method. Reset restores the starting fields.
Private by default
Inputs and results stay in this browser tab. Bookify does not upload or store the values you enter.
Formula and method
For dividend −21 and divisor 4, the nonnegative residue is 3; a dividend-signed remainder is −1.
r = x − |y| × floor(x/|y|), with 0 ≤ r < |y|
Worked example
Enter these known values and leave the other values blank.
- Dividend x
- -21
- Nonzero divisor y
- 4
- Nonnegative Euclidean residue
- 3
- Dividend-signed alternative remainder
- -1
Assumptions and limitations
- The divisor is nonzero. The Euclidean residue is nonnegative even when either input is negative.
- The displayed alternatives use ceiling division for a negative dividend or floor division with the signed divisor. Programming-language remainder conventions can differ.
- Modulo is not generally associative as a binary operation: (9 mod 4) mod 3 = 1, but 9 mod (4 mod 3) = 0. Parentheses determine the intended operation.
- Real-valued inputs are supported by the captured floor-based expressions; modular integer arithmetic uses integer inputs.
- Arithmetic uses 64 significant decimal digits, with separate rounding for displayed values.
Common questions
Why do programming languages disagree on a negative remainder?
They can choose different quotient rounding conventions. Floor, truncation and a nonnegative Euclidean residue need not give the same signed result.
References
The calculation equations, inverse formulas, units, and input rules were imported from this source. Bookify provides the interface and equation solver.
Related calculators
Explore arithmetic calculators ➗ or browse all math calculators.