Possible Duplicate:
Why are these numbers not equal?
I was trying to round a number. The following are fine:
floor(3)
[1] 3
however:
floor (0.6 / 0.2)
[1] 2
or
x <- 0.6 / 0.2
floor (x)
[1] 2
Why not 3 ?
Edit:
I am not concern with mechanics rather I want it be consistently rounded to 3, so that my function work properly.
Edit2:
I was not thinking something complex (as in the following discussion and not trying to prove as if to prove R is not doing its work), with help of suggestion below particularly from Matthew Lundberg, I could figure out a way through, may be some like me find useful. So this is what I did -
x1 <- 0.6 *100
x2 <- 0.2 *100
floor (x1/x2)
[1] 3