Average Error: 0.0 → 0.0
Time: 2.0s
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 r102148 = x;
        double r102149 = y;
        double r102150 = r102148 * r102149;
        double r102151 = z;
        double r102152 = t;
        double r102153 = r102151 * r102152;
        double r102154 = r102150 + r102153;
        double r102155 = a;
        double r102156 = b;
        double r102157 = r102155 * r102156;
        double r102158 = r102154 + r102157;
        return r102158;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r102159 = b;
        double r102160 = a;
        double r102161 = t;
        double r102162 = z;
        double r102163 = x;
        double r102164 = y;
        double r102165 = r102163 * r102164;
        double r102166 = fma(r102161, r102162, r102165);
        double r102167 = fma(r102159, r102160, r102166);
        return r102167;
}

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