Average Error: 0.0 → 0.0
Time: 8.2s
Precision: 64
\[\frac{1}{x - 1} + \frac{x}{x + 1}\]
\[\frac{1 \cdot \left(x + 1\right)}{x \cdot x - 1 \cdot 1} + \frac{x}{x + 1}\]
\frac{1}{x - 1} + \frac{x}{x + 1}
\frac{1 \cdot \left(x + 1\right)}{x \cdot x - 1 \cdot 1} + \frac{x}{x + 1}
double f(double x) {
        double r3590075 = 1.0;
        double r3590076 = x;
        double r3590077 = r3590076 - r3590075;
        double r3590078 = r3590075 / r3590077;
        double r3590079 = r3590076 + r3590075;
        double r3590080 = r3590076 / r3590079;
        double r3590081 = r3590078 + r3590080;
        return r3590081;
}

double f(double x) {
        double r3590082 = 1.0;
        double r3590083 = x;
        double r3590084 = r3590083 + r3590082;
        double r3590085 = r3590082 * r3590084;
        double r3590086 = r3590083 * r3590083;
        double r3590087 = r3590082 * r3590082;
        double r3590088 = r3590086 - r3590087;
        double r3590089 = r3590085 / r3590088;
        double r3590090 = r3590083 / r3590084;
        double r3590091 = r3590089 + r3590090;
        return r3590091;
}

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 flip--0.0

    \[\leadsto \frac{1}{\color{blue}{\frac{x \cdot x - 1 \cdot 1}{x + 1}}} + \frac{x}{x + 1}\]
  4. Applied associate-/r/0.0

    \[\leadsto \color{blue}{\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right)} + \frac{x}{x + 1}\]
  5. Using strategy rm
  6. Applied associate-*l/0.0

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

    \[\leadsto \frac{1 \cdot \left(x + 1\right)}{x \cdot x - 1 \cdot 1} + \frac{x}{x + 1}\]

Reproduce

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