Is there a trick for computing the expression $x + (exp(x)-x)/(exp(2*x) + 1)$ while avoiding an overflow? Currently, computation seems to fail for any $x \geq 710$, presumably because computing $exp(2*x)$ leads to an overflow. The expression as such never produces particularly large numbers, but exponentiation seems to cause problems.
I'm working in R, but the same problem occurs in C++ as well.
If there is no trick for computing it, I'd be just as happy using another non-negative monotonic function which is nearly linear for $x > 10$.