Average Error: 0.0 → 0.0
Time: 3.5s
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 r6021972 = x;
        double r6021973 = y;
        double r6021974 = r6021972 * r6021973;
        double r6021975 = z;
        double r6021976 = t;
        double r6021977 = r6021975 * r6021976;
        double r6021978 = r6021974 + r6021977;
        double r6021979 = a;
        double r6021980 = b;
        double r6021981 = r6021979 * r6021980;
        double r6021982 = r6021978 + r6021981;
        return r6021982;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r6021983 = a;
        double r6021984 = b;
        double r6021985 = x;
        double r6021986 = y;
        double r6021987 = z;
        double r6021988 = t;
        double r6021989 = r6021987 * r6021988;
        double r6021990 = fma(r6021985, r6021986, r6021989);
        double r6021991 = fma(r6021983, r6021984, r6021990);
        return r6021991;
}

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 2019172 +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)))