Average Error: 0.0 → 0.0
Time: 5.2s
Precision: 64
\[x \cdot y + z \cdot t\]
\[\mathsf{fma}\left(z, t, x \cdot y\right)\]
x \cdot y + z \cdot t
\mathsf{fma}\left(z, t, x \cdot y\right)
double f(double x, double y, double z, double t) {
        double r83708 = x;
        double r83709 = y;
        double r83710 = r83708 * r83709;
        double r83711 = z;
        double r83712 = t;
        double r83713 = r83711 * r83712;
        double r83714 = r83710 + r83713;
        return r83714;
}

double f(double x, double y, double z, double t) {
        double r83715 = z;
        double r83716 = t;
        double r83717 = x;
        double r83718 = y;
        double r83719 = r83717 * r83718;
        double r83720 = fma(r83715, r83716, r83719);
        return r83720;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Derivation

  1. Initial program 0.0

    \[x \cdot y + z \cdot t\]
  2. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, z \cdot t\right)}\]
  3. Taylor expanded around inf 0.0

    \[\leadsto \color{blue}{t \cdot z + x \cdot y}\]
  4. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(z, t, x \cdot y\right)}\]
  5. Final simplification0.0

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

Reproduce

herbie shell --seed 2019179 +o rules:numerics
(FPCore (x y z t)
  :name "Linear.V2:$cdot from linear-1.19.1.3, A"
  (+ (* x y) (* z t)))