The function $f$ is defined by \[f(x) = \lfloor|x|\rfloor - |\lfloor x \rfloor|\]for all real numbers $x$, where $\lfloor r \rfloor$ denotes the greatest integer less than or equal to the real number $r$. What is the range of $f$?
$\textbf{(A) } \{-1, 0\} \qquad\textbf{(B) } \text{The set of nonpositive integers} \qquad\textbf{(C) } \{-1, 0, 1\} \qquad\textbf{(D) } \{0\} \qquad \textbf{(E) } \text{The set of nonnegative integers}$
There are four cases we need to consider here.
Case 1: $x$ is a positive integer. Without loss of generality, assume $x=1$. Then $f(1) = 1 - 1 = 0$.
Case 2: $x$ is a positive fraction. Without loss of generality, assume $x=\frac{1}{2}$. Then $f\left(\frac{1}{2}\right) = 0 - 0 = 0$.
Case 3: $x$ is a negative integer. Without loss of generality, assume $x=-1$. Then $f(-1) = 1 - 1 = 0$.
Case 4: $x$ is a negative fraction. Without loss of generality, assume $x=-\frac{1}{2}$. Then $f\left(-\frac{1}{2}\right) = 0 - 1 = -1$.
Thus the range of the function $f$ is $\boxed{\textbf{(A) } \{-1, 0\}}$.
~IronicNinja