Ayuda de LibreOffice 24.2
L'operador MOD recibe dos espresiones numbériques y devuelve'l residuu de la división.
For example, the result of 21 MOD 6 is 3 because after dividing 21 by 6, the remainder of the division is 3.
If the MOD operation involves non-integer values, both operands are rounded to the nearest integer values. Hence, the value returned by a MOD operation will always be an integer number.
For example, the expression 16.4 MOD 5.9 is evaluated as follows:
The value 16.4 is rounded to 16.
The value 5.9 is rounded to 6.
La operación 16 MOD 6 devuelve 4, el residuu de la división de 16 por 6.
Be aware that BASIC's MOD operator and Calc's MOD Function behave differently. In Calc, both operands can be decimal values and they are not rounded before division, thus the resulting remainder may be a decimal value.
Resultáu = Espresión1 MOD Espresión2
Enteru
Result: Any numeric variable that contains the result of the MOD operation.
Expression1, Expression2: Any numeric expressions for which you want to calculate the remainder after the division of Expression1 by Expression2.
Sub ExampleMod
Dim a As Double, b as Double
a = 10 : b = 4
Print a Mod b 'Returns 2
a = 18 : b = 3.2
Print a Mod b 'Returns 0
a = 16.4 : b = 5.9
Print a Mod b 'Returns 4
End Sub