Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Say I have number $x$ which can be split into $y$ and $z$ to with the split being a percentage of $x$ to unlimited precision.

How do I ensure the sum of $y$ and $z$ will always sum back to $x$ after rounding?

For example:

$x = 10.1$ with split = $50\%$

$y = 5.05$

$z = 5.05$

rounding to 1dp

$y = 5.1$, $z = 5.1$

$y + z = 10.2\neq x$

share|cite|improve this question
If you round to $1$ decimal place, this is what you get and nothing is wrong. On the other side, you also speak about $unlimited$ $precision$ in another place. – Claude Leibovici Feb 27 '14 at 9:45
Unlimited precision is the split of x so instead of 50% it could be 75.34556325%. I understand I lose precision when I round, my question is how do I round in such a way that they still sum to the original? – m.edmondson Feb 27 '14 at 9:47
Let us speak about dollars and cents using existing coins. You want to give the same amount to two of your friends and what you want to split is 1.23$. Then ???. This is problem of rounding. – Claude Leibovici Feb 27 '14 at 9:52

You don't.

When rounding you change the value to an approximate one so when summing back you cannot always go back to the original value.

However you can artificially do it. Whenever you round a number, you either lose or gain a certain value so I suggest doing it slightly differently:

Split $10.1$ into $y = 5.05$ and $z = 5.05$. When rounding both value automatically gain $0.05$ making the sum $2\times0.05 = 0.1$ too large.

So when rounding $y$ to $5.1$, notice that you are $0.05$ too large and you will need to balance on another number to make sure the sum doesn't change. So then you need to "round" $z$ to $5.0$ making the sum $10.1$ again.

share|cite|improve this answer

Some fascinating questions of consistency and purpose emerge:

If we're content with an approximate split, why should we want it to recover to exactly the original number?

If we're content with 5.1 as an approximation to 5.05, then why not 10.2 to 10.1?

If the purpose is to reduce bothersome decimal places, then why not split 10 into 5 and 5?

(Hopefully the last answers the original question).

share|cite|improve this answer
The algebra simplifies things: 2((a/2)+b) is greater than a, where a and b are greater than 0. – Wanderlust Mar 1 '14 at 13:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.