The point is that this function is already in Python and if you want to do
something different, you should have a really good reason to do it
differently. If you were to add a function to math, say math.close, it
should work like numpy.allclose in my opinion.
For reference, numpy does this:
absolute(*a* - *b*) <= (*atol* + *rtol* * absolute(*b*))
where atol is an absolute tolerance and rtol is a relative tolerance
(relative to the actual value b). This subsumes most of the proposals here.
Best,
Neil
On Wed, Jan 14, 2015 at 7:48 PM, Chris Barker
On Wed, Jan 14, 2015 at 4:23 PM, Neil Girdhar
wrote: You might be interested in my question:
http://stackoverflow.com/questions/4028889/floating-point-equality-in-python
nothing new there, I'm afaid -- and no one seemed to have brought up the issue with zero.
-Chris
--
Christopher Barker, Ph.D. Oceanographer
Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov