Average Error: 0.0 → 0.0
Time: 8.1s
Precision: 64
\[\frac{1}{x - 1} + \frac{x}{x + 1}\]
\[\log \left(e^{\frac{1}{x - 1} + \frac{x}{x + 1}}\right)\]
\frac{1}{x - 1} + \frac{x}{x + 1}
\log \left(e^{\frac{1}{x - 1} + \frac{x}{x + 1}}\right)
double f(double x) {
        double r2557447 = 1.0;
        double r2557448 = x;
        double r2557449 = r2557448 - r2557447;
        double r2557450 = r2557447 / r2557449;
        double r2557451 = r2557448 + r2557447;
        double r2557452 = r2557448 / r2557451;
        double r2557453 = r2557450 + r2557452;
        return r2557453;
}

double f(double x) {
        double r2557454 = 1.0;
        double r2557455 = x;
        double r2557456 = r2557455 - r2557454;
        double r2557457 = r2557454 / r2557456;
        double r2557458 = r2557455 + r2557454;
        double r2557459 = r2557455 / r2557458;
        double r2557460 = r2557457 + r2557459;
        double r2557461 = exp(r2557460);
        double r2557462 = log(r2557461);
        return r2557462;
}

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

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

Reproduce

herbie shell --seed 2019152 
(FPCore (x)
  :name "Asymptote B"
  (+ (/ 1 (- x 1)) (/ x (+ x 1))))