?

Average Error: 0.03% → 0.03%
Time: 5.5s
Precision: binary64
Cost: 6976

?

\[\left(x \cdot y + z \cdot t\right) + a \cdot b \]
\[\mathsf{fma}\left(z, t, x \cdot y\right) + a \cdot b \]
(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 z t (* x y)) (* 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(z, t, (x * y)) + (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 Float64(fma(z, t, Float64(x * y)) + 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[(N[(z * t + N[(x * y), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]
\left(x \cdot y + z \cdot t\right) + a \cdot b
\mathsf{fma}\left(z, t, x \cdot y\right) + a \cdot b

Error?

Derivation?

  1. Initial program 0.03

    \[\left(x \cdot y + z \cdot t\right) + a \cdot b \]
  2. Applied egg-rr0.03

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

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

Alternatives

Alternative 1
Error47.95%
Cost1492
\[\begin{array}{l} \mathbf{if}\;a \cdot b \leq -3.75 \cdot 10^{+53}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -3 \cdot 10^{-35}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq -1.05 \cdot 10^{-177}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq -2.5 \cdot 10^{-216}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 1.3 \cdot 10^{+18}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]
Alternative 2
Error15.17%
Cost1489
\[\begin{array}{l} \mathbf{if}\;a \cdot b \leq -3.2 \cdot 10^{+54}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq -225000000000 \lor \neg \left(a \cdot b \leq -3.5 \cdot 10^{-39}\right) \land a \cdot b \leq 10^{+21}:\\ \;\;\;\;z \cdot t + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \end{array} \]
Alternative 3
Error23.64%
Cost978
\[\begin{array}{l} \mathbf{if}\;x \leq -1.52 \cdot 10^{+144} \lor \neg \left(x \leq -2.35 \cdot 10^{+132}\right) \land \left(x \leq -5 \cdot 10^{+70} \lor \neg \left(x \leq 1.95 \cdot 10^{-79}\right)\right):\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \end{array} \]
Alternative 4
Error32.74%
Cost977
\[\begin{array}{l} \mathbf{if}\;x \leq -8.5 \cdot 10^{+151}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \leq -1.7 \cdot 10^{+131} \lor \neg \left(x \leq -1.4 \cdot 10^{+119}\right) \land x \leq 4.7 \cdot 10^{-47}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
Alternative 5
Error47.45%
Cost712
\[\begin{array}{l} \mathbf{if}\;a \cdot b \leq -8.6 \cdot 10^{-40}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq 6.2 \cdot 10^{+17}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]
Alternative 6
Error0.03%
Cost704
\[a \cdot b + \left(z \cdot t + x \cdot y\right) \]
Alternative 7
Error64.87%
Cost192
\[a \cdot b \]

Error

Reproduce?

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