As mike_g points out, it does a % b.

If we assume that you are talking of integer math [which is how I understood your original question to be] then the result of (a/b) is the nearest WHOLE number thatacan be divided byb, so 7/3 would give 2. If we then multiply that bybwe get 6, and 7-6 is 1. 7 % 3 should also give 1.

You may have to do more things to deal with signs and such, because I'm not sure what the spec says about a % b when one or both numbers are negative - as to what the "correct" mathematical behaviour is, I'm not quite sure. But for exampel negative a divided by negative b would make a positive number. Say we want -7 % -3:

-7 / -3 = 2

2 * -3 = -6

-7 - -6 = -13

That's not the answer we wanted - as modulo/remainder numbers should definitely ALWAYS be smaller [in absolute terms] than thebpart .

--

Mats