Average Error: 0.0 → 0.0
Time: 5.2s
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 r5723150 = x;
        double r5723151 = y;
        double r5723152 = r5723150 * r5723151;
        double r5723153 = z;
        double r5723154 = t;
        double r5723155 = r5723153 * r5723154;
        double r5723156 = r5723152 + r5723155;
        double r5723157 = a;
        double r5723158 = b;
        double r5723159 = r5723157 * r5723158;
        double r5723160 = r5723156 + r5723159;
        return r5723160;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r5723161 = a;
        double r5723162 = b;
        double r5723163 = x;
        double r5723164 = y;
        double r5723165 = z;
        double r5723166 = t;
        double r5723167 = r5723165 * r5723166;
        double r5723168 = fma(r5723163, r5723164, r5723167);
        double r5723169 = fma(r5723161, r5723162, r5723168);
        return r5723169;
}

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