Average Error: 14.7 → 0.3
Time: 3.9m
Precision: 64
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[\frac{1}{(x \cdot x + -1)_*} \cdot -2\]
double f(double x) {
        double r31731757 = 1.0;
        double r31731758 = x;
        double r31731759 = r31731758 + r31731757;
        double r31731760 = r31731757 / r31731759;
        double r31731761 = r31731758 - r31731757;
        double r31731762 = r31731757 / r31731761;
        double r31731763 = r31731760 - r31731762;
        return r31731763;
}

double f(double x) {
        double r31731764 = 1.0;
        double r31731765 = x;
        double r31731766 = -1.0;
        double r31731767 = fma(r31731765, r31731765, r31731766);
        double r31731768 = r31731764 / r31731767;
        double r31731769 = -2.0;
        double r31731770 = r31731768 * r31731769;
        return r31731770;
}

\frac{1}{x + 1} - \frac{1}{x - 1}
\frac{1}{(x \cdot x + -1)_*} \cdot -2

Error

Bits error versus x

Derivation

  1. Initial program 14.7

    \[\frac{1}{x + 1} - \frac{1}{x - 1}\]
  2. Using strategy rm
  3. Applied flip--29.3

    \[\leadsto \frac{1}{x + 1} - \frac{1}{\color{blue}{\frac{x \cdot x - 1 \cdot 1}{x + 1}}}\]
  4. Applied associate-/r/29.3

    \[\leadsto \frac{1}{x + 1} - \color{blue}{\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right)}\]
  5. Applied flip-+14.7

    \[\leadsto \frac{1}{\color{blue}{\frac{x \cdot x - 1 \cdot 1}{x - 1}}} - \frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right)\]
  6. Applied associate-/r/14.7

    \[\leadsto \color{blue}{\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x - 1\right)} - \frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right)\]
  7. Applied distribute-lft-out--14.1

    \[\leadsto \color{blue}{\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(\left(x - 1\right) - \left(x + 1\right)\right)}\]
  8. Simplified14.1

    \[\leadsto \color{blue}{\frac{1}{(x \cdot x + -1)_*}} \cdot \left(\left(x - 1\right) - \left(x + 1\right)\right)\]
  9. Simplified0.3

    \[\leadsto \frac{1}{(x \cdot x + -1)_*} \cdot \color{blue}{-2}\]
  10. Final simplification0.3

    \[\leadsto \frac{1}{(x \cdot x + -1)_*} \cdot -2\]

Reproduce

herbie shell --seed 2019102 +o rules:numerics
(FPCore (x)
  :name "Asymptote A"
  (- (/ 1 (+ x 1)) (/ 1 (- x 1))))