Average Error: 0.0 → 0.0
Time: 7.6s
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 r88682 = x;
        double r88683 = y;
        double r88684 = r88682 * r88683;
        double r88685 = r88684 + r88682;
        double r88686 = r88685 + r88683;
        return r88686;
}

double f(double x, double y) {
        double r88687 = y;
        double r88688 = x;
        double r88689 = r88688 + r88687;
        double r88690 = fma(r88687, r88688, r88689);
        return r88690;
}

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