Suppose $f,g$ are continuous functions from $\mathbb R$ to $\mathbb R$, with the property that $$f(x)+f(y)=g(x+y)$$ for all $x,y$. Taking $x=y=z/2$ implies that $g(x)=2f(x/2)$ so that the above condition becomes $$f(x)+f(y)=2f((x+y)/2).$$ This is known as Jensen's functional equation, and it implies that $f$ is linear.
There's also a generalization of Jensen's equation (I've seen it in work of Rassias, but it could be earlier): if $|f(x)+f(y)-2f((x+y)/2)|\leq\epsilon$ (and assuming WLOG that $f(0)=0$), then there is a linear function $L$ such that $|f(x)-L(x)\|\leq \epsilon$.
What I am interested in a generalization of all this: Suppose there are independent random variables $X,Y$ such that $$E[(f(X)+f(Y)-g(X+Y))^2]\leq\epsilon.$$ Is it possible to say anything about $f$ being (appropriately) approximately linear?