Average Error: 14.4 → 0.1
Time: 23.0s
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 r3753321 = 1.0;
        double r3753322 = x;
        double r3753323 = r3753322 + r3753321;
        double r3753324 = r3753321 / r3753323;
        double r3753325 = r3753322 - r3753321;
        double r3753326 = r3753321 / r3753325;
        double r3753327 = r3753324 - r3753326;
        return r3753327;
}

double f(double x) {
        double r3753328 = 1.0;
        double r3753329 = x;
        double r3753330 = r3753329 + r3753328;
        double r3753331 = r3753328 / r3753330;
        double r3753332 = r3753329 - r3753328;
        double r3753333 = r3753331 / r3753332;
        double r3753334 = -2.0;
        double r3753335 = r3753333 * r3753334;
        return r3753335;
}

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

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

    \[\leadsto \frac{1}{x + 1} - \color{blue}{\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right)}\]
  5. Applied flip-+14.4

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

    \[\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 difference-of-squares13.7

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

    \[\leadsto \color{blue}{\frac{\frac{1}{x + 1}}{x - 1}} \cdot \left(\left(x - 1\right) - \left(x + 1\right)\right)\]
  11. Taylor expanded around 0 0.1

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

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

Reproduce

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