Average Error: 0.0 → 0.0
Time: 7.2s
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 r7092601 = x;
        double r7092602 = y;
        double r7092603 = r7092601 * r7092602;
        double r7092604 = z;
        double r7092605 = t;
        double r7092606 = r7092604 * r7092605;
        double r7092607 = r7092603 + r7092606;
        double r7092608 = a;
        double r7092609 = b;
        double r7092610 = r7092608 * r7092609;
        double r7092611 = r7092607 + r7092610;
        return r7092611;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r7092612 = a;
        double r7092613 = b;
        double r7092614 = x;
        double r7092615 = y;
        double r7092616 = z;
        double r7092617 = t;
        double r7092618 = r7092616 * r7092617;
        double r7092619 = fma(r7092614, r7092615, r7092618);
        double r7092620 = fma(r7092612, r7092613, r7092619);
        return r7092620;
}

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