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.