Average Error: 0.0 → 0.0
Time: 4.6s
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 r5435752 = x;
        double r5435753 = y;
        double r5435754 = r5435752 * r5435753;
        double r5435755 = z;
        double r5435756 = t;
        double r5435757 = r5435755 * r5435756;
        double r5435758 = r5435754 + r5435757;
        double r5435759 = a;
        double r5435760 = b;
        double r5435761 = r5435759 * r5435760;
        double r5435762 = r5435758 + r5435761;
        return r5435762;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r5435763 = a;
        double r5435764 = b;
        double r5435765 = x;
        double r5435766 = y;
        double r5435767 = z;
        double r5435768 = t;
        double r5435769 = r5435767 * r5435768;
        double r5435770 = fma(r5435765, r5435766, r5435769);
        double r5435771 = fma(r5435763, r5435764, r5435770);
        return r5435771;
}

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