[Python-ideas] Fwd: Re: PEP 485: A Function for testing approximate equality
Kyle Lahnakoski
klahnakoski at mozilla.com
Tue Feb 17 16:18:16 CET 2015
Mark,
May you elaborate on your use case? I have not stumbled upon the need
for such a high tolerance. I had imagined that the isclose()
algorithm's use cases were to compare floating point numbers; which I
thought to mean equal up to some number of significant digits (3 or
more). Given such small epsilon, logarithmic granularity is good
enough. I believe the majority of use cases for isclose() will involve
such small tolerances.
For larger tolerances, like you suggest, it is probably best be phrased
as `0.5 <= x < 1.5`, or `abs(x-1) <=0.5`. Furthermore, the version of
`isclose()` I advocate need not have integer parameters `isclose(x, 1,
abs_tol = -log10(0.5))` is a legitimate, albeit ugly.
Thank you for you time discussing this.
On 2015-02-17 8:37 AM, Mark Young wrote:
> That's trading a teeny tiny bit of convenience for one particular use
> case for the flexibility to choose any number as the tolerance. If
> that change were made, I would have no means of specifying any sort of
> tolerance other than powers of 10. I can easily see myself saying
> "This number needs to be 1 +- .5"
More information about the Python-ideas
mailing list