Average Error: 0.0 → 0.0
Time: 2.5s
Precision: 64
\[\left(x \cdot y + z \cdot t\right) + a \cdot b\]
\[b \cdot a + \mathsf{fma}\left(x, y, z \cdot t\right)\]
\left(x \cdot y + z \cdot t\right) + a \cdot b
b \cdot a + \mathsf{fma}\left(x, y, z \cdot t\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r128896 = x;
        double r128897 = y;
        double r128898 = r128896 * r128897;
        double r128899 = z;
        double r128900 = t;
        double r128901 = r128899 * r128900;
        double r128902 = r128898 + r128901;
        double r128903 = a;
        double r128904 = b;
        double r128905 = r128903 * r128904;
        double r128906 = r128902 + r128905;
        return r128906;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r128907 = b;
        double r128908 = a;
        double r128909 = r128907 * r128908;
        double r128910 = x;
        double r128911 = y;
        double r128912 = z;
        double r128913 = t;
        double r128914 = r128912 * r128913;
        double r128915 = fma(r128910, r128911, r128914);
        double r128916 = r128909 + r128915;
        return r128916;
}

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. Using strategy rm
  4. Applied fma-udef0.0

    \[\leadsto \color{blue}{b \cdot a + \mathsf{fma}\left(x, y, z \cdot t\right)}\]
  5. Final simplification0.0

    \[\leadsto b \cdot a + \mathsf{fma}\left(x, y, z \cdot t\right)\]

Reproduce

herbie shell --seed 2020046 +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)))