Average Error: 0.0 → 0.0
Time: 7.5s
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 r94536 = x;
        double r94537 = y;
        double r94538 = r94536 * r94537;
        double r94539 = z;
        double r94540 = t;
        double r94541 = r94539 * r94540;
        double r94542 = r94538 + r94541;
        double r94543 = a;
        double r94544 = b;
        double r94545 = r94543 * r94544;
        double r94546 = r94542 + r94545;
        return r94546;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r94547 = a;
        double r94548 = b;
        double r94549 = x;
        double r94550 = y;
        double r94551 = z;
        double r94552 = t;
        double r94553 = r94551 * r94552;
        double r94554 = fma(r94549, r94550, r94553);
        double r94555 = fma(r94547, r94548, r94554);
        return r94555;
}

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