I used following code
Log($"======================== Run 1 ${DateTime.Now} ==========================="$)
Dim intLine As Int
Dim lineMod As Double
For i = 0 To 80
intLine = i/20
lineMod = i /20
If lineMod = intLine Then
Log($"${lineMod}=${intLine}"$)
End If
Next
For i = 0 To 80
intLine = i/20
lineMod = i /20
If intLine = lineMod Then
Log($"${intLine}=${lineMod}"$)
End If
Next
It looks like this issue only happens in Debug mode. When you run this code for the first time, and for subsequent times IF you leave the code unchanged, it will produce the correct output.
If you then change the max i to another number, everything gets screwed up (changed max i to 20)
If you do a "Clean Project", everything seems to work as expected:
If you run the examples in Release mode, the results are always as you expect them.
Please note, the produced code for the comparison is
if (_intline==_linemod) {
According to Java rules, the int value is promoted to a double in a comparison (
https://docs.oracle.com/javase/specs/jls/se7/html/jls-5.html#jls-5.6.2). Currently, your comparisons work, even though they are double's, since we are dealing with small numbers. If you had to compare a relatively large integer to the division of two doubles, things may still go wrong (the integer converted to a double is not the same as the division of two doubles, due to how doubles work).
So in the end, this has nothing to do with object comparison or on which side of the comparison the int/double is. It's just something weird in the debugger/with debugging.