What exactly is $\lfloor -0.5 \rceil $?

89 Views Asked by At

Suppose $g(x) = \lfloor x \rceil$ converts a real number $x$ into its nearest integer.

I know

  • $g(0.4) = 0$
  • $g(0.6) = 1$

But what are those?

  • $g(0.5) = ?$
  • $g(-0.5) = ?$
4

There are 4 best solutions below

0
On

"The nearest integer" to $0.5$ does not exist.


In other words, the sentence

Suppose $g(x) = \lfloor x \rceil$ converts a real number $x$ into its nearest integer.

Does not provide enough information to determine what $g(0.5)$ is equal to.

0
On

This is similar to asking

The function $1/x$ converts a real number into its reciprocal; what is $1/0$?

Unless you somehow define the reciprocal of zero, the function is not defined at it.

Similarly, your function is not defined at points $x=n+1/2$, where $n$ is integer.

There are many ways to extend it, but each of them is somewhat arbitrary.

  1. ties to $0$; in this case $\lfloor 1/2\rceil=0$, $\lfloor -1/2\rceil=0$, $\lfloor 3/2=1$, $\lfloor-3/2\rfloor=-1$

  2. ties to $\infty$; in this case $\lfloor 1/2\rceil=1$, $\lfloor -1/2\rceil=0$, $\lfloor 3/2=2$, $\lfloor-3/2\rfloor=-1$

  3. ties to $-\infty$: in this case $\lfloor 1/2\rceil=0$, $\lfloor -1/2\rceil=-1$, $\lfloor 3/2=1$, $\lfloor-3/2\rfloor=-2$

  4. ties to even: in this case $\lfloor 1/2\rceil=0$, $\lfloor -1/2\rceil=0$, $\lfloor 3/2\rceil=2$ and $\lfloor -3/2\rceil=-2$

0
On

"Nearest integer" is not defined here, and so $g(0.5)$ is not defined - if we are simply rounding to the nearest integer convention sometimes states that you round up if you are halfway between two integers, but this is quite arbitrary.

0
On

Take the range of $$ 0 \le \left\{ x \right\} = x - \left\lfloor x \right\rfloor < 1 $$ and divide it in discrete tens $$ \left( {0,{1 \over {10}},{2 \over {10}}, \cdots ,{9 \over {10}}} \right) $$

There are ten divisions, and to make the partition "equilibrated" we define $$ \left\{ \matrix{ 0 \le x < {1 \over 2}\quad \to \quad \left\lfloor x \right\rfloor \hfill \cr {1 \over 2} \le x < 1\quad \to \quad \left\lceil x \right\rceil \hfill \cr} \right. $$ which is the standard rounding adopted in economics and engineering.

That translates to: $$ {\rm Round}(x) = \left\lfloor {x + {1 \over 2}} \right\rfloor = \left\lfloor x \right\rfloor + \left\lfloor {2\left\{ x \right\}} \right\rfloor = \left\lfloor {2x} \right\rfloor - \left\lfloor x \right\rfloor $$ which in particular gives $$ {\rm Round}\left( { - 1/2} \right) = 0,\quad {\rm Round}\left( 0 \right) = 0,\quad {\rm Round}\left( {1/2} \right) = 1 $$