\frac{x}{x + 1} - \frac{x + 1}{x - 1}
\begin{array}{l}
t_0 := \frac{x + 1}{x - 1}\\
t_1 := \frac{x}{x + 1} - t_0\\
\mathbf{if}\;t_1 \leq 5.53872836484004 \cdot 10^{-10}:\\
\;\;\;\;\left(\frac{-3}{x} - {x}^{-2}\right) + -3 \cdot {x}^{-3}\\
\mathbf{else}:\\
\;\;\;\;t_1 + \mathsf{fma}\left(\frac{-1}{x - 1}, x + 1, t_0\right)\\
\end{array}
(FPCore (x) :precision binary64 (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))
(FPCore (x)
:precision binary64
(let* ((t_0 (/ (+ x 1.0) (- x 1.0))) (t_1 (- (/ x (+ x 1.0)) t_0)))
(if (<= t_1 5.53872836484004e-10)
(+ (- (/ -3.0 x) (pow x -2.0)) (* -3.0 (pow x -3.0)))
(+ t_1 (fma (/ -1.0 (- x 1.0)) (+ 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 = (x + 1.0) / (x - 1.0);
double t_1 = (x / (x + 1.0)) - t_0;
double tmp;
if (t_1 <= 5.53872836484004e-10) {
tmp = ((-3.0 / x) - pow(x, -2.0)) + (-3.0 * pow(x, -3.0));
} else {
tmp = t_1 + fma((-1.0 / (x - 1.0)), (x + 1.0), t_0);
}
return tmp;
}



Bits error versus x
if (-.f64 (/.f64 x (+.f64 x 1)) (/.f64 (+.f64 x 1) (-.f64 x 1))) < 5.53872836e-10Initial program 59.4
Taylor expanded in x around inf 0.6
Simplified0.3
Applied egg-rr0.3
if 5.53872836e-10 < (-.f64 (/.f64 x (+.f64 x 1)) (/.f64 (+.f64 x 1) (-.f64 x 1))) Initial program 0.2
Applied egg-rr0.2
Final simplification0.2
herbie shell --seed 2022130
(FPCore (x)
:name "Asymptote C"
:precision binary64
(- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))