Average Error: 0.0 → 0.0
Time: 2.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 r77005 = x;
        double r77006 = y;
        double r77007 = r77005 * r77006;
        double r77008 = z;
        double r77009 = t;
        double r77010 = r77008 * r77009;
        double r77011 = r77007 + r77010;
        double r77012 = a;
        double r77013 = b;
        double r77014 = r77012 * r77013;
        double r77015 = r77011 + r77014;
        return r77015;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r77016 = a;
        double r77017 = b;
        double r77018 = x;
        double r77019 = y;
        double r77020 = z;
        double r77021 = t;
        double r77022 = r77020 * r77021;
        double r77023 = fma(r77018, r77019, r77022);
        double r77024 = fma(r77016, r77017, r77023);
        return r77024;
}

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