\frac{x}{x + 1} - \frac{x + 1}{x - 1}
\begin{array}{l}
t_0 := \left(\frac{-3}{x} - \left(\frac{1}{x \cdot x} + \frac{3}{{x}^{3}}\right)\right) - \frac{1}{{x}^{4}}\\
\mathbf{if}\;x \leq -3606.908350404843:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2601.5280327281093:\\
\;\;\;\;\begin{array}{l}
t_1 := \frac{x}{x + 1}\\
t_2 := \frac{x + 1}{x + -1}\\
\frac{{t_1}^{3} - {t_2}^{3}}{{t_1}^{2} + \frac{\mathsf{fma}\left(x + 1, t_2, x\right)}{x + -1}}
\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
(-
(- (/ -3.0 x) (+ (/ 1.0 (* x x)) (/ 3.0 (pow x 3.0))))
(/ 1.0 (pow x 4.0)))))
(if (<= x -3606.908350404843)
t_0
(if (<= x 2601.5280327281093)
(let* ((t_1 (/ x (+ x 1.0))) (t_2 (/ (+ x 1.0) (+ x -1.0))))
(/
(- (pow t_1 3.0) (pow t_2 3.0))
(+ (pow t_1 2.0) (/ (fma (+ x 1.0) t_2 x) (+ x -1.0)))))
t_0))))double code(double x) {
return (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0));
}
double code(double x) {
double t_0 = ((-3.0 / x) - ((1.0 / (x * x)) + (3.0 / pow(x, 3.0)))) - (1.0 / pow(x, 4.0));
double tmp;
if (x <= -3606.908350404843) {
tmp = t_0;
} else if (x <= 2601.5280327281093) {
double t_1 = x / (x + 1.0);
double t_2 = (x + 1.0) / (x + -1.0);
tmp = (pow(t_1, 3.0) - pow(t_2, 3.0)) / (pow(t_1, 2.0) + (fma((x + 1.0), t_2, x) / (x + -1.0)));
} else {
tmp = t_0;
}
return tmp;
}



Bits error versus x
if x < -3606.9083504048431 or 2601.52803272810934 < x Initial program 59.3
Taylor expanded in x around inf 0.3
Simplified0.0
if -3606.9083504048431 < x < 2601.52803272810934Initial program 0.1
Applied div-inv_binary640.1
Applied flip3--_binary640.1
Simplified0.1
Simplified0.1
Applied *-un-lft-identity_binary640.1
Applied *-un-lft-identity_binary640.1
Applied times-frac_binary640.1
Simplified0.1
Simplified0.1
Final simplification0.0
herbie shell --seed 2022104
(FPCore (x)
:name "Asymptote C"
:precision binary64
(- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))