Recently I got to know the decimal python module. While I got to understand how to work with this, I still have a question that persists:
What is/are the main case(s) where coders should use decimal.Decimal for float comparison?
For example, at the past I have already performed some automatic tests for installable packages. At this ones, I always performed the comparison among floats with pytest.aprox() or by comparing the absolute difference with an epsilon value.
Maybe my experience is still not enough to see which cases the decimal module is better. Could anyone provide some insights to me?
Decimal, might be worth reading, especially the PEP's Motivation section. If you can't identify a case for usingDecimal, then you probably don't have a use case for it.