Average Error: 0.0 → 0.0
Time: 7.8s
Precision: 64
\[\left(x \cdot y + z \cdot t\right) + a \cdot b\]
\[\mathsf{fma}\left(a, b, \mathsf{fma}\left(z, t, x \cdot y\right)\right)\]
\left(x \cdot y + z \cdot t\right) + a \cdot b
\mathsf{fma}\left(a, b, \mathsf{fma}\left(z, t, x \cdot y\right)\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r128870 = x;
        double r128871 = y;
        double r128872 = r128870 * r128871;
        double r128873 = z;
        double r128874 = t;
        double r128875 = r128873 * r128874;
        double r128876 = r128872 + r128875;
        double r128877 = a;
        double r128878 = b;
        double r128879 = r128877 * r128878;
        double r128880 = r128876 + r128879;
        return r128880;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r128881 = a;
        double r128882 = b;
        double r128883 = z;
        double r128884 = t;
        double r128885 = x;
        double r128886 = y;
        double r128887 = r128885 * r128886;
        double r128888 = fma(r128883, r128884, r128887);
        double r128889 = fma(r128881, r128882, r128888);
        return r128889;
}

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

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

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

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

Reproduce

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