Average Error: 0.0 → 0.0
Time: 9.8s
Precision: 64
\[\frac{1}{x - 1} + \frac{x}{x + 1}\]
\[\log \left(e^{\frac{x}{1 + x} + \frac{1}{x - 1}}\right)\]
\frac{1}{x - 1} + \frac{x}{x + 1}
\log \left(e^{\frac{x}{1 + x} + \frac{1}{x - 1}}\right)
double f(double x) {
        double r4007168 = 1.0;
        double r4007169 = x;
        double r4007170 = r4007169 - r4007168;
        double r4007171 = r4007168 / r4007170;
        double r4007172 = r4007169 + r4007168;
        double r4007173 = r4007169 / r4007172;
        double r4007174 = r4007171 + r4007173;
        return r4007174;
}

double f(double x) {
        double r4007175 = x;
        double r4007176 = 1.0;
        double r4007177 = r4007176 + r4007175;
        double r4007178 = r4007175 / r4007177;
        double r4007179 = r4007175 - r4007176;
        double r4007180 = r4007176 / r4007179;
        double r4007181 = r4007178 + r4007180;
        double r4007182 = exp(r4007181);
        double r4007183 = log(r4007182);
        return r4007183;
}

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{x}{x + 1} + \frac{1}{x - 1}}\right)}\]
  7. Final simplification0.0

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

Reproduce

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