Hello I´m using Microsoft VB 2012 and have a problem with sum of doubles.
This simple code reproduces it:
Dim result As Double = 0
Dim amount1 As Double = 81.83
Dim amount2 As Double = 50.0
result += amount1
result += amount2
result is equal to 131.82999999998 instead of 131.83
In fact:
Dim test1 As Double = 81.83 + 50.0 '(= 131.82999999998 wrong)
Dim test2 As Double = 81.83 + 50 '(= 131.82999999998 wrong)
Dim test3 As Double = 81.83 + 10 '(= 91.83 OK)
Dim test4 As Double = 81.82 + 50.0 '(= 131.82 OK)
Can anyone explain it?
Best Regards David