A function $f : X \to Y$ is a “doubling” function if for every $y \in Y$ , there are exactly two distinct values $x_1,x_2 \in X$ such that $f(x_1) = f(x_2) = y$.
I am satisfied with the answer to my previous question - $f:\mathbb{R} \setminus \{0\} \to \mathbb{R}$ given by $f(x) = \log|x|$ has this property. But we want the domain and codomain to be $\mathbb{R}$. Hence choose some bijection $g:\mathbb{R} \to \mathbb{R} \setminus \{0\}$ and $ f \circ g:\mathbb{R} \to \mathbb{R}$ should do the trick.
However, this function cannot be defined when x is 0. What kind of function then would be 'doubling' for all real numbers?

HINT: Let $f(x)=\ln|x|$ for $x\in\mathbb{R}\setminus\mathbb{Z}$. Then you can easy define a function on the remaining part (you have a countable set of values to obtain). E.g. $f(0)=f(1)=\text{first remaining value}$, $f(-1)=f(2)=\text{second remaining value}$ and so on.