frightening math error

D

drjeffdeyo

can someone please explain why in Excel 2003 and 2007 (only versions I have)
the expression
(0.75-0.7)<0.05
evaluates to FALSE (as it should)
but the expression
(0.85-0.8)<0.05
evaluates to TRUE ???

I have tested a series of varibles and this math error happened with 4
different numbers out of a list of 33. It is not internal rounding, there is
no pattern relating the numbers, it is 100% reproducible in different files,
different machines, different versions of excel.

I hope someone can explain this.
 
K

Ken Wright

That's because (0.85-0.8)<0.05 is TRUE if you try to put that expression on
your PC as is.

Put =0.85-0.8 into a cell and then expand the cell to 16 decimal places

Do you now see 0.0499999999999999 :)


See here for an explanation, and look at the section "Floating Point
Numbers"
http://cpearson.com/excel/rounding.htm

Regards
Ken.......................
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top