Average Error: 0.0 → 0.0
Time: 5.4s
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 r104629 = x;
        double r104630 = y;
        double r104631 = r104629 * r104630;
        double r104632 = r104631 + r104629;
        double r104633 = r104632 + r104630;
        return r104633;
}

double f(double x, double y) {
        double r104634 = x;
        double r104635 = y;
        double r104636 = fma(r104634, r104635, r104634);
        double r104637 = r104636 + r104635;
        return r104637;
}

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 2020047 +o rules:numerics
(FPCore (x y)
  :name "Numeric.Log:$cexpm1 from log-domain-0.10.2.1, B"
  :precision binary64
  (+ (+ (* x y) x) y))