From Modular Arithmetic. To say A equals B modulo C means that A-B is divisible by C.

More generally, to say 'X modulo Y' is true means that the difference between X being true and X not being true is a factor of Y.

In computers, often considered to be an operation on two integers, a and b, the remainder operation a modulo b (or a mod b, or a%b) giving the unique r between 0 and b-1 (inclusive) such that a = r (modulo b).

The above write-ups are a bit opaque. Normal arithmetic operates on infinitely many numbers 1, 2, 3, ... while modular arithmetic only uses finitely many, and the numbers wrap around at some point. The obvious example is clock time, which goes 1, 2, 3, ..., 11, 12, 1, 2, 3, ...

The maximum number (12 in the case of a clock) is called the modulus. The word modulo is Latin for "with the modulus...".

Addition works normally up to the modulus, so 5 + 6 = 11, then beyond that you discard the modulus: 5 + 9 = 14 = 2 (modulo 12). Nine hours after five o'clock is two o'clock.

The equation a = b (modulo c) means that if you throw away enough copies of c from one side, you get a = b. For example, what is 147 modulo 9? Well throw away 90, and that leaves 147 = 57 (modulo 9). Nine somethings are 54, so we can throw that away, leaving 147 = 3 (modulo 9).

In programming, the MOD function (however that's written in the particular language) reduces an arbitrary number to something in the range from 0 to the maximum. So 147 MOD 9 returns 3. As 0 = n (modulo n) for any n, the MOD function always returns 0 rather than n in that case.

The official terminology is a = b (modulo c), but often you know you are operating with a particular modulus, and simply write a = b, e.g. 1 = 13.

For all the good technical details see integers modulo n.

mode bit = M = molly-guard

modulo /mod'yu-loh/ prep.

Except for. An overgeneralization of mathematical terminology; one can consider saying that 4 equals 22 except for the 9s (4 = 22 mod 9). "Well, LISP seems to work okay now, modulo that GC bug." "I feel fine today modulo a slight headache."

--The Jargon File version 4.3.1, ed. ESR, autonoded by rescdsk.

Log in or register to write something here or to contact authors.