On 10/27/2016 01:53 PM, [email protected] wrote: > Yes, I was working at a large insurance company and some C code that did > calculations on lots and lots of entries triggered an audit due to > sizeable discrepancies in monetary terms.
[...] > > Also there is the banker's > rounding. > https://www.eecis.udel.edu/~breech/contest.inet.fall.07/problems/bankers-rounding.html > <https://www.eecis.udel.edu/%7Ebreech/contest.inet.fall.07/problems/bankers-rounding.html> > > Yes! When we were re-doing our ScaledDecimal implementation a few years ago, I moved GemStone to Banker's Rounding (round-to-even). It's fairly simple to implement, and is important to avoid biases in complex computerized calculations. I suspect that the "standard" rounding rule (if the digit is 5, round up) is a leftover from manual arithmetic -- if you're doing, say, long division, and you get a five, and the remainder is non-zero, you know that the quotient is actually greater than that, so you round up. And if you *don't* know what those digits beyond the 5 are, you round up anyway, because the only time you don't is if they're *all* zeroes. But with computer math it's easy to figure out whether all the digits will be zeroes or not, so we can use the better rounding rule. Regards, -Martin
