Average Error: 0.0 → 0.0
Time: 3.8s
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 r98451 = x;
        double r98452 = y;
        double r98453 = r98451 * r98452;
        double r98454 = r98453 + r98451;
        double r98455 = r98454 + r98452;
        return r98455;
}

double f(double x, double y) {
        double r98456 = x;
        double r98457 = y;
        double r98458 = fma(r98456, r98457, r98456);
        double r98459 = r98458 + r98457;
        return r98459;
}

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