Average Error: 0.0 → 0.0
Time: 1.3s
Precision: 64
\[\left(x \cdot y + z \cdot t\right) + a \cdot b\]
\[\mathsf{fma}\left(b, a, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\]
\left(x \cdot y + z \cdot t\right) + a \cdot b
\mathsf{fma}\left(b, a, \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 r100044 = x;
        double r100045 = y;
        double r100046 = r100044 * r100045;
        double r100047 = z;
        double r100048 = t;
        double r100049 = r100047 * r100048;
        double r100050 = r100046 + r100049;
        double r100051 = a;
        double r100052 = b;
        double r100053 = r100051 * r100052;
        double r100054 = r100050 + r100053;
        return r100054;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r100055 = b;
        double r100056 = a;
        double r100057 = x;
        double r100058 = y;
        double r100059 = z;
        double r100060 = t;
        double r100061 = r100059 * r100060;
        double r100062 = fma(r100057, r100058, r100061);
        double r100063 = fma(r100055, r100056, r100062);
        return r100063;
}

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

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

Reproduce

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