Average Error: 0.0 → 0.0
Time: 3.4s
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 r62068 = x;
        double r62069 = y;
        double r62070 = r62068 * r62069;
        double r62071 = r62070 + r62068;
        double r62072 = r62071 + r62069;
        return r62072;
}

double f(double x, double y) {
        double r62073 = y;
        double r62074 = x;
        double r62075 = r62074 + r62073;
        double r62076 = fma(r62073, r62074, r62075);
        return r62076;
}

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))