# Definition:Rounding

## Definition

Rounding is the process of approximation of a value of a variable to a multiple of a given power of whatever number base one is working in (usually decimal).

Let $n \in \Z$ be an integer.

Let $x \in \R$ be a real number.

Let $X \in \R$ such that:

$X = 10^n \floor {\dfrac x {10^n} + \dfrac 1 2}$

or:

$X = 10^n \ceiling {\dfrac x {10^n} - \dfrac 1 2}$

where $\floor {\, \cdot \,}$ denotes the floor function and $\ceiling {\, \cdot \,}$ denotes the ceiling function.

Then $X$ is defined as $x$ rounded to the nearest $n$th power of $10$.

Both of these definitions amount to the same thing, except for when $\dfrac x {10^n}$ is exactly halfway between $\floor {\dfrac x {10^n} }$ and $\ceiling {\dfrac x {10^n} }$.

How these instances is treated is known as the treatment of the half.

### Rounding to Nearest Integer

When $n = 0$, the operation is referred to as rounding to the nearest integer:

Let $X \in \R$ such that:

$X = \floor {x + \dfrac 1 2}$

Then $X$ is defined as $x$ rounded to the nearest integer.

## Treatment of Half

Consider the situation when $\dfrac x {10^n} + \dfrac 1 2$ is an integer.

That is, $\dfrac x {10^n}$ is exactly midway between the two integers $\dfrac x {10^n} - \dfrac 1 2$ and $\dfrac x {10^n} + \dfrac 1 2$.

Recall that the general philosophy of the process of rounding is to find the closest approximation to $x$ to a given power of $10$.

Thus there are two equally valid such approximations:

$\dfrac x {10^n} - \dfrac 1 2$ and $\dfrac x {10^n} + \dfrac 1 2$

between which $\dfrac x {10^n}$ is exactly midway.

There are a number of conventions which determine which is to be used.

## Rounding Error

Let $X$ be $x$ rounded to the nearest $n$th power of $10$.

The rounding error caused by the rounding of $x$ to $X$ is defined as:

$e_R = \size {x - X}$

## Also known as

When $n < 0$, the terminology used is usually:

$x$ rounded to the nearest $m$th decimal place

where $m = -n$.

## Examples

### $72 \cdotp 8146$ to $2$ Decimal Places

$72 \cdotp 8146$ rounded to $2$ decimal places is $72 \cdotp 81$.

This is because $72 \cdotp 8146$ is closer to $72 \cdotp 81$ than $72 \cdotp 82$.

### $48 \cdotp 6$ to Nearest Unit

$48 \cdotp 6$ rounded to the nearest unit is $49$.

This is because $48 \cdotp 6$ is closer to $49$ than $48$.

### $136 \cdotp 5$ to Nearest Unit

$136 \cdotp 5$ rounded to the nearest unit is $136$.

We have that $136 \cdotp 5$ is half way between $136$ and $137$, and the convention is to round to the nearest even digit.

### $2 \cdotp 484$ to Nearest Hundredth

$2 \cdotp 484$ rounded to the nearest hundredth is $2 \cdotp 48$.

This is because $2 \cdotp 484$ is closer to $2 \cdotp 48$ than $2 \cdotp 49$.

### $0 \cdotp 0435$ to Nearest Thousandth

$0 \cdotp 0435$ rounded to the nearest thousandth is $0 \cdotp 044$.

We have that $0 \cdotp 0435$ is half way between $0 \cdotp 043$ and $0 \cdotp 044$, and the convention is to round to the nearest even digit.

### $4 \cdotp 500 \, 01$ to Nearest Unit

$4 \cdotp 500 \, 01$ rounded to the nearest unit is $5$.

This is because $4 \cdotp 500 \, 01$ is closer to $5$ than $4$.