Average Error: 0.0 → 0.0
Time: 13.0s
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 r129903 = 1.0;
        double r129904 = x;
        double r129905 = r129904 - r129903;
        double r129906 = r129903 / r129905;
        double r129907 = r129904 + r129903;
        double r129908 = r129904 / r129907;
        double r129909 = r129906 + r129908;
        return r129909;
}

double f(double x) {
        double r129910 = 1.0;
        double r129911 = x;
        double r129912 = r129911 - r129910;
        double r129913 = r129910 / r129912;
        double r129914 = exp(r129913);
        double r129915 = log(r129914);
        double r129916 = r129911 + r129910;
        double r129917 = r129911 / r129916;
        double r129918 = exp(r129917);
        double r129919 = log(r129918);
        double r129920 = r129915 + r129919;
        return r129920;
}

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 +o rules:numerics
(FPCore (x)
  :name "Asymptote B"
  (+ (/ 1.0 (- x 1.0)) (/ x (+ x 1.0))))