Average Error: 0.0 → 0.0
Time: 8.3s
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 r104692 = x;
        double r104693 = y;
        double r104694 = r104692 * r104693;
        double r104695 = z;
        double r104696 = t;
        double r104697 = r104695 * r104696;
        double r104698 = r104694 + r104697;
        double r104699 = a;
        double r104700 = b;
        double r104701 = r104699 * r104700;
        double r104702 = r104698 + r104701;
        return r104702;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r104703 = a;
        double r104704 = b;
        double r104705 = x;
        double r104706 = y;
        double r104707 = z;
        double r104708 = t;
        double r104709 = r104707 * r104708;
        double r104710 = fma(r104705, r104706, r104709);
        double r104711 = fma(r104703, r104704, r104710);
        return r104711;
}

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