Average Error: 0.0 → 0.0
Time: 3.2s
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 r101579 = x;
        double r101580 = y;
        double r101581 = r101579 * r101580;
        double r101582 = z;
        double r101583 = t;
        double r101584 = r101582 * r101583;
        double r101585 = r101581 + r101584;
        double r101586 = a;
        double r101587 = b;
        double r101588 = r101586 * r101587;
        double r101589 = r101585 + r101588;
        return r101589;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r101590 = b;
        double r101591 = a;
        double r101592 = x;
        double r101593 = y;
        double r101594 = z;
        double r101595 = t;
        double r101596 = r101594 * r101595;
        double r101597 = fma(r101592, r101593, r101596);
        double r101598 = fma(r101590, r101591, r101597);
        return r101598;
}

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