Average Error: 0.0 → 0.0
Time: 6.7s
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 r72051 = 1.0;
        double r72052 = x;
        double r72053 = r72052 - r72051;
        double r72054 = r72051 / r72053;
        double r72055 = r72052 + r72051;
        double r72056 = r72052 / r72055;
        double r72057 = r72054 + r72056;
        return r72057;
}

double f(double x) {
        double r72058 = 1.0;
        double r72059 = x;
        double r72060 = r72059 * r72059;
        double r72061 = r72058 * r72058;
        double r72062 = r72060 - r72061;
        double r72063 = r72058 / r72062;
        double r72064 = r72059 + r72058;
        double r72065 = r72059 / r72064;
        double r72066 = fma(r72063, r72064, r72065);
        return r72066;
}

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 2020043 +o rules:numerics
(FPCore (x)
  :name "Asymptote B"
  :precision binary64
  (+ (/ 1 (- x 1)) (/ x (+ x 1))))