Floating point types (Float, Double) cannot hold exactly certain decimal
numbers. You could use the Decimal type if you need exact decimal
arithmetic, or use a subroutine package (e.g. GMP Bignum Library) if your
needed precision is greater than what Decimal can provide.
Or, you could do your arithmetic in floating point, convert the answer to
Decimal, and then round that to the precision you need.
"Fabio" <Fa***@discussions.microsoft.comwrote in message
news:2E**********************************@microsof t.com...
Hi
Looking at the following code ...
double a = 100.1;
double b = 0.1;
double c = a + b;
I would like to know why the value of c is 100.19999999999999 and not
100.2?
What should I do to correct this.
Thanks.