Average Error: 0.0 → 0.0
Time: 12.1s
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 r6040385 = x;
        double r6040386 = y;
        double r6040387 = r6040385 * r6040386;
        double r6040388 = z;
        double r6040389 = t;
        double r6040390 = r6040388 * r6040389;
        double r6040391 = r6040387 + r6040390;
        double r6040392 = a;
        double r6040393 = b;
        double r6040394 = r6040392 * r6040393;
        double r6040395 = r6040391 + r6040394;
        return r6040395;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r6040396 = a;
        double r6040397 = b;
        double r6040398 = x;
        double r6040399 = y;
        double r6040400 = z;
        double r6040401 = t;
        double r6040402 = r6040400 * r6040401;
        double r6040403 = fma(r6040398, r6040399, r6040402);
        double r6040404 = fma(r6040396, r6040397, r6040403);
        return r6040404;
}

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