VB.NET - My PC can't count! - Asked By Paul Molloy on 02-Aug-06 09:35 AM

Simple problem. Can't find a cure.

It seems that if I ask .net to work out 28.29 - 25.96 I get the answer 2.3299999999999983
Even if I type it directly into the immediate window I get the same result.


It's simple maths! Why can't it get the right answer?
Asked By Sushila Patel on 02-Aug-06 09:59 AM
Try below code and see

Dim d1 As Decimal = 28.29
Dim d2 As Decimal = 25.96
Dim d3 As Decimal = d1 - d2

O/P should be 2.33