Average Error: 0.0 → 0.0
Time: 2.9s
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 r652 = x;
        double r653 = y;
        double r654 = r652 * r653;
        double r655 = z;
        double r656 = t;
        double r657 = r655 * r656;
        double r658 = r654 + r657;
        double r659 = a;
        double r660 = b;
        double r661 = r659 * r660;
        double r662 = r658 + r661;
        return r662;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r663 = b;
        double r664 = a;
        double r665 = x;
        double r666 = y;
        double r667 = z;
        double r668 = t;
        double r669 = r667 * r668;
        double r670 = fma(r665, r666, r669);
        double r671 = fma(r663, r664, r670);
        return r671;
}

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