0

Assuming I have some values (representing shares of some total amount) that sum up exactly to 100, e.g.:

13.44500
35.35500
40.39877
10.80123

If I round them to two decimal places I get the following values that do no longer sum up to 100, but instead sum up to 100.01

13.45
35.36
40.40
10.80

I know that rounding discards information, but I always thought that since we discard information from each number in the same way, the sum should not change. Therefore my questions are:

  • What are the mathematical properties of rounding?
  • Why do the rounded values sum up to something different than the original ones?
  • What is the best practice to display these values and the sum to a user, when I can only show two decimal places both of the values and the sum? Since the underlying data sums up to 100 I do not want to display values that sum up to something different.
1awuesterose
  • 495
  • 5
  • 15
  • Many, many charts have a footnote "Values may not add to 100% due to rounding." Most of the time, no one would even notice the non-100% (if it happens). Your example is only noticeable because you only have two nonzero least significant digits. – Teepeemm Jul 24 '16 at 18:24
  • Also http://stackoverflow.com/q/13483430/2336725 – Teepeemm Jul 24 '16 at 18:28
  • Thank you for the links to these questions, I did not notice them! – 1awuesterose Jul 24 '16 at 18:36

1 Answers1

1

This issue comes from the fact that 1/2 or 0.5 rounds up.

"Losing data in the same way" from all rounded numbers doesn't mean mathematical operations on the numbers will remain unaffected.

See that

1.005 + 1.005 = 2.01

however they each round up to 1.01 (if we round to two decimals) so, if we round before adding we naturally get:

1.01 + 1.01 = 2.02

William B
  • 1,411
  • 8
  • 10
  • Do you have a suggestion how to approach my third question? – 1awuesterose Jul 24 '16 at 18:04
  • 2
    This also happens with an unbiased rounding rule (eg round to even) – harold Jul 24 '16 at 18:05
  • Best practice is subjective, but depending on what data is being represented I say either 1. show the user the full precision, or 2. accept that the sum of the rounded numbers will not match the exact sum. – William B Jul 24 '16 at 18:07
  • 1
    It's not just .5 rounding up. It's rounding at all. For example, three copies of 1/3=.3333... – Teepeemm Jul 24 '16 at 18:21
  • True. I meant that OP's issue is specifically occurring because of the two 0.005 values rounding up. Along with the mistaken assumption that rounding all values involved will not affect mathematical operations on them – William B Jul 24 '16 at 18:27