There is also Decimal floating-point arithmetic which has a larger range and better memory safety. Java, C#, Python, Ruby, etc. have built in support for it via Decimal.
Banks and big companies have to worry about round-off and fractions of a penny, so Decimal is a better solution for them. But the great unwashed like you and me will never have to worry about that, so either works.
Fixed-point arithmetics
There is also Decimal floating-point arithmetic which has a larger range and better memory safety. Java, C#, Python, Ruby, etc. have built in support for it via Decimal.
Banks and big companies have to worry about round-off and fractions of a penny, so Decimal is a better solution for them. But the great unwashed like you and me will never have to worry about that, so either works.
Also known as “if you ain’t storing cents, you ain’t making sense.”