Re: [R] problem with comparisons for vectors

2010-07-11 Thread Joshua Wiley
This is also mentioned in FAQ 7.31 http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f Also if you search the R-help archives for 'precision' you can find a lot of threads discussing the issue in further depth. On Sun, Jul 11, 2010 at 9:02 PM, Wu Gon

Re: [R] problem with comparisons for vectors

2010-07-11 Thread Wu Gong
I don't know the real reason, but help("==") gives some clues. For numerical and complex values, remember == and != do not allow for the finite representation of fractions, nor for rounding error. Using all.equal with identical is almost always preferable. See the examples. x1 <- 0.5 - 0.3 x2