In C89 (and historical K&R implementations), the meaning of the remainder operator for negative operands was implementation-defined. This was changed in C99, and the change remains in C11.
...
In C89 (and historical K&R implementations), the meaning of the remainder operator for negative operands was implementation-defined. This was changed in C99, and the change remains in C11.
...