It’s easier just to use a proper decimal type than to remember all of the ways where using floats will bite you in the ass. The behavior is unintuitive even in trivial examples. Code like
amount_due = 0.10 + 0.20
amount_paid = 0.30
if amount_paid >= amount_due:
print("PAID")
else:
print("OUTSTANDING")
will print “OUTSTANDING”.True, but those who do not use decimal floating-point numbers do not use such binary floating-point numbers.
They use binary fixed-point numbers/integers, where such computations are exact, while not having the huge computational overhead of decimal floating-point numbers.
Decimals can bite you in the ass too. Try dividing by 3, or using transcendental functions.
Changing representations isn't a substitute for the numerical analysis you should be doing for financial calcs.