Average Error: 0.0 → 0.0
Time: 1.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 r140450 = x;
        double r140451 = y;
        double r140452 = r140450 * r140451;
        double r140453 = z;
        double r140454 = t;
        double r140455 = r140453 * r140454;
        double r140456 = r140452 + r140455;
        double r140457 = a;
        double r140458 = b;
        double r140459 = r140457 * r140458;
        double r140460 = r140456 + r140459;
        return r140460;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r140461 = a;
        double r140462 = b;
        double r140463 = x;
        double r140464 = y;
        double r140465 = z;
        double r140466 = t;
        double r140467 = r140465 * r140466;
        double r140468 = fma(r140463, r140464, r140467);
        double r140469 = fma(r140461, r140462, r140468);
        return r140469;
}

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