I have a fairly simple expression that I want to evaluate which is ZoomLevel = ZoomLevel - 0.1 where ZoomLevel is declared as a double.
I have called the routine multiple times:
- 1.5 - 0.1 = 1.4
- 1.4 - 0.1 = 1.3
- 1.3 - 0.1 = 1.2
Then it is time to execute the same statement where ZoomLevel equals 1.2:
Then I step over the statement:
Why does this statement evaluate to 1.09 and not 1.1?
(I guess it have something to do with lack of precision in the double implementation.)
EDIT: This is what I get when printing the content of ZoomLevel before and after execution of that statement.
?string.Format("{0:N20}", ZoomLevel);
"1,20000000000000000000"
?string.Format("{0:N20}", ZoomLevel);
"1,09000000000000000000"