Average Error: 14.9 → 0.1
Time: 8.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 r4852261 = 1.0;
        double r4852262 = x;
        double r4852263 = r4852262 + r4852261;
        double r4852264 = r4852261 / r4852263;
        double r4852265 = r4852262 - r4852261;
        double r4852266 = r4852261 / r4852265;
        double r4852267 = r4852264 - r4852266;
        return r4852267;
}

double f(double x) {
        double r4852268 = 1.0;
        double r4852269 = x;
        double r4852270 = r4852269 + r4852268;
        double r4852271 = r4852268 / r4852270;
        double r4852272 = r4852269 - r4852268;
        double r4852273 = r4852271 / r4852272;
        double r4852274 = -2.0;
        double r4852275 = r4852273 * r4852274;
        return r4852275;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 14.9

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(\left(x - 1\right) - \left(x + 1\right)\right)}\]
  8. Simplified14.3

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

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

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

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

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

Reproduce

herbie shell --seed 2019165 
(FPCore (x)
  :name "Asymptote A"
  (- (/ 1 (+ x 1)) (/ 1 (- x 1))))