Average Error: 0.0 → 0.0
Time: 4.7s
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 r64401 = x;
        double r64402 = y;
        double r64403 = r64401 * r64402;
        double r64404 = r64403 + r64401;
        double r64405 = r64404 + r64402;
        return r64405;
}

double f(double x, double y) {
        double r64406 = x;
        double r64407 = y;
        double r64408 = fma(r64406, r64407, r64406);
        double r64409 = r64408 + r64407;
        return r64409;
}

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