Average Error: 0.0 → 0.0
Time: 12.6s
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 r76825 = 1.0;
        double r76826 = x;
        double r76827 = r76826 - r76825;
        double r76828 = r76825 / r76827;
        double r76829 = r76826 + r76825;
        double r76830 = r76826 / r76829;
        double r76831 = r76828 + r76830;
        return r76831;
}

double f(double x) {
        double r76832 = 1.0;
        double r76833 = x;
        double r76834 = r76833 * r76833;
        double r76835 = r76832 * r76832;
        double r76836 = r76834 - r76835;
        double r76837 = r76832 / r76836;
        double r76838 = r76833 + r76832;
        double r76839 = r76833 / r76838;
        double r76840 = fma(r76837, r76838, r76839);
        return r76840;
}

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