3 ms·
> PS. If you design software that works with money amounts, always use fixed point decimals. Don't use floats, it's just wrong! Fundamental reason being that p
by lr1970 4y ago
> PS. If you design software that works with money amounts, always use fixed point decimals. Don't use floats, it's just wrong!
Fundamental reason being that powers of 1/10 in decimal fractions are not always representable by powers of 1/2 in binary. Specifically 0.1 = 0b00011001100110011... is infinitely long binary string. Truncating it to any finite bit-width like 32 or 64 bits always introduces an error.