Average Error: 0.0 → 0.0
Time: 4.8s
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 r147655 = x;
        double r147656 = y;
        double r147657 = r147655 * r147656;
        double r147658 = z;
        double r147659 = t;
        double r147660 = r147658 * r147659;
        double r147661 = r147657 + r147660;
        double r147662 = a;
        double r147663 = b;
        double r147664 = r147662 * r147663;
        double r147665 = r147661 + r147664;
        return r147665;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r147666 = a;
        double r147667 = b;
        double r147668 = r147666 * r147667;
        double r147669 = x;
        double r147670 = y;
        double r147671 = z;
        double r147672 = t;
        double r147673 = r147671 * r147672;
        double r147674 = fma(r147669, r147670, r147673);
        double r147675 = r147668 + r147674;
        return r147675;
}

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