Average Error: 0.0 → 0.0
Time: 12.6s
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 r127451 = 1.0;
        double r127452 = x;
        double r127453 = r127452 - r127451;
        double r127454 = r127451 / r127453;
        double r127455 = r127452 + r127451;
        double r127456 = r127452 / r127455;
        double r127457 = r127454 + r127456;
        return r127457;
}

double f(double x) {
        double r127458 = 1.0;
        double r127459 = x;
        double r127460 = r127459 - r127458;
        double r127461 = r127458 / r127460;
        double r127462 = exp(r127461);
        double r127463 = log(r127462);
        double r127464 = r127459 + r127458;
        double r127465 = r127459 / r127464;
        double r127466 = exp(r127465);
        double r127467 = log(r127466);
        double r127468 = r127463 + r127467;
        return r127468;
}

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))))