[Python-ideas] Way to check for floating point "closeness"?
chris.barker at noaa.gov
Mon Jan 12 18:02:17 CET 2015
Now that we're talking about floating point conveniences (math.nan,
What about putting an
(or close(), or...) in the math module.
AFAICT, in the standard library, there is only:
A) is buried in the unittest.TestCase class
B) is an assertion, so you can't use it as a general test (easily)
C) uses number of decimal digits or an absolute delta, but does not provide
a significant figures comparison, which is most likely what's wanted (and a
bit harder to write yourself)
numpy provides allclose() (and isclose() ), which is pretty much what I'm
Anyone else think this would be a good idea to add to the stdlib?
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