Average Error: 0.0 → 0.0
Time: 4.2s
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 r74538 = x;
        double r74539 = y;
        double r74540 = r74538 * r74539;
        double r74541 = r74540 + r74538;
        double r74542 = r74541 + r74539;
        return r74542;
}

double f(double x, double y) {
        double r74543 = x;
        double r74544 = y;
        double r74545 = fma(r74543, r74544, r74543);
        double r74546 = r74545 + r74544;
        return r74546;
}

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