# History of \`isapprox\` in languages

**URL:** <https://discourse.julialang.org/t/history-of-isapprox-in-languages/119347>\
**Category:** Numerics\
**Tags:** question, numerics, approx\
**Created:** [September 12, 2024, 6:51pm UTC](https://discourse.julialang.org/t/history-of-isapprox-in-languages/119347 "2024-09-12T18:51:09Z")\
**Posts on this page:** 1\
**Showing post:** 14

<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:** [September 12, 2024, 8:36pm UTC](https://discourse.julialang.org/t/history-of-isapprox-in-languages/119347/14 "2024-09-12T20:36:58Z")

</div>

> [@juliohm](#):
>
> From the examples with [Unitful.jl](https://juliahub.com/ui/Packages/General/Unitful) it seems that we could workaround a default `atol` that is unitless and fixed, which is derived from the units of the quantity?

No, this still doesn’t make sense. It’s perfectly valid to do atomic physics with distances in meters, but then 10^{-9} is a large number for a distance!

The absolute scale depends on your _problem_, not just on the units you chose. There is no reasonable way to pick it without having more information.

I think many people’s mental model for floating-point arithmetic and comparisons is just wrong. They think 10^{-16} is a small number in an absolute sense, as if it were fixed-point arithmetic. And I think numpy’s `isclose` function made the wrong choice in setting a default absolute tolerance, and a further wrong choice in comparing vectors elementwise (rather than [using the length of the vector to set an overall scale](https://discourse.julialang.org/t/how-to-add-a-tolerance-to-isapprox/118711/7)). Not something we want to emulate.

See also previous discussions like [Approximate equality](https://discourse.julialang.org/t/approximate-equality/8952)

> [@juliohm](#):
>
> a “default” atol near 0 is fixed, and users can adjust their own “atol” when necessary as in:

The whole point is that there is no reasonable default `atol` other than zero.

---

_[View the full topic](https://discourse.julialang.org/t/history-of-isapprox-in-languages/119347)._
