Average Error: 0.0 → 0.0
Time: 16.1s
Precision: 64
\[\frac{1}{x - 1} + \frac{x}{x + 1}\]
\[\frac{1}{x \cdot x - 1} \cdot \left(x + 1\right) + \frac{x}{x + 1}\]
double f(double x) {
        double r36616903 = 1.0;
        double r36616904 = x;
        double r36616905 = r36616904 - r36616903;
        double r36616906 = r36616903 / r36616905;
        double r36616907 = r36616904 + r36616903;
        double r36616908 = r36616904 / r36616907;
        double r36616909 = r36616906 + r36616908;
        return r36616909;
}

double f(double x) {
        double r36616910 = 1.0;
        double r36616911 = x;
        double r36616912 = r36616911 * r36616911;
        double r36616913 = r36616912 - r36616910;
        double r36616914 = r36616910 / r36616913;
        double r36616915 = r36616911 + r36616910;
        double r36616916 = r36616914 * r36616915;
        double r36616917 = r36616911 / r36616915;
        double r36616918 = r36616916 + r36616917;
        return r36616918;
}

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

Error

Bits error versus x

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. Final simplification0.0

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

Reproduce

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