The way you are writing this, it looks like you are actually talking about the operator % in some c-like programming language. In that case, be warned that if negative numbers are involved, the % operator can yield negative results (see https://en.wikipedia.org/wiki/Modulo_operation for details). With negative results, the two terms can produce different values that are the same mod z.
For example, my Visual Studio for C# says
$(3 + (-5 \% 3)) \% 3 = 1$, but
$ (3 + (-5)) \% 3 = -2$.
Of course $1 \equiv -2 \pmod 3$, but if you compare values in your program, then
they will compare as different.