Modulus

From Jonathan Gardner's Tech Wiki
(Redirected from Mod)
Jump to: navigation, search

The mod is simply the remainder after integer division.

Mod is represented with % in C/C++, Java, perl, and Python. Mod is MOD and REM in Lisp.

Negative numbers cause mod to behave differently in different languages. In C/C++ and Java, % behaves like REM in Lisp. In Python and perl, % is MOD in Lisp. Consult the languages for the details.

See Also