[Python-ideas] PEP 485: A Function for testing approximate equality

Antoine Pitrou solipsis at pitrou.net
Fri Jan 23 16:36:18 CET 2015

On Thu, 22 Jan 2015 16:40:14 -0800
Chris Barker <chris.barker at noaa.gov> wrote:
> Expected Uses
> =============
> The primary expected use case is various forms of testing -- "are the
> results computed near what I expect as a result?" This sort of test
> may or may not be part of a formal unit testing suite.

I don't think the proposal fits the bill. For testing you want a
function that is both 1) quite rigorous (i.e. checks equality within a
defined number of ulps) 2) handles all special cases in a useful way
(i.e. zeros, including distinguishing between positive and negative
zeros, infinities, NaNs etc.).

As someone who wrote such a function for Numba, what you're proposing
would not be a suitable replacement.



More information about the Python-ideas mailing list