Average Error: 0.0 → 0.0
Time: 6.9s
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 r5662711 = x;
        double r5662712 = y;
        double r5662713 = r5662711 * r5662712;
        double r5662714 = z;
        double r5662715 = t;
        double r5662716 = r5662714 * r5662715;
        double r5662717 = r5662713 + r5662716;
        double r5662718 = a;
        double r5662719 = b;
        double r5662720 = r5662718 * r5662719;
        double r5662721 = r5662717 + r5662720;
        return r5662721;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r5662722 = a;
        double r5662723 = b;
        double r5662724 = x;
        double r5662725 = y;
        double r5662726 = z;
        double r5662727 = t;
        double r5662728 = r5662726 * r5662727;
        double r5662729 = fma(r5662724, r5662725, r5662728);
        double r5662730 = fma(r5662722, r5662723, r5662729);
        return r5662730;
}

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 2019174 +o rules:numerics
(FPCore (x y z t a b)
  :name "Linear.V3:$cdot from linear-1.19.1.3, B"
  (+ (+ (* x y) (* z t)) (* a b)))