Decimals in Python: The 0.1 Problem
Also, how Decimals work with PostgreSQL
When you deal with any kind of assets, be that USD or BTC, you must be sure that not a single penny is lost.
What happens if the customer of your bank has 0.1 USD on his account? We need to somehow store a floating point number. And for computers, it is all zeroes and ones.
0.1 is one-tenth, or 1/10. To show it in binary — that is, as a bicimal — divide binary 1 by binary 1010, using binary long division: