[R] erratic behavior of match()?
bates at stat.wisc.edu
Thu Apr 19 04:08:56 CEST 2007
On 4/18/07, Bernhard Klingenberg <Bernhard.Klingenberg at williams.edu> wrote:
> Consider the code:
> x <- seq(0,1,0.2)
> y <- seq(0,1,0.01)
> which, surprisingly, doesn't show a match at 0.6! (It gives correct
> matches at 0, 0.2, 0.4, 0.8 and 1, though)
> In addition,
> yields FALSE. (but x==y, the one for 0.8, yields TRUE)
> Is this a consequence of machine error or something else?
> Could this be overcome? (It works correctly when integers are used in
> the sequences as well as in many other circumstances)
See the R FAQ - question 7.31 It's a basic property of floating point
More information about the R-help