[Python-ideas] Way to check for floating point "closeness"?
mistersheik at gmail.com
Thu Jan 15 22:53:08 CET 2015
Note also that it does something reasonable with zero, which most of the
proposals here do not do.
On Thu, Jan 15, 2015 at 4:52 PM, Neil Girdhar <mistersheik at gmail.com> wrote:
> 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.
> On Wed, Jan 14, 2015 at 7:48 PM, Chris Barker <chris.barker at noaa.gov>
>> On Wed, Jan 14, 2015 at 4:23 PM, Neil Girdhar <mistersheik at gmail.com>
>>> You might be interested in my question:
>> nothing new there, I'm afaid -- and no one seemed to have brought up the
>> issue with zero.
>> Christopher Barker, Ph.D.
>> 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 at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas