I need some help here. I am trying to convert some numbers and running in to some weird things.
I declare a double to the value 264210.35. I then multiply it with 100, and in my opinion i get the wrong result.
double value = 264210.35;
double sum = value.Value*100;
//sum = 26421034.999999996
var longSum = (long) sum;
//longSum = 25421034
When i then multiply it with 100 i excpect to get the sum of 26421035, but i don't. I get 26421034.999999996. When i use a normal calculator and multiplies the value with 100 i get 25421035. How come i don't in this case?
And when i then cast it to a long, it ends up being 26421034. Which then makes it one didgit wrong.