I have this code in C#
double result = 480 - 460.8;
Why result is 19.199999999999989 instead of 19.2?
I have this code in C#
double result = 480 - 460.8;
Why result is 19.199999999999989 instead of 19.2?
you should format your double precision of the result
output:
double result = 480 - 460.8;
String.Format("{0:0.##}", result);
test example:
update:
there is another way without string formatting you can use method Math.Round
with two digits after decimal place :
Math.Round(result,2);
example: