\frac{1}{x + 1} - \frac{1}{x - 1}
\begin{array}{l}
t_0 := \frac{1}{1 + x} - \frac{1}{x - 1}\\
\mathbf{if}\;t_0 \leq 0:\\
\;\;\;\;\frac{\frac{-2}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
(FPCore (x) :precision binary64 (- (/ 1.0 (+ x 1.0)) (/ 1.0 (- x 1.0))))
(FPCore (x) :precision binary64 (let* ((t_0 (- (/ 1.0 (+ 1.0 x)) (/ 1.0 (- x 1.0))))) (if (<= t_0 0.0) (/ (/ -2.0 x) x) t_0)))
double code(double x) {
return (1.0 / (x + 1.0)) - (1.0 / (x - 1.0));
}
double code(double x) {
double t_0 = (1.0 / (1.0 + x)) - (1.0 / (x - 1.0));
double tmp;
if (t_0 <= 0.0) {
tmp = (-2.0 / x) / x;
} else {
tmp = t_0;
}
return tmp;
}



Bits error versus x
Results
if (-.f64 (/.f64 1 (+.f64 x 1)) (/.f64 1 (-.f64 x 1))) < 0.0Initial program 27.8
Taylor expanded in x around inf 1.5
Applied unpow2_binary641.5
Applied associate-/r*_binary640.8
if 0.0 < (-.f64 (/.f64 1 (+.f64 x 1)) (/.f64 1 (-.f64 x 1))) Initial program 0.0
Final simplification0.4
herbie shell --seed 2021224
(FPCore (x)
:name "Asymptote A"
:precision binary64
(- (/ 1.0 (+ x 1.0)) (/ 1.0 (- x 1.0))))