Average Error: 0.0 → 0.0
Time: 5.0s
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 r3929443 = x;
        double r3929444 = y;
        double r3929445 = r3929443 * r3929444;
        double r3929446 = r3929445 + r3929443;
        double r3929447 = r3929446 + r3929444;
        return r3929447;
}

double f(double x, double y) {
        double r3929448 = y;
        double r3929449 = x;
        double r3929450 = r3929449 + r3929448;
        double r3929451 = fma(r3929448, r3929449, r3929450);
        return r3929451;
}

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