Average Error: 0.0 → 0.0
Time: 10.9s
Precision: 64
\[\left(x \cdot y + z \cdot t\right) + a \cdot b\]
\[\mathsf{fma}\left(z, t, \mathsf{fma}\left(b, a, x \cdot y\right)\right)\]
\left(x \cdot y + z \cdot t\right) + a \cdot b
\mathsf{fma}\left(z, t, \mathsf{fma}\left(b, a, x \cdot y\right)\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r6508768 = x;
        double r6508769 = y;
        double r6508770 = r6508768 * r6508769;
        double r6508771 = z;
        double r6508772 = t;
        double r6508773 = r6508771 * r6508772;
        double r6508774 = r6508770 + r6508773;
        double r6508775 = a;
        double r6508776 = b;
        double r6508777 = r6508775 * r6508776;
        double r6508778 = r6508774 + r6508777;
        return r6508778;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r6508779 = z;
        double r6508780 = t;
        double r6508781 = b;
        double r6508782 = a;
        double r6508783 = x;
        double r6508784 = y;
        double r6508785 = r6508783 * r6508784;
        double r6508786 = fma(r6508781, r6508782, r6508785);
        double r6508787 = fma(r6508779, r6508780, r6508786);
        return r6508787;
}

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. Taylor expanded around inf 0.0

    \[\leadsto \color{blue}{a \cdot b + \left(t \cdot z + x \cdot y\right)}\]
  4. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, a \cdot b\right)\right)}\]
  5. Taylor expanded around inf 0.0

    \[\leadsto \color{blue}{a \cdot b + \left(t \cdot z + x \cdot y\right)}\]
  6. Simplified0.0

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

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

Reproduce

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