Skip to content

Modr

MODR

Type Function REAL
Input IN REAL (Dividend)
DIVI REAL (divisor)
Output REAL (remainder of division)
The function MODR returns the remainder of a division similar to the standard MOD function, but for REAL numbers. MODR internally uses the data format of type DINT. This may come to an overflow because DINT can store a maximum of +/-2.14 * 10^9 The range of MODR is therefore limited to +/- 2.14 * 10^9. For DIVI = 0 the function returns 0.
MODR(A, M) = A - M * FLOOR2(A / M).

modr

Example:

MODR(5.5, 2.5) result 0.5.