?

Average Accuracy: 100.0% → 100.0%
Time: 6.2s
Precision: binary64
Cost: 13248

?

\[\left(x \cdot y + z \cdot t\right) + a \cdot b \]
\[\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, a \cdot b\right)\right) \]
(FPCore (x y z t a b) :precision binary64 (+ (+ (* x y) (* z t)) (* a b)))
(FPCore (x y z t a b) :precision binary64 (fma x y (fma z t (* a b))))
double code(double x, double y, double z, double t, double a, double b) {
	return ((x * y) + (z * t)) + (a * b);
}
double code(double x, double y, double z, double t, double a, double b) {
	return fma(x, y, fma(z, t, (a * b)));
}
function code(x, y, z, t, a, b)
	return Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b))
end
function code(x, y, z, t, a, b)
	return fma(x, y, fma(z, t, Float64(a * b)))
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_] := N[(x * y + N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(x \cdot y + z \cdot t\right) + a \cdot b
\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, a \cdot b\right)\right)

Error?

Derivation?

  1. Initial program 100.0%

    \[\left(x \cdot y + z \cdot t\right) + a \cdot b \]
  2. Simplified100.0%

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

    [Start]100.0

    \[ \left(x \cdot y + z \cdot t\right) + a \cdot b \]

    associate-+l+ [=>]100.0

    \[ \color{blue}{x \cdot y + \left(z \cdot t + a \cdot b\right)} \]

    fma-def [=>]100.0

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

    fma-def [=>]100.0

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

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

Alternatives

Alternative 1
Accuracy51.1%
Cost1492
\[\begin{array}{l} \mathbf{if}\;a \cdot b \leq -2.25 \cdot 10^{+106}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -3.9 \cdot 10^{-44}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq -3.15 \cdot 10^{-158}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 1.75 \cdot 10^{-289}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 1.55 \cdot 10^{-60}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]
Alternative 2
Accuracy62.9%
Cost1243
\[\begin{array}{l} \mathbf{if}\;x \leq -1.85 \cdot 10^{+238} \lor \neg \left(x \leq -4.5 \cdot 10^{+210}\right) \land \left(x \leq -7.4 \cdot 10^{+153} \lor \neg \left(x \leq -1.02 \cdot 10^{+90} \lor \neg \left(x \leq -1.6 \cdot 10^{+78}\right) \land x \leq 2.3 \cdot 10^{-159}\right)\right):\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \end{array} \]
Alternative 3
Accuracy75.2%
Cost978
\[\begin{array}{l} \mathbf{if}\;y \leq -1.7 \cdot 10^{-209} \lor \neg \left(y \leq 1.35 \cdot 10^{-71}\right) \land \left(y \leq 1.9 \cdot 10^{+48} \lor \neg \left(y \leq 1.42 \cdot 10^{+75}\right)\right):\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \end{array} \]
Alternative 4
Accuracy85.1%
Cost968
\[\begin{array}{l} \mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+69}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 3.7:\\ \;\;\;\;x \cdot y + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \end{array} \]
Alternative 5
Accuracy51.9%
Cost712
\[\begin{array}{l} \mathbf{if}\;a \cdot b \leq -4.9 \cdot 10^{+68}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq 3.5 \cdot 10^{-62}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]
Alternative 6
Accuracy100.0%
Cost704
\[a \cdot b + \left(x \cdot y + z \cdot t\right) \]
Alternative 7
Accuracy34.1%
Cost192
\[a \cdot b \]

Error

Reproduce?

herbie shell --seed 2023133 
(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)))