Documentation/Calc Functions/MOD/en

Function name:
MOD

Category:
Mathematical

Summary:
Calculates the remainder when one number (the dividend or numerator) is divided by another number (the divisor or denominator). This is known as the modulo operation.

Often the dividend and divisor will be integer values (Euclidean division). However, MOD accepts and processes real numbers with non-zero fractional parts.

Syntax:
MOD(Dividend; Divisor)

Returns:
Returns a real number that is the remainder when one number is divided by another number. The value returned has the same sign as the divisor.

Arguments:
Dividend is a real number, or a reference to a cell containing that number, that is the dividend of the divide operation.

Divisor is a real number, or a reference to a cell containing that number, that is the divisor of the divide operation.


 * If either Dividend or Divisor is non-numeric, then MOD reports a #VALUE! error.
 * If Divisor is equal to 0, then MOD reports a #DIV/0! error.

Additional details:
$$\text{MOD}(x,y)~=~x-\left(y\times \text{INT} \left(\frac{x}{y}\right)\right)$$
 * For real x and y (y <>0), MOD implements the following formula:
 * The INT function always rounds down (toward -∞) and returns the largest integer less than or equal to a given number. This means that when the dividend and divisor have different signs, MOD may produce results that appear counterintuitive. For example, the formula  returns -2; this is because the fraction $$\left(\frac{7}{-3}\right)$$ is rounded to -3 by the INT function.


 * For more general information about the modulo operation, visit Wikipedia’s Modulo operation page.

Related LibreOffice functions:
QUOTIENT

ODF standard:
Section 6.16.42, part 2

Equivalent Excel functions:
MOD