Average Error: 0.0 → 0.0
Time: 10.4s
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 r94941 = x;
        double r94942 = y;
        double r94943 = r94941 * r94942;
        double r94944 = z;
        double r94945 = t;
        double r94946 = r94944 * r94945;
        double r94947 = r94943 + r94946;
        return r94947;
}

double f(double x, double y, double z, double t) {
        double r94948 = z;
        double r94949 = t;
        double r94950 = x;
        double r94951 = y;
        double r94952 = r94950 * r94951;
        double r94953 = fma(r94948, r94949, r94952);
        return r94953;
}

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 2019196 +o rules:numerics
(FPCore (x y z t)
  :name "Linear.V2:$cdot from linear-1.19.1.3, A"
  (+ (* x y) (* z t)))