Average Error: 0.0 → 0.0
Time: 21.9s
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 r16777521 = x;
        double r16777522 = y;
        double r16777523 = r16777521 * r16777522;
        double r16777524 = z;
        double r16777525 = t;
        double r16777526 = r16777524 * r16777525;
        double r16777527 = r16777523 + r16777526;
        double r16777528 = a;
        double r16777529 = b;
        double r16777530 = r16777528 * r16777529;
        double r16777531 = r16777527 + r16777530;
        return r16777531;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r16777532 = a;
        double r16777533 = b;
        double r16777534 = x;
        double r16777535 = y;
        double r16777536 = z;
        double r16777537 = t;
        double r16777538 = r16777536 * r16777537;
        double r16777539 = fma(r16777534, r16777535, r16777538);
        double r16777540 = fma(r16777532, r16777533, r16777539);
        return r16777540;
}

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