Average Error: 0.0 → 0.0
Time: 5.2s
Precision: 64
\[\left(x \cdot y + z \cdot t\right) + a \cdot b\]
\[\mathsf{fma}\left(a, b, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\]
\left(x \cdot y + z \cdot t\right) + a \cdot b
\mathsf{fma}\left(a, b, \mathsf{fma}\left(x, y, z \cdot t\right)\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r6453000 = x;
        double r6453001 = y;
        double r6453002 = r6453000 * r6453001;
        double r6453003 = z;
        double r6453004 = t;
        double r6453005 = r6453003 * r6453004;
        double r6453006 = r6453002 + r6453005;
        double r6453007 = a;
        double r6453008 = b;
        double r6453009 = r6453007 * r6453008;
        double r6453010 = r6453006 + r6453009;
        return r6453010;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r6453011 = a;
        double r6453012 = b;
        double r6453013 = x;
        double r6453014 = y;
        double r6453015 = z;
        double r6453016 = t;
        double r6453017 = r6453015 * r6453016;
        double r6453018 = fma(r6453013, r6453014, r6453017);
        double r6453019 = fma(r6453011, r6453012, r6453018);
        return r6453019;
}

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(a, b, \mathsf{fma}\left(x, y, z \cdot t\right)\right)}\]
  3. Final simplification0.0

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

Reproduce

herbie shell --seed 2019162 +o rules:numerics
(FPCore (x y z t a b)
  :name "Linear.V3:$cdot from linear-1.19.1.3, B"
  (+ (+ (* x y) (* z t)) (* a b)))