Re:Why does 0.1 and 0.2 = 0.30000000000000004?
by piaste on Thursday February 09, 2023 @04:23AM
(#34721541)
Having different numeric types for currency amounts (integer) and for costs or prices (floating point, whether decimal or binary) is not undesirable. Heck, it's very likely a bonus.
[ Parent
| on HN ]
Re:Why does 0.1 and 0.2 = 0.30000000000000004?
by mcv on Thursday February 09, 2023 @06:55AM
(#34722642)
That sounds like a recipe for disaster. If you have fractional unit prices, and multiply by the number of units, floats can still give you errors. No, fixed decimal types definitely have their uses.