Average Error: 0.0 → 0.0
Time: 1.7s
Precision: 64
\[\left(x \cdot y + z \cdot t\right) + a \cdot b\]
\[\mathsf{fma}\left(b, a, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\]
\left(x \cdot y + z \cdot t\right) + a \cdot b
\mathsf{fma}\left(b, a, \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 r106178 = x;
        double r106179 = y;
        double r106180 = r106178 * r106179;
        double r106181 = z;
        double r106182 = t;
        double r106183 = r106181 * r106182;
        double r106184 = r106180 + r106183;
        double r106185 = a;
        double r106186 = b;
        double r106187 = r106185 * r106186;
        double r106188 = r106184 + r106187;
        return r106188;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r106189 = b;
        double r106190 = a;
        double r106191 = x;
        double r106192 = y;
        double r106193 = z;
        double r106194 = t;
        double r106195 = r106193 * r106194;
        double r106196 = fma(r106191, r106192, r106195);
        double r106197 = fma(r106189, r106190, r106196);
        return r106197;
}

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(b, a, \mathsf{fma}\left(x, y, z \cdot t\right)\right)}\]
  3. Final simplification0.0

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

Reproduce

herbie shell --seed 2019353 +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)))