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



Bits error versus x
Results
if x < -10559.5074544994695 or 11243.776937313149 < x Initial program 59.1
Taylor expanded in x around inf 0.3
Simplified0.0
if -10559.5074544994695 < x < 11243.776937313149Initial program 0.1
Final simplification0.1
herbie shell --seed 2022003
(FPCore (x)
:name "Asymptote C"
:precision binary64
(- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))