[Python-ideas] Floating point "closeness" Proposal Outline

Terry Reedy tjreedy at udel.edu
Tue Jan 20 07:50:58 CET 2015


On 1/19/2015 2:54 PM, Chris Barker wrote:

>     But I think that it should have a name that (at least to some extent)
>     indicates what it actually does (unlike is_close(), which users are
>     likely to assume means what they think it means because they haven't
>     thought about the alternatives).
>
>
> Indeed -- I think that the name of the function, and it's parameters
> need to be carefully chosen to  best convey what they mean. (and the
> docstring).

If the function only handles 'relatively close', I would be happier with 
'relative_close' or 'rel_close' than 'is close' since the latter tends 
to imply to me absolute closeness.

The proposed doc (and docstring) should mention absolute tolerance and 
'abs(a-b) < tol' as an alternative, expecially near or at 0.

-- 
Terry Jan Reedy



More information about the Python-ideas mailing list