Average Error: 0.0 → 0.0
Time: 10.4s
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 r7127120 = x;
        double r7127121 = y;
        double r7127122 = r7127120 * r7127121;
        double r7127123 = z;
        double r7127124 = t;
        double r7127125 = r7127123 * r7127124;
        double r7127126 = r7127122 + r7127125;
        double r7127127 = a;
        double r7127128 = b;
        double r7127129 = r7127127 * r7127128;
        double r7127130 = r7127126 + r7127129;
        return r7127130;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r7127131 = a;
        double r7127132 = b;
        double r7127133 = x;
        double r7127134 = y;
        double r7127135 = z;
        double r7127136 = t;
        double r7127137 = r7127135 * r7127136;
        double r7127138 = fma(r7127133, r7127134, r7127137);
        double r7127139 = fma(r7127131, r7127132, r7127138);
        return r7127139;
}

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