In general, $f$ does not admit such a decomposition. If it does, $f=g+h=(g+m)+(h-m)$, so we can assume $g\ge0$ and $h\le0$, that is, any antiderivative $F$ of $f$ is bounded variation. But in general this is not the case for an everywhere derivable function , e.g $F(x)=x^2\sin( 1/x^2)$ for $x\neq0$, $F(0)=0$.
Pietro Majer
- 60.6k
- 4
- 122
- 269