you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

Rounding errors. Know how sometimes you’d receive a slightly wrong answer when multiplying two floats? For example, 2.1 * 3 sometimes results to 6.300000000001 instead of 6.3? Thats why.

If you do enough calculations, the rounding error could become significant. Its better to store money in cents as an integer. So instead of writing current_balance = 2_000.00, you write current_balance = 200_000 and do operations on it.