Skip to content
Prev 106720 / 398506 Next

strange logical results

This is FAQ 7.31 in the R FAQ.

Basically computers in general have problems exactly representing all
but a few floating point numbers, so while 2 numbers may look the same
when displayed (rounded to a couple of digits), they are different if
you look at them in full precision due to different roundings.
Functions like all.equal deal with this by checking to see if numbers
are close enough rather than equal.

The general rule is to not expect exact equality between floating point
numbers.  This is a problem for computers in general, not just R.

Hope this helps,