Average Error: 0.0 → 0.0
Time: 11.5s
Precision: 64
\[\frac{1}{x - 1} + \frac{x}{x + 1}\]
\[\log \left(e^{\frac{1}{x - 1}}\right) + \log \left(e^{\frac{x}{x + 1}}\right)\]
\frac{1}{x - 1} + \frac{x}{x + 1}
\log \left(e^{\frac{1}{x - 1}}\right) + \log \left(e^{\frac{x}{x + 1}}\right)
double f(double x) {
        double r190627 = 1.0;
        double r190628 = x;
        double r190629 = r190628 - r190627;
        double r190630 = r190627 / r190629;
        double r190631 = r190628 + r190627;
        double r190632 = r190628 / r190631;
        double r190633 = r190630 + r190632;
        return r190633;
}

double f(double x) {
        double r190634 = 1.0;
        double r190635 = x;
        double r190636 = r190635 - r190634;
        double r190637 = r190634 / r190636;
        double r190638 = exp(r190637);
        double r190639 = log(r190638);
        double r190640 = r190635 + r190634;
        double r190641 = r190635 / r190640;
        double r190642 = exp(r190641);
        double r190643 = log(r190642);
        double r190644 = r190639 + r190643;
        return r190644;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[\frac{1}{x - 1} + \frac{x}{x + 1}\]
  2. Using strategy rm
  3. Applied add-log-exp0.0

    \[\leadsto \color{blue}{\log \left(e^{\frac{1}{x - 1}}\right)} + \frac{x}{x + 1}\]
  4. Using strategy rm
  5. Applied add-log-exp0.0

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

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

Reproduce

herbie shell --seed 2019194 
(FPCore (x)
  :name "Asymptote B"
  (+ (/ 1.0 (- x 1.0)) (/ x (+ x 1.0))))