Average Error: 0.0 → 0.0
Time: 2.2s
Precision: 64
\[\frac{1}{x - 1} + \frac{x}{x + 1}\]
\[\mathsf{fma}\left(\frac{1}{x \cdot x - 1 \cdot 1}, x + 1, \frac{x}{x + 1}\right)\]
\frac{1}{x - 1} + \frac{x}{x + 1}
\mathsf{fma}\left(\frac{1}{x \cdot x - 1 \cdot 1}, x + 1, \frac{x}{x + 1}\right)
double f(double x) {
        double r121393 = 1.0;
        double r121394 = x;
        double r121395 = r121394 - r121393;
        double r121396 = r121393 / r121395;
        double r121397 = r121394 + r121393;
        double r121398 = r121394 / r121397;
        double r121399 = r121396 + r121398;
        return r121399;
}

double f(double x) {
        double r121400 = 1.0;
        double r121401 = x;
        double r121402 = r121401 * r121401;
        double r121403 = r121400 * r121400;
        double r121404 = r121402 - r121403;
        double r121405 = r121400 / r121404;
        double r121406 = r121401 + r121400;
        double r121407 = r121401 / r121406;
        double r121408 = fma(r121405, r121406, r121407);
        return r121408;
}

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. Applied fma-def0.0

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

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

Reproduce

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