Average Error: 0.0 → 0.0
Time: 1.2s
Precision: 64
\[\left(x \cdot y + z \cdot t\right) + a \cdot b\]
\[\mathsf{fma}\left(b, a, \mathsf{fma}\left(t, z, x \cdot y\right)\right)\]
\left(x \cdot y + z \cdot t\right) + a \cdot b
\mathsf{fma}\left(b, a, \mathsf{fma}\left(t, z, x \cdot y\right)\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r107885 = x;
        double r107886 = y;
        double r107887 = r107885 * r107886;
        double r107888 = z;
        double r107889 = t;
        double r107890 = r107888 * r107889;
        double r107891 = r107887 + r107890;
        double r107892 = a;
        double r107893 = b;
        double r107894 = r107892 * r107893;
        double r107895 = r107891 + r107894;
        return r107895;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r107896 = b;
        double r107897 = a;
        double r107898 = t;
        double r107899 = z;
        double r107900 = x;
        double r107901 = y;
        double r107902 = r107900 * r107901;
        double r107903 = fma(r107898, r107899, r107902);
        double r107904 = fma(r107896, r107897, r107903);
        return r107904;
}

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 \mathsf{fma}\left(b, a, \color{blue}{t \cdot z + x \cdot y}\right)\]
  4. Simplified0.0

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

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

Reproduce

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