\frac{x}{x + 1} - \frac{x + 1}{x - 1}
\begin{array}{l}
\mathbf{if}\;\frac{x}{x + 1} - \frac{x + 1}{x - 1} \leq 2.6303332268939883 \cdot 10^{-6}:\\
\;\;\;\;\frac{-3}{x} - \left(\frac{1}{x \cdot x} + \frac{3}{{x}^{3}}\right)\\
\mathbf{else}:\\
\;\;\;\;{e}^{\log \left(\mathsf{fma}\left(x, \frac{1}{x + 1}, \frac{-1 - x}{x - 1}\right)\right)}\\
\end{array}
(FPCore (x) :precision binary64 (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))
(FPCore (x) :precision binary64 (if (<= (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))) 2.6303332268939883e-6) (- (/ -3.0 x) (+ (/ 1.0 (* x x)) (/ 3.0 (pow x 3.0)))) (pow E (log (fma x (/ 1.0 (+ x 1.0)) (/ (- -1.0 x) (- x 1.0)))))))
double code(double x) {
return (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0));
}
double code(double x) {
double tmp;
if (((x / (x + 1.0)) - ((x + 1.0) / (x - 1.0))) <= 2.6303332268939883e-6) {
tmp = (-3.0 / x) - ((1.0 / (x * x)) + (3.0 / pow(x, 3.0)));
} else {
tmp = pow(((double) M_E), log(fma(x, (1.0 / (x + 1.0)), ((-1.0 - x) / (x - 1.0)))));
}
return tmp;
}



Bits error versus x
if (-.f64 (/.f64 x (+.f64 x 1)) (/.f64 (+.f64 x 1) (-.f64 x 1))) < 2.63033322689e-6Initial program 58.9
Taylor expanded in x around inf 0.6
Simplified0.3
if 2.63033322689e-6 < (-.f64 (/.f64 x (+.f64 x 1)) (/.f64 (+.f64 x 1) (-.f64 x 1))) Initial program 0.1
Applied div-inv_binary640.1
Applied fma-neg_binary640.1
Simplified0.1
Applied add-exp-log_binary640.1
Applied pow1_binary640.1
Applied log-pow_binary640.1
Applied exp-prod_binary640.1
Simplified0.1
Final simplification0.2
herbie shell --seed 2021313
(FPCore (x)
:name "Asymptote C"
:precision binary64
(- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))