Average Error: 0.0 → 0.0
Time: 6.5s
Precision: binary64
Cost: 13248
\[\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) \]
(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 b a (fma x y (* z t))))
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(b, a, fma(x, y, (z * t)));
}
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(b, a, fma(x, y, Float64(z * t)))
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[(b * a + N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\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)

Error

Derivation

  1. Initial program 0.0

    \[\left(x \cdot y + z \cdot t\right) + a \cdot b \]
  2. Applied egg-rr0.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) \]

Alternatives

Alternative 1
Error30.3
Cost1752
\[\begin{array}{l} \mathbf{if}\;b \cdot a \leq -6.289867216669463 \cdot 10^{-27}:\\ \;\;\;\;b \cdot a\\ \mathbf{elif}\;b \cdot a \leq 1.5575458549634238 \cdot 10^{-296}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;b \cdot a \leq 7.21851399152233 \cdot 10^{-207}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;b \cdot a \leq 1.2118992267054724 \cdot 10^{-53}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;b \cdot a \leq 8.502515493648889 \cdot 10^{+19}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;b \cdot a \leq 7.639544772631747 \cdot 10^{+25}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;b \cdot a\\ \end{array} \]
Alternative 2
Error20.1
Cost1372
\[\begin{array}{l} t_1 := b \cdot a + z \cdot t\\ \mathbf{if}\;y \leq 3.89552208019858 \cdot 10^{+19}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.0507984377300053 \cdot 10^{+37}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq 5 \cdot 10^{+71}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 6 \cdot 10^{+82}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{+121}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.05 \cdot 10^{+137}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{+189}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
Alternative 3
Error9.4
Cost968
\[\begin{array}{l} t_1 := b \cdot a + z \cdot t\\ \mathbf{if}\;b \cdot a \leq -6.289867216669463 \cdot 10^{-27}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \cdot a \leq 7.639544772631747 \cdot 10^{+25}:\\ \;\;\;\;x \cdot y + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error9.2
Cost968
\[\begin{array}{l} \mathbf{if}\;b \cdot a \leq -1.562774054522577 \cdot 10^{-5}:\\ \;\;\;\;b \cdot a + x \cdot y\\ \mathbf{elif}\;b \cdot a \leq 7.639544772631747 \cdot 10^{+25}:\\ \;\;\;\;x \cdot y + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;b \cdot a + z \cdot t\\ \end{array} \]
Alternative 5
Error29.8
Cost712
\[\begin{array}{l} \mathbf{if}\;b \cdot a \leq -1.562774054522577 \cdot 10^{-5}:\\ \;\;\;\;b \cdot a\\ \mathbf{elif}\;b \cdot a \leq 6214156284620.057:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;b \cdot a\\ \end{array} \]
Alternative 6
Error0.0
Cost704
\[\left(x \cdot y + z \cdot t\right) + b \cdot a \]
Alternative 7
Error42.0
Cost192
\[z \cdot t \]

Error

Reproduce

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