Average Error: 0.0 → 0.0
Time: 4.7s
Precision: 64
\[\left(x \cdot y + z \cdot t\right) + a \cdot b\]
\[a \cdot b + \mathsf{fma}\left(x, y, z \cdot t\right)\]
\left(x \cdot y + z \cdot t\right) + a \cdot b
a \cdot b + \mathsf{fma}\left(x, y, z \cdot t\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r122457 = x;
        double r122458 = y;
        double r122459 = r122457 * r122458;
        double r122460 = z;
        double r122461 = t;
        double r122462 = r122460 * r122461;
        double r122463 = r122459 + r122462;
        double r122464 = a;
        double r122465 = b;
        double r122466 = r122464 * r122465;
        double r122467 = r122463 + r122466;
        return r122467;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r122468 = a;
        double r122469 = b;
        double r122470 = r122468 * r122469;
        double r122471 = x;
        double r122472 = y;
        double r122473 = z;
        double r122474 = t;
        double r122475 = r122473 * r122474;
        double r122476 = fma(r122471, r122472, r122475);
        double r122477 = r122470 + r122476;
        return r122477;
}

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. Using strategy rm
  4. Applied fma-udef0.0

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

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

Reproduce

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