Average Error: 14.5 → 0.1
Time: 12.9s
Precision: 64
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[-\frac{\frac{1}{x + 1}}{x - 1} \cdot 2\]
\frac{1}{x + 1} - \frac{1}{x - 1}
-\frac{\frac{1}{x + 1}}{x - 1} \cdot 2
double f(double x) {
        double r5979172 = 1.0;
        double r5979173 = x;
        double r5979174 = r5979173 + r5979172;
        double r5979175 = r5979172 / r5979174;
        double r5979176 = r5979173 - r5979172;
        double r5979177 = r5979172 / r5979176;
        double r5979178 = r5979175 - r5979177;
        return r5979178;
}

double f(double x) {
        double r5979179 = 1.0;
        double r5979180 = x;
        double r5979181 = r5979180 + r5979179;
        double r5979182 = r5979179 / r5979181;
        double r5979183 = r5979180 - r5979179;
        double r5979184 = r5979182 / r5979183;
        double r5979185 = 2.0;
        double r5979186 = r5979184 * r5979185;
        double r5979187 = -r5979186;
        return r5979187;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 14.5

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

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

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

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

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

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

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

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

Reproduce

herbie shell --seed 2019169 
(FPCore (x)
  :name "Asymptote A"
  (- (/ 1.0 (+ x 1.0)) (/ 1.0 (- x 1.0))))