Average Error: 14.4 → 0.1
Time: 9.9s
Precision: 64
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[\frac{\frac{1}{x + 1}}{x - 1} \cdot \log \left(\frac{e^{-1}}{e^{1}}\right)\]
\frac{1}{x + 1} - \frac{1}{x - 1}
\frac{\frac{1}{x + 1}}{x - 1} \cdot \log \left(\frac{e^{-1}}{e^{1}}\right)
double f(double x) {
        double r133650 = 1.0;
        double r133651 = x;
        double r133652 = r133651 + r133650;
        double r133653 = r133650 / r133652;
        double r133654 = r133651 - r133650;
        double r133655 = r133650 / r133654;
        double r133656 = r133653 - r133655;
        return r133656;
}

double f(double x) {
        double r133657 = 1.0;
        double r133658 = x;
        double r133659 = r133658 + r133657;
        double r133660 = r133657 / r133659;
        double r133661 = r133658 - r133657;
        double r133662 = r133660 / r133661;
        double r133663 = -r133657;
        double r133664 = exp(r133663);
        double r133665 = exp(r133657);
        double r133666 = r133664 / r133665;
        double r133667 = log(r133666);
        double r133668 = r133662 * r133667;
        return r133668;
}

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

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

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

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

    \[\leadsto \frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(\left(x - 1\right) - \left(x + \color{blue}{\log \left(e^{1}\right)}\right)\right)\]
  10. Applied add-log-exp31.1

    \[\leadsto \frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(\left(x - 1\right) - \left(\color{blue}{\log \left(e^{x}\right)} + \log \left(e^{1}\right)\right)\right)\]
  11. Applied sum-log31.1

    \[\leadsto \frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(\left(x - 1\right) - \color{blue}{\log \left(e^{x} \cdot e^{1}\right)}\right)\]
  12. Applied add-log-exp31.1

    \[\leadsto \frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(\left(x - \color{blue}{\log \left(e^{1}\right)}\right) - \log \left(e^{x} \cdot e^{1}\right)\right)\]
  13. Applied add-log-exp31.1

    \[\leadsto \frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(\left(\color{blue}{\log \left(e^{x}\right)} - \log \left(e^{1}\right)\right) - \log \left(e^{x} \cdot e^{1}\right)\right)\]
  14. Applied diff-log31.1

    \[\leadsto \frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(\color{blue}{\log \left(\frac{e^{x}}{e^{1}}\right)} - \log \left(e^{x} \cdot e^{1}\right)\right)\]
  15. Applied diff-log31.1

    \[\leadsto \frac{1}{x \cdot x - 1 \cdot 1} \cdot \color{blue}{\log \left(\frac{\frac{e^{x}}{e^{1}}}{e^{x} \cdot e^{1}}\right)}\]
  16. Simplified0.3

    \[\leadsto \frac{1}{x \cdot x - 1 \cdot 1} \cdot \log \color{blue}{\left(\frac{e^{-1}}{e^{1}}\right)}\]
  17. Using strategy rm
  18. Applied difference-of-squares0.3

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

    \[\leadsto \color{blue}{\frac{\frac{1}{x + 1}}{x - 1}} \cdot \log \left(\frac{e^{-1}}{e^{1}}\right)\]
  20. Final simplification0.1

    \[\leadsto \frac{\frac{1}{x + 1}}{x - 1} \cdot \log \left(\frac{e^{-1}}{e^{1}}\right)\]

Reproduce

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