# Approximate equality

**URL:** <https://discourse.julialang.org/t/approximate-equality/8952>\
**Category:** General Usage\
**Tags:** question, bug\
**Created:** [February 9, 2018, 3:10pm UTC](https://discourse.julialang.org/t/approximate-equality/8952 "2018-02-09T15:10:51Z")\
**Posts on this page:** 1\
**Showing post:** 21

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [February 10, 2018, 2:45pm UTC](https://discourse.julialang.org/t/approximate-equality/8952/21 "2018-02-10T14:45:48Z")

</div>

> [@simonbyrne](#):
>
> `abs(x-y) ≤ atol + rtol*max(abs(x), abs(y), realmin(typeof(x)), realmin(typeof(y)))`

I don’t know what problem this would actually solve. People doing `x ≈ 0` in practice are invariably like the original poster: they are expecting a tolerance much much greater than `realmin`.

That is, they are expecting `≈` to either magically know an absolute tolerance that is appropriate to how they computed `x` (which is impossible) or they are expecting `≈` to use an absolute tolerance assuming all quantities are of order unity (which is wrong). They just need to learn to pass an absolute tolerance for comparison of numbers to zero, or to simply check `abs(x) ≤ atol`.

Using `realmin` here makes `isapprox` harder to understand (now you’re asking the reader to know what `realmin` and subnormal numbers mean) for no benefit.

---

_[View the full topic](https://discourse.julialang.org/t/approximate-equality/8952)._
