Re:E-Stop and Fuel, software that keeps you awake at night
by _0ffh on Sunday February 11, 2018 @07:29AM
(#16352406)
Not just the US, IIRC financial institutions around the world are required to do decimal rounding. OTOH I don't see why you would even use floating point for money. Just scale your integers to the required precision (and make sure you've got enough bits for the kind of amounts you need to be able to handle) and you're good.
Re:E-Stop and Fuel, software that keeps you awake at night
by davidcuddeback on Sunday February 11, 2018 @12:44PM
(#16353687)
Having worked in both aerospace (GP's comment) and e-commerce (your comment), I can tell you that these are not the same problem and do not require the same solution.
First week on the job in e-commerce, I educated the junior engineers on the problems that can arise when using floating point math with currencies, then prioritized work to remove any floating point math from the code. That doesn't mean I wouldn't use floating point anywhere else. In aerospace in particular, I've used floating-point without issue, so I don't think you're point about currencies has any relevancy to the GP's comment regarding fuel estimation.
You can call it a knee-jerk reaction, but the law itself clearly has that bias, and for good reason.
All regulations were paved in blood.