Average Error: 0.0 → 0.0
Time: 1.3m
Precision: 64
\[\left(x \cdot y + x\right) + y\]
\[\mathsf{fma}\left(y, x, x\right) + y\]
\left(x \cdot y + x\right) + y
\mathsf{fma}\left(y, x, x\right) + y
double f(double x, double y) {
        double r4209944 = x;
        double r4209945 = y;
        double r4209946 = r4209944 * r4209945;
        double r4209947 = r4209946 + r4209944;
        double r4209948 = r4209947 + r4209945;
        return r4209948;
}

double f(double x, double y) {
        double r4209949 = y;
        double r4209950 = x;
        double r4209951 = fma(r4209949, r4209950, r4209950);
        double r4209952 = r4209951 + r4209949;
        return r4209952;
}

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\right) + y}\]
  3. Final simplification0.0

    \[\leadsto \mathsf{fma}\left(y, x, x\right) + y\]

Reproduce

herbie shell --seed 2019200 +o rules:numerics
(FPCore (x y)
  :name "Numeric.Log:$cexpm1 from log-domain-0.10.2.1, B"
  (+ (+ (* x y) x) y))