函数参考
Mod
求模运算.
参数
返回值
成功: |
返回 数值1 除以 数值2 后的余数. |
失败: |
返回 -1,说明除数为零. |
注意/说明
This function guarantes that dividend = Int(dividend / divisor) * divisor + Mod(dividend, divisor).
This function does not guarantee that dividend or divisor can be represented accurately, specifically with floating point numbers.
If integers are passed this function does an integral modulo operation. Otherwise it falls back to a floating point operation which per the previous remark means it may not produce the expected output.
相关
Int
示例/演示
Local $n = 18
If Mod($n, 2) = 0 Then
MsgBox(0, "", $n & " is an even number.")
Else
MsgBox(0, "", $n & " is an odd number.")
EndIf
Local $x = Mod(4, 7) ;$x == 4 because the divisor > dividend
Local $y = Mod(1, 3 / 4) ;$y == 0.25 because the divisor is a float