I have an XTS filled with decimal values, and I've run into a strange problem.
Steps to recreate
Create the XTS
t <- xts(c(1.9,3.8,5.7,7.6,9.5,11.4,13.3,15.2,17.1,19,21,23), order.by=seq(as.Date("2018-01-01"), as.Date("2018-01-12"), "days"))
colnames(expected) <- "Values"
> t
           Values
2018-01-01    1.9
2018-01-02    3.8
2018-01-03    5.7
2018-01-04    7.6
2018-01-05    9.5
2018-01-06   11.4
2018-01-07   13.3
2018-01-08   15.2
2018-01-09   17.1
2018-01-10   19.0
2018-01-11   21.0
2018-01-12   23.0
Compare it to a value
> (1.9 * 3) == t
           Values
2018-01-01  FALSE
2018-01-02  FALSE
2018-01-03  FALSE
2018-01-04  FALSE
2018-01-05  FALSE
2018-01-06  FALSE
2018-01-07  FALSE
2018-01-08  FALSE
2018-01-09  FALSE
2018-01-10  FALSE
2018-01-11  FALSE
2018-01-12  FALSE
I'd expect t["2018-01-03"] to equal (1.9 * 3) which equals 5.7. But it does not.
There shouldn't be any rounding error here since 1.9 * 3 is exactly 5.7. So I am not sure what is going on here.
Is this a quirk of XTS with decimal values? I can compare integer values just fine using this method. How do I compare these properly?