Average Error: 0.0 → 0.0
Time: 23.0s
Precision: 64
\[\frac{1}{x - 1} + \frac{x}{x + 1}\]
\[\log \left(e^{\frac{1}{x - 1} + \frac{x}{1 + x}}\right)\]
\frac{1}{x - 1} + \frac{x}{x + 1}
\log \left(e^{\frac{1}{x - 1} + \frac{x}{1 + x}}\right)
double f(double x) {
        double r5430975 = 1.0;
        double r5430976 = x;
        double r5430977 = r5430976 - r5430975;
        double r5430978 = r5430975 / r5430977;
        double r5430979 = r5430976 + r5430975;
        double r5430980 = r5430976 / r5430979;
        double r5430981 = r5430978 + r5430980;
        return r5430981;
}

double f(double x) {
        double r5430982 = 1.0;
        double r5430983 = x;
        double r5430984 = r5430983 - r5430982;
        double r5430985 = r5430982 / r5430984;
        double r5430986 = r5430982 + r5430983;
        double r5430987 = r5430983 / r5430986;
        double r5430988 = r5430985 + r5430987;
        double r5430989 = exp(r5430988);
        double r5430990 = log(r5430989);
        return r5430990;
}

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 \frac{1}{x - 1} + \color{blue}{\log \left(e^{\frac{x}{x + 1}}\right)}\]
  4. Applied add-log-exp0.0

    \[\leadsto \color{blue}{\log \left(e^{\frac{1}{x - 1}}\right)} + \log \left(e^{\frac{x}{x + 1}}\right)\]
  5. Applied sum-log0.0

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

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

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

Reproduce

herbie shell --seed 2019200 +o rules:numerics
(FPCore (x)
  :name "Asymptote B"
  (+ (/ 1.0 (- x 1.0)) (/ x (+ x 1.0))))