Why are these numbers not equal?

The following code is obviously wrong. What’s the problem?

i <- 0.1
i <- i + 0.05
i
## [1] 0.15
if(i==0.15) cat("i equals 0.15") else cat("i does not equal 0.15")
## i does not equal 0.15

6 Answers
6

Leave a Comment