Average Error: 14.4 → 0.1
Time: 2.9s
Precision: 64
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[1 \cdot \frac{\frac{-2}{x + 1}}{x - 1}\]
\frac{1}{x + 1} - \frac{1}{x - 1}
1 \cdot \frac{\frac{-2}{x + 1}}{x - 1}
double f(double x) {
        double r131557 = 1.0;
        double r131558 = x;
        double r131559 = r131558 + r131557;
        double r131560 = r131557 / r131559;
        double r131561 = r131558 - r131557;
        double r131562 = r131557 / r131561;
        double r131563 = r131560 - r131562;
        return r131563;
}

double f(double x) {
        double r131564 = 1.0;
        double r131565 = 2.0;
        double r131566 = -r131565;
        double r131567 = x;
        double r131568 = r131567 + r131564;
        double r131569 = r131566 / r131568;
        double r131570 = r131567 - r131564;
        double r131571 = r131569 / r131570;
        double r131572 = r131564 * r131571;
        return r131572;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 14.4

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

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

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

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

    \[\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--13.8

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

    \[\leadsto \frac{1}{x \cdot x - 1 \cdot 1} \cdot \color{blue}{\left(-2\right)}\]
  9. Using strategy rm
  10. Applied div-inv0.4

    \[\leadsto \color{blue}{\left(1 \cdot \frac{1}{x \cdot x - 1 \cdot 1}\right)} \cdot \left(-2\right)\]
  11. Applied associate-*l*0.4

    \[\leadsto \color{blue}{1 \cdot \left(\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(-2\right)\right)}\]
  12. Simplified0.1

    \[\leadsto 1 \cdot \color{blue}{\frac{\frac{-2}{x + 1}}{x - 1}}\]
  13. Final simplification0.1

    \[\leadsto 1 \cdot \frac{\frac{-2}{x + 1}}{x - 1}\]

Reproduce

herbie shell --seed 2019354 
(FPCore (x)
  :name "Asymptote A"
  :precision binary64
  (- (/ 1 (+ x 1)) (/ 1 (- x 1))))