Average Error: 0.0 → 0.0
Time: 5.7s
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 r3607331 = x;
        double r3607332 = y;
        double r3607333 = r3607331 * r3607332;
        double r3607334 = z;
        double r3607335 = t;
        double r3607336 = r3607334 * r3607335;
        double r3607337 = r3607333 + r3607336;
        double r3607338 = a;
        double r3607339 = b;
        double r3607340 = r3607338 * r3607339;
        double r3607341 = r3607337 + r3607340;
        return r3607341;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r3607342 = a;
        double r3607343 = b;
        double r3607344 = x;
        double r3607345 = y;
        double r3607346 = z;
        double r3607347 = t;
        double r3607348 = r3607346 * r3607347;
        double r3607349 = fma(r3607344, r3607345, r3607348);
        double r3607350 = fma(r3607342, r3607343, r3607349);
        return r3607350;
}

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