[Python-ideas] float comparison in doctest

Vito De Tullio vito.detullio at gmail.com
Tue Aug 12 08:15:26 CEST 2014


Terry Reedy wrote:

> I think there have been vague proposals for a float method, but
> "a - b < delta" is shorter than "a.almost_equat(b, abs=delta)" and
> probably easier to understand.

what if a < b? or if a or b (or both) are NaN/+Inf/-Inf? Or...

There are many pitfalls comparing floats, isn't better to delegate these 
checks in a function?

-- 
By ZeD



More information about the Python-ideas mailing list