Question: > 
> **Possible Duplicate:**  
> 
> [Numeric comparison difficulty in R](https://stackoverflow.com/questions/2769510/numeric-comparison-difficulty-in-r) 
> 
> 
> 

Hello All,

According to ["R Inferno"](http://www.burns-stat.com/pages/Tutor/R_inferno.pdf) paper. I'm right now in the first circle of R hell. This is where pagans expect 0.1 == 0.3/3. Paper recommends using `all.equal` function for such cases, however I need to check ">=" or "<=" conditions. With current example on of them fail:

```
> .1 >= .3/3
[1] TRUE
> .1 <= .3/3
[1] FALSE

```

Is there a similar function to all.equal that checks inequalities?

Thank you,

Ilya

Answer: 
See these questions:

* [In R, what is the difference between these two?](https://stackoverflow.com/questions/2227734/in-r-what-is-the-difference-between-these-two)
* [Numeric comparison difficulty in R](https://stackoverflow.com/questions/2769510/numeric-comparison-difficulty-in-r)

Generally speaking, you can deal with this by including a tolerance level as per the second link above.
The main test of `all.equal` is whether `abs(x-y) < tolerance` for some values `x` and `y` and some small `tolerance`. Equivalent inequality tests would check:

```
x <= y:         x-y < tolerance
x < y:          x-y < -tolerance
x >= y:         x-y > -tolerance
x > y:          x-y > tolerance

```