### IMOD – Remainder after integer division

Block SymbolLicensing group: STANDARD

Function Description
The IMOD block divides two integer input signals, $\mathtt{\text{n}}=\mathtt{\text{i1}}%\mathtt{\text{i2}}$, where $%$ stands for remainder after integer division operator (modulo). If both numbers are positive and the divisor is greater than one, the result is either zero (for commensurable numbers) or a positive integer lower than the divisor. In the case that one of the numbers is negative, the result has the sign of the dividend, e.g. $15%10=5$, $15%\left(-10\right)=5$, but $\left(-15\right)%10=-5$. In case $\mathtt{\text{i2}}=0$, the output $\mathtt{\text{E}}$ is set to on and the output $\mathtt{\text{n}}$ is substituted by $\mathtt{\text{n}}=\mathtt{\text{nerr}}$.

Inputs

 i1 First integer input of the block  $↓$-9.22E+18 $↑$9.22E+18 Long (I32) i2 Second integer input of the block  $↓$-9.22E+18 $↑$9.22E+18 Long (I32)

Outputs

 n Remainder after integer division Long (I32) E Error flag – division by zero Bool

Parameters

 vtype Numeric type  $\odot$4 Long (I32) 2 .... Byte 3 .... Short 4 .... Long 5 .... Word 6 .... DWord 10 ... Large nerr Substitute value for an error case  $\odot$1 Long (I32)

2020 © REX Controls s.r.o., www.rexygen.com