![]() When exactly one of a or n is negative, the naive definition breaks down, and programming languages differ in how these values are defined. See Modular arithmetic for an older and related convention applied in number theory. The range of values for an integer modulo operation of n is 0 to n − 1 inclusive ( a mod 1 is always 0 a mod 0 is undefined, possibly resulting in a division by zero error in some programming languages). įor example, the expression "5 mod 2" would evaluate to 1, because 5 divided by 2 has a quotient of 2 and a remainder of 1, while "9 mod 3" would evaluate to 0, because the division of 9 by 3 has a quotient of 3 and a remainder of 0 there is nothing to subtract from 9 after multiplying 3 times 3.Īlthough typically performed with a and n both being integers, many computing systems now allow other types of numeric operands. The modulo operation is to be distinguished from the symbol mod, which refers to the modulus (or divisor) one is operating from. Given two positive numbers a and n, a modulo n (abbreviated as a mod n) is the remainder of the Euclidean division of a by n, where a is the dividend and n is the divisor. ![]() ![]() ![]() In computing, the modulo operation returns the remainder or signed remainder of a division, after one number is divided by another (called the modulus of the operation).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |