Average Error: 0.0 → 0.0
Time: 1.1s
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 r186727 = x;
        double r186728 = y;
        double r186729 = r186727 * r186728;
        double r186730 = z;
        double r186731 = t;
        double r186732 = r186730 * r186731;
        double r186733 = r186729 + r186732;
        return r186733;
}

double f(double x, double y, double z, double t) {
        double r186734 = t;
        double r186735 = z;
        double r186736 = x;
        double r186737 = y;
        double r186738 = r186736 * r186737;
        double r186739 = fma(r186734, r186735, r186738);
        return r186739;
}

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(t, z, x \cdot y\right)}\]
  5. Final simplification0.0

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

Reproduce

herbie shell --seed 2019346 +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)))