|
|
|
|
|
by sluukkonen
65 days ago
|
|
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”. |
|
Changing representations isn't a substitute for the numerical analysis you should be doing for financial calcs.