Average Error: 0.0 → 0.0
Time: 4.0s
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 r107501 = x;
        double r107502 = y;
        double r107503 = r107501 * r107502;
        double r107504 = z;
        double r107505 = t;
        double r107506 = r107504 * r107505;
        double r107507 = r107503 + r107506;
        double r107508 = a;
        double r107509 = b;
        double r107510 = r107508 * r107509;
        double r107511 = r107507 + r107510;
        return r107511;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r107512 = a;
        double r107513 = b;
        double r107514 = x;
        double r107515 = y;
        double r107516 = z;
        double r107517 = t;
        double r107518 = r107516 * r107517;
        double r107519 = fma(r107514, r107515, r107518);
        double r107520 = fma(r107512, r107513, r107519);
        return r107520;
}

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