VB.Net Double comparison after some additions
问题 I've faced a weird case with a double variable after adding some values to it. The problem occurs when adding (0.2) to a double variable more than one time -I think it only happens with (0.2)- for example: consider this code: Dim i As Double = 2 i = i + 0.2 MsgBox(i) '2.2 MsgBox(i > 2.2) 'False >> No problem But if I add (0.2) more than one time: Dim i As Double = 2 i = i + 0.2 i = i + 0.2 MsgBox(i) '2.4 Msgbox(i > 2.4) 'True >> !!!! Also Dim i As Double = 2 For x As Integer = 1 to 5 i = i +