Average Error: 0.0 → 0.0
Time: 948.0ms
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 r10873 = x;
        double r10874 = y;
        double r10875 = r10873 * r10874;
        double r10876 = r10875 + r10873;
        double r10877 = r10876 + r10874;
        return r10877;
}

double f(double x, double y) {
        double r10878 = x;
        double r10879 = y;
        double r10880 = fma(r10878, r10879, r10878);
        double r10881 = r10880 + r10879;
        return r10881;
}

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