Possible Duplicates:
Precision of Floating Point
Floating point arithmetic is too reliable.
Hi Guys,
I came across a rather strange looking problem, i am running a loop from 82.01 to 169.06 in steps of 0.01 but when i reach 128.01 and do (128.01+0.01) it gives 128.019999999998 instead of 128.02. I am using double for all these computations. If i use decimal to do these computations it works out fine, am i missing a very basic funda here, i found some articles and discussions on the web explaining that decimal is the correct data type to do these computations but still a basic computation like (128.01+0.01) should give correct results.