Average Error: 0.0 → 0.0
Time: 2.0s
Precision: 64
\[\left(x \cdot y + z \cdot t\right) + a \cdot b\]
\[\mathsf{fma}\left(t, z, \mathsf{fma}\left(a, b, x \cdot y\right)\right)\]
\left(x \cdot y + z \cdot t\right) + a \cdot b
\mathsf{fma}\left(t, z, \mathsf{fma}\left(a, b, x \cdot y\right)\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r132024 = x;
        double r132025 = y;
        double r132026 = r132024 * r132025;
        double r132027 = z;
        double r132028 = t;
        double r132029 = r132027 * r132028;
        double r132030 = r132026 + r132029;
        double r132031 = a;
        double r132032 = b;
        double r132033 = r132031 * r132032;
        double r132034 = r132030 + r132033;
        return r132034;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r132035 = t;
        double r132036 = z;
        double r132037 = a;
        double r132038 = b;
        double r132039 = x;
        double r132040 = y;
        double r132041 = r132039 * r132040;
        double r132042 = fma(r132037, r132038, r132041);
        double r132043 = fma(r132035, r132036, r132042);
        return r132043;
}

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. Simplified0.0

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

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

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

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

Reproduce

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