Average Error: 14.4 → 0.1
Time: 15.2s
Precision: 64
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[\frac{\frac{-2}{x + 1}}{x - 1}\]
\frac{1}{x + 1} - \frac{1}{x - 1}
\frac{\frac{-2}{x + 1}}{x - 1}
double f(double x) {
        double r5447032 = 1.0;
        double r5447033 = x;
        double r5447034 = r5447033 + r5447032;
        double r5447035 = r5447032 / r5447034;
        double r5447036 = r5447033 - r5447032;
        double r5447037 = r5447032 / r5447036;
        double r5447038 = r5447035 - r5447037;
        return r5447038;
}

double f(double x) {
        double r5447039 = -2.0;
        double r5447040 = x;
        double r5447041 = 1.0;
        double r5447042 = r5447040 + r5447041;
        double r5447043 = r5447039 / r5447042;
        double r5447044 = r5447040 - r5447041;
        double r5447045 = r5447043 / r5447044;
        return r5447045;
}

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

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

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

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

    \[\leadsto \frac{1}{x \cdot x - 1 \cdot 1} \cdot \color{blue}{-2}\]
  9. Using strategy rm
  10. Applied difference-of-squares0.3

    \[\leadsto \frac{1}{\color{blue}{\left(x + 1\right) \cdot \left(x - 1\right)}} \cdot -2\]
  11. Applied *-un-lft-identity0.3

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

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

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

    \[\leadsto \frac{1}{x + 1} \cdot \color{blue}{\frac{-2}{x - 1}}\]
  15. Using strategy rm
  16. Applied associate-*r/0.1

    \[\leadsto \color{blue}{\frac{\frac{1}{x + 1} \cdot -2}{x - 1}}\]
  17. Simplified0.1

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

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

Reproduce

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