Average Error: 0.0 → 0.0
Time: 6.8s
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 r75660 = 1.0;
        double r75661 = x;
        double r75662 = r75661 - r75660;
        double r75663 = r75660 / r75662;
        double r75664 = r75661 + r75660;
        double r75665 = r75661 / r75664;
        double r75666 = r75663 + r75665;
        return r75666;
}

double f(double x) {
        double r75667 = 1.0;
        double r75668 = x;
        double r75669 = r75668 * r75668;
        double r75670 = r75667 * r75667;
        double r75671 = r75669 - r75670;
        double r75672 = r75667 / r75671;
        double r75673 = r75668 + r75667;
        double r75674 = r75668 / r75673;
        double r75675 = fma(r75672, r75673, r75674);
        return r75675;
}

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