History of `isapprox` in languages

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). Not something we want to emulate.

See also previous discussions like Approximate equality

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

24 Likes