\frac{1}{x + 1} - \frac{1}{x - 1}
\begin{array}{l}
t_0 := \frac{2}{{x}^{6}}\\
\mathbf{if}\;x \leq -0.9981121859939434:\\
\;\;\;\;\left(\frac{-2}{x \cdot x} - \frac{2}{{x}^{4}}\right) - t_0\\
\mathbf{elif}\;x \leq 55.498538329832456:\\
\;\;\;\;e^{-\mathsf{log1p}\left(x\right)} - \frac{1}{x - 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-2}{{x}^{4}} - \left(t_0 + \left(\frac{\frac{2}{x}}{x} + \frac{2}{{x}^{8}}\right)\right)\\
\end{array}
(FPCore (x) :precision binary64 (- (/ 1.0 (+ x 1.0)) (/ 1.0 (- x 1.0))))
(FPCore (x)
:precision binary64
(let* ((t_0 (/ 2.0 (pow x 6.0))))
(if (<= x -0.9981121859939434)
(- (- (/ -2.0 (* x x)) (/ 2.0 (pow x 4.0))) t_0)
(if (<= x 55.498538329832456)
(- (exp (- (log1p x))) (/ 1.0 (- x 1.0)))
(-
(/ -2.0 (pow x 4.0))
(+ t_0 (+ (/ (/ 2.0 x) x) (/ 2.0 (pow x 8.0)))))))))double code(double x) {
return (1.0 / (x + 1.0)) - (1.0 / (x - 1.0));
}
double code(double x) {
double t_0 = 2.0 / pow(x, 6.0);
double tmp;
if (x <= -0.9981121859939434) {
tmp = ((-2.0 / (x * x)) - (2.0 / pow(x, 4.0))) - t_0;
} else if (x <= 55.498538329832456) {
tmp = exp(-log1p(x)) - (1.0 / (x - 1.0));
} else {
tmp = (-2.0 / pow(x, 4.0)) - (t_0 + (((2.0 / x) / x) + (2.0 / pow(x, 8.0))));
}
return tmp;
}



Bits error versus x
Results
if x < -0.998112185993943357Initial program 29.1
Applied expm1-log1p-u_binary6429.1
Taylor expanded in x around inf 0.8
Simplified0.8
if -0.998112185993943357 < x < 55.498538329832456Initial program 0.0
Applied add-exp-log_binary640.0
Applied 1-exp_binary640.0
Applied div-exp_binary640.0
Simplified0.0
if 55.498538329832456 < x Initial program 29.1
Taylor expanded in x around inf 0.7
Simplified0.7
Applied associate-/r*_binary640.1
Final simplification0.2
herbie shell --seed 2021352
(FPCore (x)
:name "Asymptote A"
:precision binary64
(- (/ 1.0 (+ x 1.0)) (/ 1.0 (- x 1.0))))