\frac{x}{x + 1} - \frac{x + 1}{x - 1}
\begin{array}{l}
t_0 := \mathsf{fma}\left(-1, \mathsf{fma}\left(3, {x}^{-3}, {x}^{-2}\right), \frac{-3}{x}\right)\\
\mathbf{if}\;x \leq -18424.40926304694:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 11995.028539617728:\\
\;\;\;\;\begin{array}{l}
t_1 := \frac{x + -1}{x + 1}\\
t_2 := \frac{x + 1}{x}\\
\frac{t_1 - t_2}{t_1 \cdot t_2}
\end{array}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
(FPCore (x) :precision binary64 (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))
(FPCore (x)
:precision binary64
(let* ((t_0 (fma -1.0 (fma 3.0 (pow x -3.0) (pow x -2.0)) (/ -3.0 x))))
(if (<= x -18424.40926304694)
t_0
(if (<= x 11995.028539617728)
(let* ((t_1 (/ (+ x -1.0) (+ x 1.0))) (t_2 (/ (+ x 1.0) x)))
(/ (- t_1 t_2) (* t_1 t_2)))
t_0))))double code(double x) {
return (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0));
}
double code(double x) {
double t_0 = fma(-1.0, fma(3.0, pow(x, -3.0), pow(x, -2.0)), (-3.0 / x));
double tmp;
if (x <= -18424.40926304694) {
tmp = t_0;
} else if (x <= 11995.028539617728) {
double t_1 = (x + -1.0) / (x + 1.0);
double t_2 = (x + 1.0) / x;
tmp = (t_1 - t_2) / (t_1 * t_2);
} else {
tmp = t_0;
}
return tmp;
}



Bits error versus x
if x < -18424.409263046939 or 11995.028539617728 < x Initial program 59.4
Taylor expanded in x around inf 0.3
Simplified0.0
Applied egg0.0
if -18424.409263046939 < x < 11995.028539617728Initial program 0.1
Applied egg0.1
Final simplification0.0
herbie shell --seed 2022125
(FPCore (x)
:name "Asymptote C"
:precision binary64
(- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))