11-29-2022, 06:34 AM
Maybe this SUPER simple formula will show how it works:
And this even showcases how QB64 gets the answer that it goes for us, with ModX3.
INT(x / y) is NOT the same as x \ y.
Code: (Select All)
For i = -10 To 10
Print Steve_ModX(i, 5), Steve_ModX2(i, 5), Steve_ModX3(i, 5)
Next
Function Steve_ModX (num1, num2)
Steve_ModX = ((num1 Mod num2) + Abs(num2)) Mod num2
End Function
Function Steve_ModX2 (num1, num2)
Steve_ModX2 = num1 - (Int(num1 / num2) * num2)
End Function
Function Steve_ModX3 (num1, num2)
Steve_ModX3 = num1 - (num1 \ num2) * num2
End Function
And this even showcases how QB64 gets the answer that it goes for us, with ModX3.
INT(x / y) is NOT the same as x \ y.