Friday, October 14, 2016

Well Rounded

Dr. Drang:

The problem with always rounding halves up is that in doing so, you introduce a persistent bias in whatever calculations you do with the rounded number. If you’re adding a list of rounded numbers, for example, the sum will be biased high.

If you round halves to the nearest even number, though, the bias from upward roundings tends to be negated by an equal number of downward roundings.

1 Comment RSS · Twitter

I know that style of rounding as "banker's rounding". (For some reason, people really care about systemic biases when it come to calculating loan payments or interest payments - go figure!)

Foundation's NumberFormatter supports it with roundingMode halfEven:

Leave a Comment