Mod Operator
Mod calculates a Division with Remainder
Function
In RedCrab Calculator Mod is used as an operator. Mod returns the remainder of dividing two integers.
Syntax
a mod b
Example
17 : 5 = 3 remainder 2
17 mod 5 = 2
Dividing numbers with different signs also gives different signs for the results. The following examples show the results of the mod function for operands with different signs.
7 mod 3 = 1
-7 mod 3 = -1
7 mod -3 = 1
-7 mod -3 = -1
The function Mod calculates only with integers. If decimal numbers are used as an argument, the decimal part is ignored.
11 mod 3 = 2
11.2 mod 3.9 = 2