Definition:Rounding/Treatment of Half

From ProofWiki
Jump to navigation Jump to search

Definition

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

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


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.


Round Up

The round up convention is that the larger of those two integers is used:

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


Round Down

The round down convention is that the smaller of those two integers is used:

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


Round to Even

The round to even convention is that the nearest even integer to $\dfrac x {10^n}$ is used:

$X = \begin {cases} 10^n \floor {\dfrac x {10^n} + \dfrac 1 2} & : \text {$\floor {\dfrac x {10^n} + \dfrac 1 2}$ even} \\ 10^n \ceiling {\dfrac x {10^n} - \dfrac 1 2} & : \text {$\floor {\dfrac x {10^n} + \dfrac 1 2}$ odd} \end {cases}$


Sources