Average Error: 0.0 → 0.0
Time: 17.7s
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 r5381975 = x;
        double r5381976 = y;
        double r5381977 = r5381975 * r5381976;
        double r5381978 = z;
        double r5381979 = t;
        double r5381980 = r5381978 * r5381979;
        double r5381981 = r5381977 + r5381980;
        double r5381982 = a;
        double r5381983 = b;
        double r5381984 = r5381982 * r5381983;
        double r5381985 = r5381981 + r5381984;
        return r5381985;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r5381986 = a;
        double r5381987 = b;
        double r5381988 = x;
        double r5381989 = y;
        double r5381990 = z;
        double r5381991 = t;
        double r5381992 = r5381990 * r5381991;
        double r5381993 = fma(r5381988, r5381989, r5381992);
        double r5381994 = fma(r5381986, r5381987, r5381993);
        return r5381994;
}

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