1

Possible Duplicate:
Numeric comparison difficulty in R

I'm using R 2.15.2 and found something like an unusual but serious error in R inequality operator.

> 0.015 -0.005 
[1] 0.01
> 0.015 - 0.005 == 0.01
[1] FALSE
> 0.025 - 0.005 == 0.02
[1] TRUE

Is this possible?

it only happens when I compare 0.015 - 0.005 with 0.01.

Any ideas?

Try this with your computer and see this really happens!

Thanks, then what should I do wit inequality?

> 0.015 - 0.005 < 0.01 
[1] TRUE 
> 0.025 - 0.005 < 0.02 
[1] FALSE 
> 
Community
  • 1
  • 1

0 Answers0