So this is something I was not expecting, this is very simple but not giving the results I expect.
I would expect doing a simple equation of 5.1 - 4.9 to return 0.2, but this does not appear to be the case. I can use the round function to work around it, but I just find it confusing that 5.1 - 4.9 = 0.19999999999999.
Could anyone advise why this happens, and the best way to work around it.
' returns 1.1
myvalue = 5.1 - 4
msgbox myvalue
' returns 0.6
myvalue = 5.1 - 4.5
msgbox myvalue
' returns 0.3
myvalue = 5.1 - 4.8
msgbox myvalue
' returns 0.19999999999999
myvalue = 5.1 - 4.9
msgbox myvalue
' returns 9.999999999999996E-02
myvalue = 5.1 - 5
msgbox myvalue
' returns 0.2
myvalue = Round(5.1 - 4.9,2)
msgbox myvalue