# Rounding

Approximating numbers by rounding is not quite as straightforward as truncation, but the approximations are better.

The number $\pi$ (pi) is $$\pi = 3.014159265358979323846264338327950388\dots$$

The decimal goes on forever, but in many calculations we only use a few digits. Computers do not always work with exact values, and $\pi$ is a good example of a number whose exact value is not used when computers or calculators are doing calculations. Approximations are used for numbers with infinite or very long decimal expansions. Sometimes approximations are used because keeping extra decimal places is not needed.

Writing $\pi$ to $2$ decimal places means we write $\pi = 3.14$ and do not bother with other digits. We write only $2$ digits after the decimal point.

If we want $\pi$ to $4$ decimal places we could write $3.1415$, but $\pi$ is much closer to $3.1416$. We round $\pi$ to $4$ decimal places. This means that we use $4$ digits after the decimal point, but we use the number that is closest to the real value of $\pi$. When we round a number we choose the number with the correct number of digits which is closest to the original number.

##### Examples
• $\pi$ rounded to $0$ decimal places is $3$ ($3.1\dots$ is closer to $3$ than to $4$):
• $\pi$ rounded to $1$ decimal place is $3.1$ ($3.14\dots$ is closer to $3.1$ than to $3.2$). To see this we zoom in on the segment from $3$ to $4$ in the line above:
• $\pi$ rounded to $2$ decimal places is $3.14$ ($3.141\dots$ is closer to $3.14$ than to $3.15$). To see this we zoom in on the segment from $3.1$ to $3.2$ in the line above:
• $\pi$ rounded to $3$ decimal places is $3.142$ ($3.1415$ is as close to $3.142$ than to $3.141$. So consider $3.14159\dots$, this is closer to $3.142$ than to $3.141$). To see this we zoom in on the segment from $3.14$ to $3.15$ in the line above:
• $\pi$ rounded to $4$ decimal places is $3.1416$ ($3.14159\dots$ is closer to $3.1416$ than to $3.1415$). To see this we zoom in on the segment from $3.141$ to $3.142$ in the line above:
• $45.6$ rounded to the nearest integer (whole number) is $46$ ($45.6$ is closer to $46$ than to $45$).
• $7651.23$ rounded to the nearest integer is $7651$ ($7651.23$ is closer to $7651$ than to $7652$).

Each time we had to decide what to do with the last digit kept (leave it as is or increase it by $1$). mostly we just had to look at the following digit. If the following digit is greater than $5$, increase the last digit. If the following digit is less than $5$, leave the last digit as it is. If the following digit is $5$ and there are more (non-zero) digits, increase the last digit. If the following digit is $5$ and there are no more digits, we have a choice (we deal with this soon).

The same applies to negative numbers; we select the number with the correct number of digits which is closest to the original number.

Here are some more examples:

• Round $10.3756$ to $2$ decimal places.
Answer: $10.38$ (as $10.3756$ is closer to $10.38$ than to $10.37$);
• Round $-10.3756$ to $2$ decimal places.
Answer: $-10.38$ (as $-10.3756$ is closer to $-10.38$ than to $-10.37$);
• Round $9.999$ to $1$ decimal places.
Answer: $10.0$ (as $9.999$ is closer to $10.0$ than to $9.9$);
• Round $-9.999$ to $1$ decimal places.
Answer: $-10.0$ (as $-9.999$ is closer to $-10.0$ than to $-9.9$).

In these examples we saw that the minus sign, "$-$", at the front of the negative number didn't change what is done to the digits. In general, rounding negative numbers is no different to rounding positive numbers.

• Round $9.15$ to $1$ decimal place.
Answer: $9.1$ and $9.2$ are both possible answers as they are the same distance from $9.15$.

Rounding a number like $9.15$ to $1$ decimal place can be done in several ways. There is no one correct answer. Some always round up (giving $9.2$ in this case), some down (giving $9.1$). Another option is to round up or down so as to make the last digit even. this is not the easiest method, but it is by far the best for data collection (for example, measuring heights of people) as the average of the data collected will be more accurate. Using this method, $9.15$ rounded to one decimal place is $9.2$ (because $2$ is even).

Using the method of rounding a $5$ (which has no digits after it) up or down so as to make the last digit even we get:

• $9.5$ rounded to the nearest whole number ($0$ decimal places) is $10$;
• $8.5$ rounded to the nearest whole number ($0$ decimal places) is $8$;
• $345.6565$ rounded to $3$ decimal places is $345.656$;
• $345.6565$ rounded to $1$ decimal places is $345.7$ (as it is closer to $345.7$ than to $345.6$);
• $-9.5$ rounded to the nearest whole number ($0$ decimal places) is $-10$;
• $-8.5$ rounded to the nearest whole number ($0$ decimal places) is $-8$.