For which continuous functions $f:\mathbb R\to\mathbb R$ does there exist a discontinuous function $g$ such that $f=g\circ g$? Inspired by a bad approach to a homework problem, I'm wondering for which which continuous functions $f:\mathbb R\to\mathbb R$ does there exist a discontinuous function $g$ such that $f=g\circ g$.
Maybe I'm missing something immediate, but I'd like to show that there exists no continuous functions $f$ satisfying this.
Just kidding, it's apparently immediate.

For examples of a function $f$ that has no $g$ with $f = g \circ g$ (continuous or not), consider a case where $f$ has exactly one fixed point $p$ and exactly one point $q \ne p$ such that $f(q) = p$.  Since $g(p)$ would have to be a fixed point of $f$, we need $g(p) = p$, and since $f(g(q)) = g(f(q)) = p$ we need $g(q) = q$.  But then $f(q) = g(g(q)) = q$, contradiction.
A simple example of this is $f(x) = x + \dfrac{1-e^x}{1-e^{-1}}$ with $p =0$ and $q=-1$. 
EDIT: Oops, as Dark Malthorp pointed out we could have $g(q) = p$.  OK, suppose in addition there is exactly one $r$ with $f(r) = q$.  Since $f(g(r)) = g(f(r)) = g(q)=p$, we must have $g(r) = q$.  But then $f(r) = g(g(r)) = g(q) = p$, contradiction.  
