Average Error: 0.0 → 0.0
Time: 1.3s
Precision: 64
\[x \cdot y + z \cdot t\]
\[\mathsf{fma}\left(t, z, x \cdot y\right)\]
x \cdot y + z \cdot t
\mathsf{fma}\left(t, z, x \cdot y\right)
double f(double x, double y, double z, double t) {
        double r88902 = x;
        double r88903 = y;
        double r88904 = r88902 * r88903;
        double r88905 = z;
        double r88906 = t;
        double r88907 = r88905 * r88906;
        double r88908 = r88904 + r88907;
        return r88908;
}

double f(double x, double y, double z, double t) {
        double r88909 = t;
        double r88910 = z;
        double r88911 = x;
        double r88912 = y;
        double r88913 = r88911 * r88912;
        double r88914 = fma(r88909, r88910, r88913);
        return r88914;
}

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. Taylor expanded around inf 0.0

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

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

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

Reproduce

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