\frac{1}{x + 1} - \frac{1}{x - 1}\begin{array}{l}
\mathbf{if}\;\frac{1}{1 + x} - \frac{1}{x - 1} \leq 0:\\
\;\;\;\;\left(\frac{\frac{-2}{x}}{x} - \frac{2}{{x}^{4}}\right) - \frac{2}{{x}^{6}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{1 + x} - \frac{1}{x - 1}\\
\end{array}(FPCore (x) :precision binary64 (- (/ 1.0 (+ x 1.0)) (/ 1.0 (- x 1.0))))
(FPCore (x) :precision binary64 (if (<= (- (/ 1.0 (+ 1.0 x)) (/ 1.0 (- x 1.0))) 0.0) (- (- (/ (/ -2.0 x) x) (/ 2.0 (pow x 4.0))) (/ 2.0 (pow x 6.0))) (- (/ 1.0 (+ 1.0 x)) (/ 1.0 (- x 1.0)))))
double code(double x) {
return (1.0 / (x + 1.0)) - (1.0 / (x - 1.0));
}
double code(double x) {
double tmp;
if (((1.0 / (1.0 + x)) - (1.0 / (x - 1.0))) <= 0.0) {
tmp = (((-2.0 / x) / x) - (2.0 / pow(x, 4.0))) - (2.0 / pow(x, 6.0));
} else {
tmp = (1.0 / (1.0 + x)) - (1.0 / (x - 1.0));
}
return tmp;
}



Bits error versus x
Results
if (-.f64 (/.f64 1 (+.f64 x 1)) (/.f64 1 (-.f64 x 1))) < 0.0Initial program 30.1
Taylor expanded around inf 1.0
Simplified1.0
rmApplied associate-/r*_binary640.3
if 0.0 < (-.f64 (/.f64 1 (+.f64 x 1)) (/.f64 1 (-.f64 x 1))) Initial program 0.0
rmApplied *-un-lft-identity_binary640.0
Applied associate-/r*_binary640.0
Final simplification0.2
herbie shell --seed 2021110
(FPCore (x)
:name "Asymptote A"
:precision binary64
(- (/ 1.0 (+ x 1.0)) (/ 1.0 (- x 1.0))))