Average Error: 0.0 → 0.0
Time: 2.1s
Precision: 64
\[\left(x \cdot y + z \cdot t\right) + a \cdot b\]
\[\mathsf{fma}\left(a, b, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\]
\left(x \cdot y + z \cdot t\right) + a \cdot b
\mathsf{fma}\left(a, b, \mathsf{fma}\left(x, y, z \cdot t\right)\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r147705 = x;
        double r147706 = y;
        double r147707 = r147705 * r147706;
        double r147708 = z;
        double r147709 = t;
        double r147710 = r147708 * r147709;
        double r147711 = r147707 + r147710;
        double r147712 = a;
        double r147713 = b;
        double r147714 = r147712 * r147713;
        double r147715 = r147711 + r147714;
        return r147715;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r147716 = a;
        double r147717 = b;
        double r147718 = x;
        double r147719 = y;
        double r147720 = z;
        double r147721 = t;
        double r147722 = r147720 * r147721;
        double r147723 = fma(r147718, r147719, r147722);
        double r147724 = fma(r147716, r147717, r147723);
        return r147724;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Derivation

  1. Initial program 0.0

    \[\left(x \cdot y + z \cdot t\right) + a \cdot b\]
  2. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(a, b, \mathsf{fma}\left(x, y, z \cdot t\right)\right)}\]
  3. Final simplification0.0

    \[\leadsto \mathsf{fma}\left(a, b, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\]

Reproduce

herbie shell --seed 2020045 +o rules:numerics
(FPCore (x y z t a b)
  :name "Linear.V3:$cdot from linear-1.19.1.3, B"
  :precision binary64
  (+ (+ (* x y) (* z t)) (* a b)))