Average Error: 0.0 → 0.0
Time: 11.8s
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 r87758 = x;
        double r87759 = y;
        double r87760 = r87758 * r87759;
        double r87761 = r87760 + r87758;
        double r87762 = r87761 + r87759;
        return r87762;
}

double f(double x, double y) {
        double r87763 = x;
        double r87764 = y;
        double r87765 = fma(r87763, r87764, r87763);
        double r87766 = r87765 + r87764;
        return r87766;
}

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