From: John W Kennedy Date: 2009-03-20T11:07:21+09:00 Subject: Re: Modulo ? On 3/19/09 6:03 PM, Sebastian Hungerecker wrote: > Michael Malone wrote: >> Many people I know and work with simplify the modulo operator to >> themselves as remainder, so mentally (whether or not it is correct) >> assume 0/7 = 0 r 7 > > Maybe I'm slow, but I don't get it. > You're saying that many people assume that x % y is the same as the remainder > of dividing x by y, right? I don't see anything wrong with that. > If I understand you correctly, you're also saying that this assumption is > wrong in the case of 0%7. I don't understand why that should be the case. The > remainder of 0/7 is 0, right? And 0%7 is also 0, so where's the problem? Going by the usual definition of "remainder", there is a difference between modulo and remainder when negative numbers get involved. remainder(a,b) = a - trunc(a/b) * b modulo(a,b) = a - floor(a/b) * b