Friday, October 14, 2016 [Tweets] [Favorites]

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

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: https://developer.apple.com/reference/foundation/numberformatter.roundingmode

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment