Average Error: 0.0 → 0.0
Time: 1.5s
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 r118850 = x;
        double r118851 = y;
        double r118852 = r118850 * r118851;
        double r118853 = z;
        double r118854 = t;
        double r118855 = r118853 * r118854;
        double r118856 = r118852 + r118855;
        double r118857 = a;
        double r118858 = b;
        double r118859 = r118857 * r118858;
        double r118860 = r118856 + r118859;
        return r118860;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r118861 = b;
        double r118862 = a;
        double r118863 = x;
        double r118864 = y;
        double r118865 = z;
        double r118866 = t;
        double r118867 = r118865 * r118866;
        double r118868 = fma(r118863, r118864, r118867);
        double r118869 = fma(r118861, r118862, r118868);
        return r118869;
}

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