Average Error: 0.0 → 0.0
Time: 4.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 r6351905 = x;
        double r6351906 = y;
        double r6351907 = r6351905 * r6351906;
        double r6351908 = z;
        double r6351909 = t;
        double r6351910 = r6351908 * r6351909;
        double r6351911 = r6351907 + r6351910;
        double r6351912 = a;
        double r6351913 = b;
        double r6351914 = r6351912 * r6351913;
        double r6351915 = r6351911 + r6351914;
        return r6351915;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r6351916 = a;
        double r6351917 = b;
        double r6351918 = x;
        double r6351919 = y;
        double r6351920 = z;
        double r6351921 = t;
        double r6351922 = r6351920 * r6351921;
        double r6351923 = fma(r6351918, r6351919, r6351922);
        double r6351924 = fma(r6351916, r6351917, r6351923);
        return r6351924;
}

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