Average Error: 0.0 → 0.0
Time: 1.5s
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 r143087 = x;
        double r143088 = y;
        double r143089 = r143087 * r143088;
        double r143090 = z;
        double r143091 = t;
        double r143092 = r143090 * r143091;
        double r143093 = r143089 + r143092;
        double r143094 = a;
        double r143095 = b;
        double r143096 = r143094 * r143095;
        double r143097 = r143093 + r143096;
        return r143097;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r143098 = b;
        double r143099 = a;
        double r143100 = x;
        double r143101 = y;
        double r143102 = z;
        double r143103 = t;
        double r143104 = r143102 * r143103;
        double r143105 = fma(r143100, r143101, r143104);
        double r143106 = fma(r143098, r143099, r143105);
        return r143106;
}

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