Average Error: 0.0 → 0.0
Time: 3.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 r4357067 = x;
        double r4357068 = y;
        double r4357069 = r4357067 * r4357068;
        double r4357070 = r4357069 + r4357067;
        double r4357071 = r4357070 + r4357068;
        return r4357071;
}

double f(double x, double y) {
        double r4357072 = y;
        double r4357073 = x;
        double r4357074 = r4357073 + r4357072;
        double r4357075 = fma(r4357072, r4357073, r4357074);
        return r4357075;
}

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