> Many people know that you shouldn’t do decimal calculations, such as those involving U.S. dollars and cents, with the floating-point numbers in most programming languages. This is because decimal numbers can’t be expressed exactly as such floating-point numbers, so you will encounter rounding errors.
Why not, rounding to the nearest cent is going to be much less precise for any realistic amount of dollars when using 64 bit floats (the type of float Javascript uses in every browser).
Regular people understand the decimal system and they understand rounding in that system. The floating point system is a different system that they don't understand. People need to trust that the mechanics of payments are correct or they feel like they're being ripped off, and you can't really trust what you don't understand. Rounding of decimal pennies means that people get payments systems they can trust at the cost of precision. Nobody cares about sometimes being up or sometimes being down a fraction of a penny.
amelius · · focus · HN ↗
Why not, rounding to the nearest cent is going to be much less precise for any realistic amount of dollars when using 64 bit floats (the type of float Javascript uses in every browser).
clickety_clack · · focus · HN ↗