News for hackers. Stuff that matters.
Re:Why does 0.1 and 0.2 = 0.30000000000000004? by adamwk on Wednesday February 08, 2023 @04:07PM (#34715185)
Smallest unit also has issues. For instance the Indonesian rupiah technically is made up of 100 sen, but the currency is so inflated nobody uses it and currency libraries behave differently (even different versions of the same library). We had a bug where different OS versions provided different values when normalizing it to a smallest unit integer.

If you really don’t have access to a decimal type I think the best solution is to convert it to micro-units (price * 10^6). This is what Android does in its billing library.

Re:Why does 0.1 and 0.2 = 0.30000000000000004? by worik on Wednesday February 08, 2023 @06:42PM (#34717422)
Use sen. It can be transferred by bank transfer.

What people use as cash is a distraction, generally