Average Error: 14.7 → 0.1
Time: 13.4s
Precision: 64
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[\frac{\frac{-2}{x + 1}}{x - 1} \cdot 1\]
\frac{1}{x + 1} - \frac{1}{x - 1}
\frac{\frac{-2}{x + 1}}{x - 1} \cdot 1
double f(double x) {
        double r4468033 = 1.0;
        double r4468034 = x;
        double r4468035 = r4468034 + r4468033;
        double r4468036 = r4468033 / r4468035;
        double r4468037 = r4468034 - r4468033;
        double r4468038 = r4468033 / r4468037;
        double r4468039 = r4468036 - r4468038;
        return r4468039;
}

double f(double x) {
        double r4468040 = 2.0;
        double r4468041 = -r4468040;
        double r4468042 = x;
        double r4468043 = 1.0;
        double r4468044 = r4468042 + r4468043;
        double r4468045 = r4468041 / r4468044;
        double r4468046 = r4468042 - r4468043;
        double r4468047 = r4468045 / r4468046;
        double r4468048 = r4468047 * r4468043;
        return r4468048;
}

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--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.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. Taylor expanded around 0 0.3

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

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

    \[\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}{1 + x}}{x - 1}}\]
  13. Final simplification0.1

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

Reproduce

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