This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author veky
Recipients ChrisBarker, Pam.McANulty, berker.peksag, ezio.melotti, gregory.p.smith, iritkatriel, mark.dickinson, michael.foord, r.david.murray, rbcollins, rhettinger, veky
Date 2022-03-20.05:26:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1647754014.83.0.989157960228.issue27198@roundup.psfhosted.org>
In-reply-to
Content
An important point nobody made, as far as I can see:

* the main usability improvement justifying math.isclose is that you don't know the order of magnitude of your correct value--it could be anything (even infinite), and the manner of comparison depends on it. That's why it uses a sensible rel_tol out of the box, but no abs_tol--obviously, since it doesn't want to give nonsense results for e.g. values close to zero.

* but when you write tests, you always know the exact value you should get, right? In almost all cases the second argument is a numeric literal. So the delta-approach is perfectly ok in that context, since you're in control of how much discrepancy you're going to tolerate, and in the moment that you're deciding on this, you have the exact value expected right in front of you.
History
Date User Action Args
2022-03-20 05:26:54vekysetrecipients: + veky, rhettinger, gregory.p.smith, mark.dickinson, rbcollins, ezio.melotti, r.david.murray, michael.foord, berker.peksag, Pam.McANulty, ChrisBarker, iritkatriel
2022-03-20 05:26:54vekysetmessageid: <1647754014.83.0.989157960228.issue27198@roundup.psfhosted.org>
2022-03-20 05:26:54vekylinkissue27198 messages
2022-03-20 05:26:54vekycreate