Average Error: 15.2 → 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 r41953004 = 1.0;
        double r41953005 = x;
        double r41953006 = r41953005 + r41953004;
        double r41953007 = r41953004 / r41953006;
        double r41953008 = r41953005 - r41953004;
        double r41953009 = r41953004 / r41953008;
        double r41953010 = r41953007 - r41953009;
        return r41953010;
}

double f(double x) {
        double r41953011 = 1.0;
        double r41953012 = x;
        double r41953013 = -1.0;
        double r41953014 = fma(r41953012, r41953012, r41953013);
        double r41953015 = r41953011 / r41953014;
        double r41953016 = -2.0;
        double r41953017 = r41953015 * r41953016;
        return r41953017;
}

\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 15.2

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

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

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

    \[\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/15.2

    \[\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.6

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

    \[\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 2019101 +o rules:numerics
(FPCore (x)
  :name "Asymptote A"
  (- (/ 1 (+ x 1)) (/ 1 (- x 1))))