On Sun, Jun 14, 2020, 10:22 AM Greg Ewing <greg.ew...@canterbury.ac.nz> wrote:
> On 15/06/20 12:39 am, Sebastian M. Ernst wrote: > > It's such a common problem when dealing with floating point numbers > > Is it really? I've done quite a lot of work with floating > point numbers, and I've very rarely needed to compare two > of them for almost-equality. When I do, I always want to > be in control of the tolerance rather than have a default > tolerance provided for me. > I've had occasion to use math.isclose(), np.isclose(), and np.allclose() quite often. And most of the time, the default tolerances are good enough for my purpose. Note that NumPy and math use different algorithms to define closeness, moreover. But it's more often than rare that I want to choose a different tolerance (or switch between absolute and relative tolerance). Adding an operator adds an impediment to refactoring to change tolerance. I'm more concerned about that problem than I am with the few extra characters needed to call a function. >
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/PVKZZC2GFQDWPUHI2QU7LKP2SBLA7C2G/ Code of Conduct: http://python.org/psf/codeofconduct/