$ dc
0 sL
19 lL %
dc: remainder by zero
17 0 %
dc: remainder by zero

% is the remainder operator. It’s similar to a modulo operator, but negative inputs will give negative outputs.

If you get the “dc: remainder by zero” message, you are accidentally trying to divide by zero then get the remainder, but it’s not possible to divide by zero, so you get the cryptic error message instead.

To stop this, fix your code so that you never attempt to calculate the remainder after division by zero. Maybe you have the arguments in the wrong order, or the operator in the wrong position?

To get the equivalent of the modulus operator, you can use “VALUE MODULUS % MODULUS + MODULUS %”.