\frac{x}{x + 1} - \frac{x + 1}{x - 1}\begin{array}{l}
\mathbf{if}\;\frac{x}{x + 1} - \frac{x + 1}{x - 1} \leq 0:\\
\;\;\;\;\frac{-1}{x \cdot x} - \left(\frac{3}{x} + \frac{3}{{x}^{3}}\right)\\
\mathbf{else}:\\
\;\;\;\;{e}^{\log \left(\frac{x}{x + 1} - \frac{x + 1}{x - 1}\right)}\\
\end{array}(FPCore (x) :precision binary64 (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))
(FPCore (x) :precision binary64 (if (<= (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))) 0.0) (- (/ -1.0 (* x x)) (+ (/ 3.0 x) (/ 3.0 (pow x 3.0)))) (pow E (log (- (/ 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 / (x + 1.0)) - ((x + 1.0) / (x - 1.0))) <= 0.0) {
tmp = (-1.0 / (x * x)) - ((3.0 / x) + (3.0 / pow(x, 3.0)));
} else {
tmp = pow(((double) M_E), log((x / (x + 1.0)) - ((x + 1.0) / (x - 1.0))));
}
return tmp;
}



Bits error versus x
Results
if (-.f64 (/.f64 x (+.f64 x 1)) (/.f64 (+.f64 x 1) (-.f64 x 1))) < 0.0Initial program 59.3
Taylor expanded around inf 0.6
Simplified0.3
if 0.0 < (-.f64 (/.f64 x (+.f64 x 1)) (/.f64 (+.f64 x 1) (-.f64 x 1))) Initial program 0.5
rmApplied add-exp-log_binary64_14800.5
rmApplied pow1_binary64_15030.5
Applied log-pow_binary64_15310.5
Applied exp-prod_binary64_14940.5
Simplified0.5
Final simplification0.4
herbie shell --seed 2020298
(FPCore (x)
:name "Asymptote C"
:precision binary64
(- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))