In mathematics the remainder always lies between and , even when is negative. Round the quotient down, toward , then subtract times that quotient from .
| Step | On | |
|---|---|---|
| 1 | Divide and round the quotient down. Down means toward : rounds down to , not to . | , so |
| 2 | Multiply back. This is the largest multiple of at or below . | |
| 3 | Subtract it from the dividend. The gap from that multiple up to is the remainder. | |
| 4 | Check the range and the division equation. The remainder must satisfy and . | , so |