Average Error: 0.0 → 0.0
Time: 1.4s
Precision: 64
\[\left(x \cdot y + z \cdot t\right) + a \cdot b\]
\[\mathsf{fma}\left(y, x, \mathsf{fma}\left(z, t, a \cdot b\right)\right)\]
\left(x \cdot y + z \cdot t\right) + a \cdot b
\mathsf{fma}\left(y, x, \mathsf{fma}\left(z, t, a \cdot b\right)\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r117794 = x;
        double r117795 = y;
        double r117796 = r117794 * r117795;
        double r117797 = z;
        double r117798 = t;
        double r117799 = r117797 * r117798;
        double r117800 = r117796 + r117799;
        double r117801 = a;
        double r117802 = b;
        double r117803 = r117801 * r117802;
        double r117804 = r117800 + r117803;
        return r117804;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r117805 = y;
        double r117806 = x;
        double r117807 = z;
        double r117808 = t;
        double r117809 = a;
        double r117810 = b;
        double r117811 = r117809 * r117810;
        double r117812 = fma(r117807, r117808, r117811);
        double r117813 = fma(r117805, r117806, r117812);
        return r117813;
}

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

    \[\leadsto \color{blue}{t \cdot z + \left(a \cdot b + x \cdot y\right)}\]
  3. Simplified0.0

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

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

Reproduce

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