Average Error: 14.7 → 0.1
Time: 12.4s
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 r115980 = 1.0;
        double r115981 = x;
        double r115982 = r115981 + r115980;
        double r115983 = r115980 / r115982;
        double r115984 = r115981 - r115980;
        double r115985 = r115980 / r115984;
        double r115986 = r115983 - r115985;
        return r115986;
}

double f(double x) {
        double r115987 = 1.0;
        double r115988 = -2.0;
        double r115989 = r115987 * r115988;
        double r115990 = x;
        double r115991 = r115990 + r115987;
        double r115992 = r115989 / r115991;
        double r115993 = r115990 - r115987;
        double r115994 = r115992 / r115993;
        double r115995 = r115987 * r115994;
        return r115995;
}

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))))