Ok, I think I understand now. But to clarify, when you mention the range as [0,1) you are referring to the remainder with respect to the denominator, right? So given n % d = m then 0 <= m < d Is that it? But this doesn't hold if d is negative: 10 % -9 = -8 Argh! Maybe I still don't quite get it. " It depends. " " If you promise that the remainder will always be in the range " [0,1), it is what you have to do. If you are a speed demon " you may prefer saying that the sign of the modulus is not " defined and leave this out. If you intend to use the modulus " it is more useful to know that it is in that range. But the " vast majority of the time, people are not using the modulus. " " So -2 is theoretically a "better" answer. But it is slower to " produce. " " It is therefore probably not a coincidence that of the 6 " languages that you tried, the ones which are more concerned " with speed all gave -1 for an answer, and the ones which are " trying to be high-level languages gave -2. " " BTW to add a data point just to be confusing, Perl does it 3 " ways. :-) " " 1. By default Perl gives an answer in floating point. " 2. If you use integer (saying you want speed) you get -1. " 3. If you use the % (ie modulus) operator by default you " get 8 (reflecting the "careful" rounding) but if you " have "use integer" in place you get -1 for an answer. " " Note with item 3 that the answer that Perl gives *changes* " depending on whether you are hinting that you care about " speed. " " Cheers, " Ben " Thanks, Mike