Average Error: 0.0 → 0.0
Time: 2.4s
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 r103929 = x;
        double r103930 = y;
        double r103931 = r103929 * r103930;
        double r103932 = r103931 + r103929;
        double r103933 = r103932 + r103930;
        return r103933;
}

double f(double x, double y) {
        double r103934 = x;
        double r103935 = y;
        double r103936 = fma(r103934, r103935, r103934);
        double r103937 = r103936 + r103935;
        return r103937;
}

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