\frac{x}{x + 1} - \frac{x + 1}{x - 1}\begin{array}{l}
\mathbf{if}\;x \leq -12791.804318799803 \lor \neg \left(x \leq 14978.088350211741\right):\\
\;\;\;\;\left(\frac{-3}{x} - {x}^{-2}\right) - \frac{3}{{x}^{3}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1} + \left(x + 1\right) \cdot \frac{-1}{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 -12791.804318799803) (not (<= x 14978.088350211741))) (- (- (/ -3.0 x) (pow x -2.0)) (/ 3.0 (pow x 3.0))) (+ (/ x (+ x 1.0)) (* (+ x 1.0) (/ -1.0 (- 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 <= -12791.804318799803) || !(x <= 14978.088350211741)) {
tmp = ((-3.0 / x) - pow(x, -2.0)) - (3.0 / pow(x, 3.0));
} else {
tmp = (x / (x + 1.0)) + ((x + 1.0) * (-1.0 / (x - 1.0)));
}
return tmp;
}



Bits error versus x
Results
if x < -12791.8043187998028 or 14978.0883502117413 < x Initial program 59.3
Taylor expanded around inf 0.3
Simplified0.0
rmApplied pow2_binary64_15230.0
Applied pow-flip_binary64_15160.0
Simplified0.0
if -12791.8043187998028 < x < 14978.0883502117413Initial program 0.1
rmApplied div-inv_binary64_14390.1
Applied cancel-sign-sub-inv_binary64_14080.1
Final simplification0.1
herbie shell --seed 2021098
(FPCore (x)
:name "Asymptote C"
:precision binary64
(- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))