\frac{x}{x + 1} - \frac{x + 1}{x - 1}
\begin{array}{l}
t_0 := \sqrt[3]{\frac{x}{x + 1}}\\
t_1 := \frac{1}{x - 1}\\
t_2 := t_1 \cdot \left(x + 1\right)\\
t_3 := \frac{3}{{x}^{3}}\\
\mathbf{if}\;x \leq -357154.3964769983:\\
\;\;\;\;-\left(\frac{3}{x} + \left(\frac{1}{x \cdot x} + \left|t_3\right|\right)\right)\\
\mathbf{elif}\;x \leq 8938.077962000918:\\
\;\;\;\;\mathsf{fma}\left(t_0, {t_0}^{2}, -t_2\right) + \mathsf{fma}\left(-t_1, x + 1, t_2\right)\\
\mathbf{else}:\\
\;\;\;\;-\left(\frac{3}{x} + \left(\left({x}^{-2} + 0\right) + t_3\right)\right)\\
\end{array}
(FPCore (x) :precision binary64 (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (/ x (+ x 1.0))))
(t_1 (/ 1.0 (- x 1.0)))
(t_2 (* t_1 (+ x 1.0)))
(t_3 (/ 3.0 (pow x 3.0))))
(if (<= x -357154.3964769983)
(- (+ (/ 3.0 x) (+ (/ 1.0 (* x x)) (fabs t_3))))
(if (<= x 8938.077962000918)
(+ (fma t_0 (pow t_0 2.0) (- t_2)) (fma (- t_1) (+ x 1.0) t_2))
(- (+ (/ 3.0 x) (+ (+ (pow x -2.0) 0.0) t_3)))))))double code(double x) {
return (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0));
}
double code(double x) {
double t_0 = cbrt((x / (x + 1.0)));
double t_1 = 1.0 / (x - 1.0);
double t_2 = t_1 * (x + 1.0);
double t_3 = 3.0 / pow(x, 3.0);
double tmp;
if (x <= -357154.3964769983) {
tmp = -((3.0 / x) + ((1.0 / (x * x)) + fabs(t_3)));
} else if (x <= 8938.077962000918) {
tmp = fma(t_0, pow(t_0, 2.0), -t_2) + fma(-t_1, (x + 1.0), t_2);
} else {
tmp = -((3.0 / x) + ((pow(x, -2.0) + 0.0) + t_3));
}
return tmp;
}



Bits error versus x
if x < -357154.396476998285Initial program 59.5
Taylor expanded in x around inf 0.3
Simplified0.0
Applied egg-rr0.1
if -357154.396476998285 < x < 8938.07796200091798Initial program 0.1
Applied egg-rr0.1
if 8938.07796200091798 < x Initial program 59.6
Taylor expanded in x around inf 0.3
Simplified0.0
Applied egg-rr0.0
Final simplification0.1
herbie shell --seed 2022127
(FPCore (x)
:name "Asymptote C"
:precision binary64
(- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))