Average Error: 0.0 → 0.0
Time: 6.1s
Precision: 64
\[\left(x \cdot y + x\right) + y\]
\[x + \mathsf{fma}\left(x, y, y\right)\]
\left(x \cdot y + x\right) + y
x + \mathsf{fma}\left(x, y, y\right)
double f(double x, double y) {
        double r2392707 = x;
        double r2392708 = y;
        double r2392709 = r2392707 * r2392708;
        double r2392710 = r2392709 + r2392707;
        double r2392711 = r2392710 + r2392708;
        return r2392711;
}

double f(double x, double y) {
        double r2392712 = x;
        double r2392713 = y;
        double r2392714 = fma(r2392712, r2392713, r2392713);
        double r2392715 = r2392712 + r2392714;
        return r2392715;
}

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}{y + \mathsf{fma}\left(y, x, x\right)}\]
  3. Using strategy rm
  4. Applied fma-udef0.0

    \[\leadsto y + \color{blue}{\left(y \cdot x + x\right)}\]
  5. Applied associate-+r+0.0

    \[\leadsto \color{blue}{\left(y + y \cdot x\right) + x}\]
  6. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, y\right)} + x\]
  7. Final simplification0.0

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

Reproduce

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