Average Error: 0.0 → 0.0
Time: 7.2s
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 r4591665 = x;
        double r4591666 = y;
        double r4591667 = r4591665 * r4591666;
        double r4591668 = z;
        double r4591669 = t;
        double r4591670 = r4591668 * r4591669;
        double r4591671 = r4591667 + r4591670;
        double r4591672 = a;
        double r4591673 = b;
        double r4591674 = r4591672 * r4591673;
        double r4591675 = r4591671 + r4591674;
        return r4591675;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r4591676 = a;
        double r4591677 = b;
        double r4591678 = x;
        double r4591679 = y;
        double r4591680 = z;
        double r4591681 = t;
        double r4591682 = r4591680 * r4591681;
        double r4591683 = fma(r4591678, r4591679, r4591682);
        double r4591684 = fma(r4591676, r4591677, r4591683);
        return r4591684;
}

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