Average Error: 14.3 → 0.1
Time: 11.5s
Precision: 64
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[\frac{\frac{1}{x + 1}}{x - 1} \cdot \left(-2\right)\]
\frac{1}{x + 1} - \frac{1}{x - 1}
\frac{\frac{1}{x + 1}}{x - 1} \cdot \left(-2\right)
double f(double x) {
        double r85572 = 1.0;
        double r85573 = x;
        double r85574 = r85573 + r85572;
        double r85575 = r85572 / r85574;
        double r85576 = r85573 - r85572;
        double r85577 = r85572 / r85576;
        double r85578 = r85575 - r85577;
        return r85578;
}

double f(double x) {
        double r85579 = 1.0;
        double r85580 = x;
        double r85581 = r85580 + r85579;
        double r85582 = r85579 / r85581;
        double r85583 = r85580 - r85579;
        double r85584 = r85582 / r85583;
        double r85585 = 2.0;
        double r85586 = -r85585;
        double r85587 = r85584 * r85586;
        return r85587;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 14.3

    \[\frac{1}{x + 1} - \frac{1}{x - 1}\]
  2. Using strategy rm
  3. Applied add-cube-cbrt25.8

    \[\leadsto \frac{1}{x + 1} - \color{blue}{\left(\sqrt[3]{\frac{1}{x - 1}} \cdot \sqrt[3]{\frac{1}{x - 1}}\right) \cdot \sqrt[3]{\frac{1}{x - 1}}}\]
  4. Applied flip-+28.8

    \[\leadsto \frac{1}{\color{blue}{\frac{x \cdot x - 1 \cdot 1}{x - 1}}} - \left(\sqrt[3]{\frac{1}{x - 1}} \cdot \sqrt[3]{\frac{1}{x - 1}}\right) \cdot \sqrt[3]{\frac{1}{x - 1}}\]
  5. Applied associate-/r/28.8

    \[\leadsto \color{blue}{\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x - 1\right)} - \left(\sqrt[3]{\frac{1}{x - 1}} \cdot \sqrt[3]{\frac{1}{x - 1}}\right) \cdot \sqrt[3]{\frac{1}{x - 1}}\]
  6. Applied prod-diff28.9

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{x \cdot x - 1 \cdot 1}, x - 1, -\sqrt[3]{\frac{1}{x - 1}} \cdot \left(\sqrt[3]{\frac{1}{x - 1}} \cdot \sqrt[3]{\frac{1}{x - 1}}\right)\right) + \mathsf{fma}\left(-\sqrt[3]{\frac{1}{x - 1}}, \sqrt[3]{\frac{1}{x - 1}} \cdot \sqrt[3]{\frac{1}{x - 1}}, \sqrt[3]{\frac{1}{x - 1}} \cdot \left(\sqrt[3]{\frac{1}{x - 1}} \cdot \sqrt[3]{\frac{1}{x - 1}}\right)\right)}\]
  7. Simplified27.8

    \[\leadsto \color{blue}{\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(\left(x - 1\right) - \left(x + 1\right)\right)} + \mathsf{fma}\left(-\sqrt[3]{\frac{1}{x - 1}}, \sqrt[3]{\frac{1}{x - 1}} \cdot \sqrt[3]{\frac{1}{x - 1}}, \sqrt[3]{\frac{1}{x - 1}} \cdot \left(\sqrt[3]{\frac{1}{x - 1}} \cdot \sqrt[3]{\frac{1}{x - 1}}\right)\right)\]
  8. Simplified13.7

    \[\leadsto \frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(\left(x - 1\right) - \left(x + 1\right)\right) + \color{blue}{0}\]
  9. Taylor expanded around 0 0.4

    \[\leadsto \frac{1}{x \cdot x - 1 \cdot 1} \cdot \color{blue}{\left(-2\right)} + 0\]
  10. Using strategy rm
  11. Applied difference-of-squares0.4

    \[\leadsto \frac{1}{\color{blue}{\left(x + 1\right) \cdot \left(x - 1\right)}} \cdot \left(-2\right) + 0\]
  12. Applied associate-/r*0.1

    \[\leadsto \color{blue}{\frac{\frac{1}{x + 1}}{x - 1}} \cdot \left(-2\right) + 0\]
  13. Final simplification0.1

    \[\leadsto \frac{\frac{1}{x + 1}}{x - 1} \cdot \left(-2\right)\]

Reproduce

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