Average Error: 14.5 → 0.4
Time: 15.4s
Precision: 64
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[\frac{\frac{1}{\sqrt{x \cdot x} + 1} \cdot -2}{\sqrt{x \cdot x} - 1}\]
\frac{1}{x + 1} - \frac{1}{x - 1}
\frac{\frac{1}{\sqrt{x \cdot x} + 1} \cdot -2}{\sqrt{x \cdot x} - 1}
double f(double x) {
        double r7005427 = 1.0;
        double r7005428 = x;
        double r7005429 = r7005428 + r7005427;
        double r7005430 = r7005427 / r7005429;
        double r7005431 = r7005428 - r7005427;
        double r7005432 = r7005427 / r7005431;
        double r7005433 = r7005430 - r7005432;
        return r7005433;
}

double f(double x) {
        double r7005434 = 1.0;
        double r7005435 = x;
        double r7005436 = r7005435 * r7005435;
        double r7005437 = sqrt(r7005436);
        double r7005438 = r7005437 + r7005434;
        double r7005439 = r7005434 / r7005438;
        double r7005440 = -2.0;
        double r7005441 = r7005439 * r7005440;
        double r7005442 = r7005437 - r7005434;
        double r7005443 = r7005441 / r7005442;
        return r7005443;
}

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

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

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

    \[\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}{-2}\]
  9. Using strategy rm
  10. Applied add-sqr-sqrt0.4

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

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

    \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{x \cdot x} + 1}}{\sqrt{x \cdot x} - 1}} \cdot -2\]
  13. Applied associate-*l/0.4

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

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

Reproduce

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