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 r101929 = x;
        double r101930 = y;
        double r101931 = r101929 * r101930;
        double r101932 = z;
        double r101933 = t;
        double r101934 = r101932 * r101933;
        double r101935 = r101931 + r101934;
        double r101936 = a;
        double r101937 = b;
        double r101938 = r101936 * r101937;
        double r101939 = r101935 + r101938;
        return r101939;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r101940 = a;
        double r101941 = b;
        double r101942 = x;
        double r101943 = y;
        double r101944 = z;
        double r101945 = t;
        double r101946 = r101944 * r101945;
        double r101947 = fma(r101942, r101943, r101946);
        double r101948 = fma(r101940, r101941, r101947);
        return r101948;
}

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