Definition:Rounding/Treatment of Half
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
- 1972: Murray R. Spiegel and R.W. Boxer: Theory and Problems of Statistics (SI ed.) ... (previous) ... (next): Chapter $1$: Rounding of Data
- 1997: Donald E. Knuth: The Art of Computer Programming: Volume 1: Fundamental Algorithms (3rd ed.) ... (previous) ... (next): $\S 1.2.4$: Integer Functions and Elementary Number Theory: Exercise $5$