Fabio <(E-Mail Removed)> wrote:
> 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?
See
http://pobox.com/~skeet/csharp/floatingpoint.html
> What should I do to correct this.
Well, you're not going to get infinite precision with any of the built-
in types, but for arithmetic like the above, the decimal type would
help you.
--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet Blog:
http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too