Floating-Point Rounding May Cause Incorrect IF EvaluationID: Q77974
|
The method used by Excel to store floating-point numbers sometimes
produces very small rounding errors, particularly when fractional
values are involved. One possible effect of this is that IF statements
that compare two values for equality will return a result that is the
opposite from what is expected.
While it still works within the confines of calculating in floating
point, the method used by Excel 3.0 and 4.0 are slightly different
from that used in earlier versions. As a result, some formulas will
evaluate correctly in Excel version 3.0 but not in Excel versions 2.x.
For example, the following function entered in ANY version of Excel
=IF(.5-.4-.1=0,"I did not eat Bill's nose","I ate Bill's nose")
=IF(1.1+2.2=3.3,TRUE,FALSE)
floating and point and rounding and excel
"Microsoft Excel Function Reference," version 3.0, pages 200-201, 126-127
Additional query words:
Keywords :
Version :
Platform :
Issue type :
Last Reviewed: March 22, 1999