\frac{x}{x + 1} - \frac{x + 1}{x - 1}\begin{array}{l}
\mathbf{if}\;x \leq -5946613085329.435 \lor \neg \left(x \leq 358991.0367498862\right):\\
\;\;\;\;\left(\frac{-3}{x} - {x}^{-2}\right) - \left(\frac{3}{{x}^{3}} + \frac{1}{{x}^{4}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-1 + x \cdot -3}{x \cdot x + -1}\\
\end{array}(FPCore (x) :precision binary64 (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))
(FPCore (x) :precision binary64 (if (or (<= x -5946613085329.435) (not (<= x 358991.0367498862))) (- (- (/ -3.0 x) (pow x -2.0)) (+ (/ 3.0 (pow x 3.0)) (/ 1.0 (pow x 4.0)))) (/ (+ -1.0 (* x -3.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 <= -5946613085329.435) || !(x <= 358991.0367498862)) {
tmp = ((-3.0 / x) - pow(x, -2.0)) - ((3.0 / pow(x, 3.0)) + (1.0 / pow(x, 4.0)));
} else {
tmp = (-1.0 + (x * -3.0)) / ((x * x) + -1.0);
}
return tmp;
}



Bits error versus x
Results
if x < -5946613085329.43457 or 358991.036749886174 < x Initial program 60.0
Taylor expanded around inf 0.3
Simplified0.0
rmApplied pow2_binary640.0
Applied pow-flip_binary640.0
Simplified0.0
if -5946613085329.43457 < x < 358991.036749886174Initial program 0.5
rmApplied frac-sub_binary640.5
Simplified0.5
Simplified0.5
Taylor expanded around 0 0.0
Final simplification0.0
herbie shell --seed 2021118
(FPCore (x)
:name "Asymptote C"
:precision binary64
(- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))