Average Error: 0.0 → 0.0
Time: 3.4s
Precision: 64
\[\left(x \cdot y + x\right) + y\]
\[\mathsf{fma}\left(y, x, x + y\right)\]
\left(x \cdot y + x\right) + y
\mathsf{fma}\left(y, x, x + y\right)
double f(double x, double y) {
        double r117591 = x;
        double r117592 = y;
        double r117593 = r117591 * r117592;
        double r117594 = r117593 + r117591;
        double r117595 = r117594 + r117592;
        return r117595;
}

double f(double x, double y) {
        double r117596 = y;
        double r117597 = x;
        double r117598 = r117597 + r117596;
        double r117599 = fma(r117596, r117597, r117598);
        return r117599;
}

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(y, x, x + y\right)}\]
  3. Final simplification0.0

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

Reproduce

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