[Python-ideas] PEP 485: A Function for testing approximate equality
Antoine Pitrou
solipsis at pitrou.net
Fri Jan 23 21:42:42 CET 2015
On Fri, 23 Jan 2015 09:12:26 -0800
Ethan Furman <ethan at stoneleaf.us> wrote:
> On 01/23/2015 07:36 AM, Antoine Pitrou wrote:
> > On Thu, 22 Jan 2015 16:40:14 -0800 Chris Barker 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.).
>
> I disagree -- this function is not meant for mathematicians, but for the non-maths person who needs something that
> works.
In which use case would a "non-maths person" (what exactly does that
mean?) need "something that works"? I haven't seen any serious analysis
of use cases. Guido talks about the Newton algorithm but I can't
understand why a "non-maths person" would want to write one
implementation of that - apart from recreation or educational purposes,
that is.
Regards
Antoine.
More information about the Python-ideas
mailing list