Skip to Content
Menu
This question has been flagged
1867 Views

It's really annoying. Who decided to use the float type for numbers?

I'm importing over 5k of bank statement transactions with the end real balance calculation on the fly. Numbers are not precise! And what will be the error at the end? Only Allah knows.

The example is below.

USD, ID_17173/USD, [{'date': '2014-10-15', 'balance_start': 0, 'balance_end_real': 0.010000000000000009, 'transactions': [{'date': '2014-10-15', 'amount': -1.29}, {'date': '2014-10-15', 'amount': 1.3}]},{'date': '2014-10-16', 'balance_start': 0.010000000000000009, 'balance_end_real': 49.33, 'transactions': [{'date': '2014-10-16', 'amount': -2.57}, {'date': '2014-10-16', 'amount': 51.89}]},{'date': '2014-10-17', 'balance_start': 49.33, 'balance_end_real': 58.65, 'transactions': [{'date': '2014-10-17', 'amount': -1.29}, {'date': '2014-10-17', 'amount': 10.61}]},{'date': '2014-10-19', 'balance_start': 58.65, 'balance_end_real': 157.80999999999997, 'transactions': [{'date': '2014-10-19', 'amount': -4.33}, {'date': '2014-10-19', 'amount': 103.49}]},{'date': '2014-10-20', 'balance_start': 157.80999999999997, 'balance_end_real': 276.18999999999994, 'transactions': [{'date': '2014-10-20', 'amount': -5.75}, {'date': '2014-10-20', 'amount': 124.13}]}]


Avatar
Discard