\frac{x}{x + 1} - \frac{x + 1}{x - 1}\begin{array}{l}
\mathbf{if}\;\frac{x}{x + 1} - \frac{x + 1}{x - 1} \le 1.64651002377 \cdot 10^{-6}:\\
\;\;\;\;\left(\frac{-1}{{x}^{2}} - \frac{3}{x}\right) - \frac{3}{{x}^{3}}\\
\mathbf{else}:\\
\;\;\;\;\log \left(e^{\frac{x}{x + 1} - \frac{x + 1}{x - 1}}\right)\\
\end{array}double code(double x) {
return ((x / (x + 1.0)) - ((x + 1.0) / (x - 1.0)));
}
double code(double x) {
double VAR;
if ((((x / (x + 1.0)) - ((x + 1.0) / (x - 1.0))) <= 1.6465100237672559e-06)) {
VAR = (((-1.0 / pow(x, 2.0)) - (3.0 / x)) - (3.0 / pow(x, 3.0)));
} else {
VAR = log(exp(((x / (x + 1.0)) - ((x + 1.0) / (x - 1.0)))));
}
return VAR;
}



Bits error versus x
Results
if (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))) < 1.6465100237672559e-06Initial program 59.0
Taylor expanded around inf 0.5
Simplified0.2
if 1.6465100237672559e-06 < (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))) Initial program 0.1
rmApplied add-log-exp0.1
Applied add-log-exp0.1
Applied diff-log0.1
Simplified0.1
Final simplification0.2
herbie shell --seed 2020106
(FPCore (x)
:name "Asymptote C"
:precision binary64
(- (/ x (+ x 1)) (/ (+ x 1) (- x 1))))