TITLE: If $f:\mathbb{R}\to \mathbb{R}$ is a continuous function with $|f|$ uniformly continuous, is $f$ necessarily uniformly continuous?
QUESTION [5 upvotes]: I don't think so. But, I can't find the counterexample. 
The singularity shall be at infinity because $f$ is uniformly continuous over any bounded and closed intervals $[a,b]$. Also, $f$ must oscillate at infinity. Otherwise, the uniform continuity of $f$ is identical to $|f|$.

REPLY [7 votes]: Yes. Let $\epsilon>0$ be arbitrary. For some $\delta>0$ uniform continuity tells us that $$|x-y|<\delta\implies \left|\left(|f(x)|-|f(y)|\right)\right|<\frac{\epsilon}{2}$$ Take $x<y$ arbitrary with $|x-y|<\delta$. If $f(x)$ and $f(y)$ have the same sign, $$|f(x)-f(y)|=\left|\left(|f(x)|-|f(y)|\right)\right|<\frac{\epsilon}{2}<\epsilon$$ and we are done. Otherwise, by continuity of $f$, for some $z\in (x,y)$, $f(z)=0$. Then since $|x-z|<\delta$ and $|z-y|<\delta$, $|f(x)|$ and $|f(y)|$ are bounded by $\frac{\epsilon}{2}$, so that $$|f(x)-f(y)| \le |f(x)|+|f(y)|<\epsilon$$