Average Error: 0.0 → 0.0
Time: 9.5s
Precision: 64
\[\left(x \cdot y + z \cdot t\right) + a \cdot b\]
\[\mathsf{fma}\left(a, b, \mathsf{fma}\left(z, t, x \cdot y\right)\right)\]
\left(x \cdot y + z \cdot t\right) + a \cdot b
\mathsf{fma}\left(a, b, \mathsf{fma}\left(z, t, x \cdot y\right)\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r5874216 = x;
        double r5874217 = y;
        double r5874218 = r5874216 * r5874217;
        double r5874219 = z;
        double r5874220 = t;
        double r5874221 = r5874219 * r5874220;
        double r5874222 = r5874218 + r5874221;
        double r5874223 = a;
        double r5874224 = b;
        double r5874225 = r5874223 * r5874224;
        double r5874226 = r5874222 + r5874225;
        return r5874226;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r5874227 = a;
        double r5874228 = b;
        double r5874229 = z;
        double r5874230 = t;
        double r5874231 = x;
        double r5874232 = y;
        double r5874233 = r5874231 * r5874232;
        double r5874234 = fma(r5874229, r5874230, r5874233);
        double r5874235 = fma(r5874227, r5874228, r5874234);
        return r5874235;
}

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(z, t, y \cdot x\right)\right)}\]
  3. Final simplification0.0

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

Reproduce

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