Average Error: 0.0 → 0.0
Time: 2.3s
Precision: 64
\[\left(x \cdot y + x\right) + y\]
\[\mathsf{fma}\left(x, y, x\right) + y\]
\left(x \cdot y + x\right) + y
\mathsf{fma}\left(x, y, x\right) + y
double f(double x, double y) {
        double r58762 = x;
        double r58763 = y;
        double r58764 = r58762 * r58763;
        double r58765 = r58764 + r58762;
        double r58766 = r58765 + r58763;
        return r58766;
}

double f(double x, double y) {
        double r58767 = x;
        double r58768 = y;
        double r58769 = fma(r58767, r58768, r58767);
        double r58770 = r58769 + r58768;
        return r58770;
}

Error

Bits error versus x

Bits error versus y

Derivation

  1. Initial program 0.0

    \[\left(x \cdot y + x\right) + y\]
  2. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, x\right) + y}\]
  3. Final simplification0.0

    \[\leadsto \mathsf{fma}\left(x, y, x\right) + y\]

Reproduce

herbie shell --seed 2019303 +o rules:numerics
(FPCore (x y)
  :name "Numeric.Log:$cexpm1 from log-domain-0.10.2.1, B"
  :precision binary64
  (+ (+ (* x y) x) y))