\frac{x}{x + 1} - \frac{x + 1}{x - 1}\begin{array}{l}
\mathbf{if}\;\frac{x}{x + 1} - \frac{x + 1}{x - 1} \le 4.962696920074449735693633556365966796875 \cdot 10^{-13}:\\
\;\;\;\;-\left(\left(\frac{3}{x} + \frac{1}{x \cdot x}\right) + \frac{3}{{x}^{3}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1} - \frac{x + 1}{x - 1}\\
\end{array}double f(double x) {
double r95754 = x;
double r95755 = 1.0;
double r95756 = r95754 + r95755;
double r95757 = r95754 / r95756;
double r95758 = r95754 - r95755;
double r95759 = r95756 / r95758;
double r95760 = r95757 - r95759;
return r95760;
}
double f(double x) {
double r95761 = x;
double r95762 = 1.0;
double r95763 = r95761 + r95762;
double r95764 = r95761 / r95763;
double r95765 = r95761 - r95762;
double r95766 = r95763 / r95765;
double r95767 = r95764 - r95766;
double r95768 = 4.96269692007445e-13;
bool r95769 = r95767 <= r95768;
double r95770 = 3.0;
double r95771 = r95770 / r95761;
double r95772 = r95761 * r95761;
double r95773 = r95762 / r95772;
double r95774 = r95771 + r95773;
double r95775 = 3.0;
double r95776 = pow(r95761, r95775);
double r95777 = r95770 / r95776;
double r95778 = r95774 + r95777;
double r95779 = -r95778;
double r95780 = r95769 ? r95779 : r95767;
return r95780;
}



Bits error versus x
Results
if (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))) < 4.96269692007445e-13Initial program 59.4
rmApplied add-log-exp59.4
Applied add-log-exp59.4
Applied diff-log59.4
Simplified59.4
rmApplied flip3--59.4
Simplified61.7
Taylor expanded around inf 0.6
Simplified0.3
if 4.96269692007445e-13 < (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))) Initial program 0.3
rmApplied add-log-exp0.3
Applied add-log-exp0.3
Applied diff-log0.3
Simplified0.3
rmApplied pow10.3
Applied log-pow0.3
Simplified0.3
Final simplification0.3
herbie shell --seed 2019323
(FPCore (x)
:name "Asymptote C"
:precision binary64
(- (/ x (+ x 1)) (/ (+ x 1) (- x 1))))