From my understanding modulus just prints out whether or not it has a remainder but I'm apparently wrong here.
You are right, but only in so far as you recognize that you are wrong.
You think too complicated: modulus is not the decision if there is a remainder or not, but it just is the remainder. 0 thus means "no reminder", and so the modulo operation can be used in a boolean context.
This obviously leaves opwn what is meant by "division remainder".
Division per se is the question "If I have X objects and distribute it to Y targets, how many will each recipient get?"
The result differs whenther or nit I can divide a single object.
Assume I have 25 € (or $ or whatever) and want to distribute them to 4 people. Then we all assume that each is entitled to 6,25 €. But what happens if I oby have 1 € coins? Then I can distribute only 6 € to each, and I will have 1 € left which cannot be distributed in a fair way.
So this shows the two possible results of 25 / 4:
- In floating point division, I get 6.25, and the reverse operation 6.25 * 4 gets 25 again, the original value.
- In integer division, I get 6. But the reverse operation 6 * 4 doesn't get 25, but 24, so I have a remainder of 1.
On other words: The remainder of x / y
is the result of x - (x / y) * y
.
If any doubts are still open, Wikipedia has a lemma about the modulo operation as well.