Average Error: 0.0 → 0.0
Time: 6.8s
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 r116148 = x;
        double r116149 = y;
        double r116150 = r116148 * r116149;
        double r116151 = z;
        double r116152 = t;
        double r116153 = r116151 * r116152;
        double r116154 = r116150 + r116153;
        double r116155 = a;
        double r116156 = b;
        double r116157 = r116155 * r116156;
        double r116158 = r116154 + r116157;
        return r116158;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r116159 = a;
        double r116160 = b;
        double r116161 = x;
        double r116162 = y;
        double r116163 = z;
        double r116164 = t;
        double r116165 = r116163 * r116164;
        double r116166 = fma(r116161, r116162, r116165);
        double r116167 = fma(r116159, r116160, r116166);
        return r116167;
}

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