In subtracting one double from another, namely 45.32 - 45.31, I get a result of 0.00999999999999801. According to all the math I've ever learned, the answer should be .01. Now the answer is:
double x = 45.32;
double y = 45.31;
double answer = (x - y);
answer = Math.round(answer*100)/100.0d;
No comments:
Post a Comment