Average Error: 0.0 → 0.0
Time: 3.8s
Precision: 64
\[\left(x \cdot y + z \cdot t\right) + a \cdot b\]
\[\mathsf{fma}\left(b, a, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\]
\left(x \cdot y + z \cdot t\right) + a \cdot b
\mathsf{fma}\left(b, a, \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 r148347 = x;
        double r148348 = y;
        double r148349 = r148347 * r148348;
        double r148350 = z;
        double r148351 = t;
        double r148352 = r148350 * r148351;
        double r148353 = r148349 + r148352;
        double r148354 = a;
        double r148355 = b;
        double r148356 = r148354 * r148355;
        double r148357 = r148353 + r148356;
        return r148357;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r148358 = b;
        double r148359 = a;
        double r148360 = x;
        double r148361 = y;
        double r148362 = z;
        double r148363 = t;
        double r148364 = r148362 * r148363;
        double r148365 = fma(r148360, r148361, r148364);
        double r148366 = fma(r148358, r148359, r148365);
        return r148366;
}

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. Final simplification0.0

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

Reproduce

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