Average Error: 0.0 → 0.0
Time: 1.4s
Precision: 64
\[\left(x \cdot y + z \cdot t\right) + a \cdot b\]
\[\mathsf{fma}\left(b, a, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\]
\left(x \cdot y + z \cdot t\right) + a \cdot b
\mathsf{fma}\left(b, a, \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 r130836 = x;
        double r130837 = y;
        double r130838 = r130836 * r130837;
        double r130839 = z;
        double r130840 = t;
        double r130841 = r130839 * r130840;
        double r130842 = r130838 + r130841;
        double r130843 = a;
        double r130844 = b;
        double r130845 = r130843 * r130844;
        double r130846 = r130842 + r130845;
        return r130846;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r130847 = b;
        double r130848 = a;
        double r130849 = x;
        double r130850 = y;
        double r130851 = z;
        double r130852 = t;
        double r130853 = r130851 * r130852;
        double r130854 = fma(r130849, r130850, r130853);
        double r130855 = fma(r130847, r130848, r130854);
        return r130855;
}

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(b, a, \mathsf{fma}\left(x, y, z \cdot t\right)\right)}\]
  3. Final simplification0.0

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

Reproduce

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