It is probably better to call the % the remainder operator rather than modulo because it might be confused with the modulus of a number, ie its value without a + or - sign.
I may be mistaken, but I think that the division part of most computer chips produces two results, a quotient and a remainder. So the / and % operators both call the same part of the chip and the same process, they simply get their hands on different outputs from the same thing.
It is worthwhile printing out 7 / 3, -7 / 3, 7 / -3 and -7 / -3. Then print out 7 % 3, -7 % 3, 7 % -3, and -7 % -3. Then remember which combinations print out positive and negative results.
If you look up the java.util.Formatter class in the API, you will find a different use for the % symbol.
Originally posted by Campbell Ritchie: It is probably better to call the % the remainder operator rather than modulo because it might be confused with the modulus of a number, ie its value without a + or - sign.
You are right about modulus, but modulo also has a specific meaning in mathematics, which is not too far from the meaning in computer languages: http://en.wikipedia.org/wiki/Modulo
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
These are not the droids you are looking for. Perhaps I can interest you in a tiny ad?
a bit of art, as a gift, that will fit in a stocking