Average Error: 0.0 → 0.0
Time: 5.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 r1983404 = x;
        double r1983405 = y;
        double r1983406 = r1983404 * r1983405;
        double r1983407 = z;
        double r1983408 = t;
        double r1983409 = r1983407 * r1983408;
        double r1983410 = r1983406 + r1983409;
        double r1983411 = a;
        double r1983412 = b;
        double r1983413 = r1983411 * r1983412;
        double r1983414 = r1983410 + r1983413;
        return r1983414;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r1983415 = a;
        double r1983416 = b;
        double r1983417 = x;
        double r1983418 = y;
        double r1983419 = z;
        double r1983420 = t;
        double r1983421 = r1983419 * r1983420;
        double r1983422 = fma(r1983417, r1983418, r1983421);
        double r1983423 = fma(r1983415, r1983416, r1983422);
        return r1983423;
}

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 2019156 +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)))