Average Error: 0.0 → 0.0
Time: 3.3s
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 r77032 = x;
        double r77033 = y;
        double r77034 = r77032 * r77033;
        double r77035 = z;
        double r77036 = t;
        double r77037 = r77035 * r77036;
        double r77038 = r77034 + r77037;
        double r77039 = a;
        double r77040 = b;
        double r77041 = r77039 * r77040;
        double r77042 = r77038 + r77041;
        return r77042;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r77043 = a;
        double r77044 = b;
        double r77045 = x;
        double r77046 = y;
        double r77047 = z;
        double r77048 = t;
        double r77049 = r77047 * r77048;
        double r77050 = fma(r77045, r77046, r77049);
        double r77051 = fma(r77043, r77044, r77050);
        return r77051;
}

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