28 mod 20
What is 28 mod 20?
Modulo Operator as Used in our Calculator
This opearation (or function) rounds a value downwards to the nearest integer even if it is already negative. The floor function returns the remainder with the same sign as the divisor. This is the method used in our calculator. See how it works by examples:
- floor(2.1); // returns number 2
- floor(2.7); // returns number 2
- floor(-5.2); // returns number -6
- floor(-5.7); // returns number -6
- a mod 1 is always 0;
- a mod 0 is undefined;
- Divisor (b) must be positive.
This function is used in mathematics where the result of the modulo operation is the remainder of the Euclidean division.
The first result in our calcultor uses, as stated above, the function floor() to calculate modulo as reproduced below:
a mod b = a - b × floor(a/b)
To understand how this operation works, we recommend reading What is modular arithmetic? from Khan Academy.
In computers and calculators due to the various ways of storing and representing numbers the definition of the modulo operation depends on the programming language or the hardware it is running.
|Operation||a mod b||$a % $b|
|5 mod 3||2||2|
|3 mod 1||0||0|
|-5 mod 3||1||-2|
|-3 mod 5||2||-3|
|15 mod 12||3||-3|
|29 mod 12||5||5|
|-4 mod 12||8||-4|
|-13 mod 6||5||-1|
There are some other definitions in math and other implementations in computer science according to the programming language and the computer hardware. Please see Modulo operation from Wikipedia.