View Single Post
  #3   Report Post  
JE McGimpsey
 
Posts: n/a
Default

It is close, but it's not quite zero, which means that, as in all other
floating point math, one can't blindly write things like:

=IF(MOD(A1,B1)=0,"Good","Bad")

Instead, it's good practice to use something like:

=IF(MOD(A1,B1)<1E-10,"Good","Bad")

where the comparison value is some number "close enough" to zero.

And if B1 can be negative:

=IF(ABS(MOD(A1,B1))<1E-10,"Good","Bad")

is appropriate.

Unfortunately, there are lots of applications out there where the
developer was naive about floating point math, and you can get some
incorrect results from very simple errors.


In article ,
"Bill Martin -- (Remove NOSPAM from address)"
wrote:

Perhaps I'm missing something, but 8.88178419700125E-16 looks extremely close
to
0.000000000000000 to me.

If that's the biggest error one can find in Excel, I'd be content.