In R 0.1 + 0.2 is equal to 0.3.
If R is giving you 0.5, you should find another language (I assume you meant 1.5?)
> (0.1 + 0.2) == 0.3
[1] FALSEWhy do you compare point to point? I have never once in my Statistics education compared point to point. You always need to see the probability of the result if it is within 2 points.
But if you want to compare use all.equal(0.1 + 0.2, 0.3)
> all.equal(0.1 + 0.2 + 0.000000003, 0.3)
[1] TRUE> print(.1+.2, digits=18) [1] 0.300000000000000044
Why do you compare point to point? I have never once in my Statistics education compared point to point. You always need to see the probability of the result if it is within 2 points.
But if you want to compare use all.equal(0.1 + 0.2, 0.3)
> 0.1+0.2 == 0.3
[1] FALSE
?Why do you compare point to point? I have never once in my Statistics education compared point to point. You always need to see the probability of the result if it is within 2 points.
But if you want to compare use all.equal(0.1 + 0.2, 0.3)