I realize I'm posting this on April Fool's Day and it's a bit absurd, but this isn't a joke. I've tested this on Microsoft R Open 3.3.2 for Mac, 3.3.1 for Windows, and vanilla R 3.3.2 on CentOS 6 all with the same results.
Back story: while debugging today, I ran into a situation where a logical equals test failed when I didn't think it should have. The simplest version of the test is below, where 3.8 + 0.6
doesn't seem to equal 4.4
, but other combinations do.
I ran these commands in a clean environment:
> (3.8 + 0.6)
[1] 4.4
> (3.8 + 0.6) == 4.4
[1] FALSE
> (3.6 + 0.8) == 4.4
[1] TRUE
> (3.6 + 0.6 + 0.2) == 4.4
[1] TRUE
> (3.7 + 0.6) == 4.3
[1] TRUE
> (3.9 + 0.6) == 4.5
[1] TRUE
> (3.8 + 0.6) == 4.4
[1] FALSE
> (2.2 + 2.2) == 4.4
[1] TRUE
> (2.3 + 2.1) == 4.4
[1] TRUE
What in the world is going on with the FALSE
results?