Average Error: 0.0 → 0.0
Time: 2.0s
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 r21894 = x;
        double r21895 = y;
        double r21896 = r21894 * r21895;
        double r21897 = z;
        double r21898 = t;
        double r21899 = r21897 * r21898;
        double r21900 = r21896 + r21899;
        double r21901 = a;
        double r21902 = b;
        double r21903 = r21901 * r21902;
        double r21904 = r21900 + r21903;
        return r21904;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r21905 = a;
        double r21906 = b;
        double r21907 = x;
        double r21908 = y;
        double r21909 = z;
        double r21910 = t;
        double r21911 = r21909 * r21910;
        double r21912 = fma(r21907, r21908, r21911);
        double r21913 = fma(r21905, r21906, r21912);
        return r21913;
}

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