\frac{x}{x + 1} - \frac{x + 1}{x - 1}
\begin{array}{l}
\mathbf{if}\;\frac{x}{x + 1} - \frac{x + 1}{x - 1} \leq 4.865807035070446 \cdot 10^{-8}:\\
\;\;\;\;\left(\frac{-3}{x} - \left(\frac{1}{x \cdot x} + \frac{3}{{x}^{3}}\right)\right) - \frac{1}{{x}^{4}}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_0 := \frac{1}{x - 1}\\
{\left(\sqrt{\mathsf{fma}\left(x, \frac{1}{x + 1}, t_0 \cdot \left(-1 - x\right)\right)}\right)}^{2} + \mathsf{fma}\left(\frac{-1}{x - 1}, x + 1, \left(x + 1\right) \cdot t_0\right)
\end{array}\\
\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))) 4.865807035070446e-8)
(-
(- (/ -3.0 x) (+ (/ 1.0 (* x x)) (/ 3.0 (pow x 3.0))))
(/ 1.0 (pow x 4.0)))
(let* ((t_0 (/ 1.0 (- x 1.0))))
(+
(pow (sqrt (fma x (/ 1.0 (+ x 1.0)) (* t_0 (- -1.0 x)))) 2.0)
(fma (/ -1.0 (- x 1.0)) (+ x 1.0) (* (+ x 1.0) t_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))) <= 4.865807035070446e-8) {
tmp = ((-3.0 / x) - ((1.0 / (x * x)) + (3.0 / pow(x, 3.0)))) - (1.0 / pow(x, 4.0));
} else {
double t_0 = 1.0 / (x - 1.0);
tmp = pow(sqrt(fma(x, (1.0 / (x + 1.0)), (t_0 * (-1.0 - x)))), 2.0) + fma((-1.0 / (x - 1.0)), (x + 1.0), ((x + 1.0) * t_0));
}
return tmp;
}



Bits error versus x
if (-.f64 (/.f64 x (+.f64 x 1)) (/.f64 (+.f64 x 1) (-.f64 x 1))) < 4.8658070351e-8Initial program 59.0
Taylor expanded in x around inf 0.5
Simplified0.2
if 4.8658070351e-8 < (-.f64 (/.f64 x (+.f64 x 1)) (/.f64 (+.f64 x 1) (-.f64 x 1))) Initial program 0.2
Applied div-inv_binary640.2
Applied div-inv_binary640.2
Applied prod-diff_binary640.2
Applied add-sqr-sqrt_binary640.2
Applied pow1_binary640.2
Applied pow1_binary640.2
Applied pow-prod-up_binary640.2
Final simplification0.2
herbie shell --seed 2022081
(FPCore (x)
:name "Asymptote C"
:precision binary64
(- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))