R: Mysterious behaviour of seq and == operator. A precision issue?
===

I've come across a somehow weird (or just not expected?) behaviour of the function `seq`.
When creating a simple sequence some values cannot be matched correctly with the == operator.
See this minimal example:

    my.seq <- seq(0, 0.4, len = 5)
    table(my.seq)                  # ok! returns  0 0.1 0.2 0.3 0.4 
                                   #              1   1   1   1   1 

    which(my.seq == 0.2)           # ok! returns  3
    which(my.seq == 0.3)           # !!! returns  integer(0)

When creating my sequence manually, it seems to work, though:

    my.seq2 <- c(0.00, 0.10, 0.20, 0.30, 0.40)

    which(my.seq2 == 0.3)           # ok! returns  4

Do you have any explanation for that? I solved the issue by using `which(round(my.seq, 2) == 0.3)` but I would be interested in what's causing the problem.

Thanks in advance for your comments.