Average Error: 14.7 → 0.1
Time: 13.2s
Precision: 64
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[1 \cdot \frac{\frac{1 \cdot -2}{x + 1}}{x - 1}\]
\frac{1}{x + 1} - \frac{1}{x - 1}
1 \cdot \frac{\frac{1 \cdot -2}{x + 1}}{x - 1}
double f(double x) {
        double r105387 = 1.0;
        double r105388 = x;
        double r105389 = r105388 + r105387;
        double r105390 = r105387 / r105389;
        double r105391 = r105388 - r105387;
        double r105392 = r105387 / r105391;
        double r105393 = r105390 - r105392;
        return r105393;
}

double f(double x) {
        double r105394 = 1.0;
        double r105395 = -2.0;
        double r105396 = r105394 * r105395;
        double r105397 = x;
        double r105398 = r105397 + r105394;
        double r105399 = r105396 / r105398;
        double r105400 = r105397 - r105394;
        double r105401 = r105399 / r105400;
        double r105402 = r105394 * r105401;
        return r105402;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 14.7

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

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

    \[\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. Using strategy rm
  9. Applied associate--r+12.2

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

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

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

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

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

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

Reproduce

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