Average Error: 0.0 → 0.0
Time: 4.3s
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 r5187339 = x;
        double r5187340 = y;
        double r5187341 = r5187339 * r5187340;
        double r5187342 = z;
        double r5187343 = t;
        double r5187344 = r5187342 * r5187343;
        double r5187345 = r5187341 + r5187344;
        double r5187346 = a;
        double r5187347 = b;
        double r5187348 = r5187346 * r5187347;
        double r5187349 = r5187345 + r5187348;
        return r5187349;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r5187350 = a;
        double r5187351 = b;
        double r5187352 = x;
        double r5187353 = y;
        double r5187354 = z;
        double r5187355 = t;
        double r5187356 = r5187354 * r5187355;
        double r5187357 = fma(r5187352, r5187353, r5187356);
        double r5187358 = fma(r5187350, r5187351, r5187357);
        return r5187358;
}

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