Re: Why can't I get simple multipliation answer

Tech-Archive recommends: Fix windows errors by optimizing your registry



Amil <amilhanish@xxxxxxxxxxx> wrote:
I want to multiple two decimal numbers and get the normal result...instead,
I get a very large decimal result. Any idea how I can correct this problem?

double d1 = 5.21;
double d2 = 8.8;
double d = d1 * d2;
// d is now 45.848000000000006 in debugger or WriteLine

See http://www.pobox.com/~skeet/csharp/floatingpoint.html

--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
.