Maybe a simple problem with comparision

a <- 0.3
b <- 0.3
c <- 0.3
(a+b+c) < 0.9

when i execute this code i get this " [1] TRUE"
and i cant see how is this true...bec 0.3+0.3+0.3 = 0.9 and 0.9 is not < 0.9, so the right answer should be false....

1 Like

This has to do with floating point precision, read this FAQ for an explanation.

https://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f

1 Like

Thank you for help! :smiley:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.