Average Error: 0.0 → 0.0
Time: 27.1s
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 r6947945 = x;
        double r6947946 = y;
        double r6947947 = r6947945 * r6947946;
        double r6947948 = z;
        double r6947949 = t;
        double r6947950 = r6947948 * r6947949;
        double r6947951 = r6947947 + r6947950;
        double r6947952 = a;
        double r6947953 = b;
        double r6947954 = r6947952 * r6947953;
        double r6947955 = r6947951 + r6947954;
        return r6947955;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r6947956 = a;
        double r6947957 = b;
        double r6947958 = x;
        double r6947959 = y;
        double r6947960 = z;
        double r6947961 = t;
        double r6947962 = r6947960 * r6947961;
        double r6947963 = fma(r6947958, r6947959, r6947962);
        double r6947964 = fma(r6947956, r6947957, r6947963);
        return r6947964;
}

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