Average Error: 0.0 → 0.0
Time: 1.2s
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 r116387 = x;
        double r116388 = y;
        double r116389 = r116387 * r116388;
        double r116390 = z;
        double r116391 = t;
        double r116392 = r116390 * r116391;
        double r116393 = r116389 + r116392;
        double r116394 = a;
        double r116395 = b;
        double r116396 = r116394 * r116395;
        double r116397 = r116393 + r116396;
        return r116397;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r116398 = b;
        double r116399 = a;
        double r116400 = x;
        double r116401 = y;
        double r116402 = z;
        double r116403 = t;
        double r116404 = r116402 * r116403;
        double r116405 = fma(r116400, r116401, r116404);
        double r116406 = fma(r116398, r116399, r116405);
        return r116406;
}

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