Average Error: 0.0 → 0.0
Time: 5.3s
Precision: binary64
Cost: 13248
\[\left(x \cdot y + z \cdot t\right) + a \cdot b \]
\[\mathsf{fma}\left(z, t, \mathsf{fma}\left(x, y, 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 z t (fma 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, fma(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 fma(z, t, fma(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[(z * t + N[(x * y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(x \cdot y + z \cdot t\right) + a \cdot b
\mathsf{fma}\left(z, t, \mathsf{fma}\left(x, y, a \cdot b\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(z, t, \mathsf{fma}\left(x, y, a \cdot b\right)\right)} \]
  3. Final simplification0.0

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

Alternatives

Alternative 1
Error35.8
Cost984
\[\begin{array}{l} \mathbf{if}\;z \leq -1.0201145473395068 \cdot 10^{+24}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;z \leq -1.200758376922514 \cdot 10^{-10}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;z \leq -5.361178057740946 \cdot 10^{-171}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;z \leq -1.4819277209410694 \cdot 10^{-258}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;z \leq 3.356917097551678 \cdot 10^{-239}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;z \leq 6.408032260502808 \cdot 10^{-132}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;z \cdot t\\ \end{array} \]
Alternative 2
Error23.4
Cost976
\[\begin{array}{l} t_1 := a \cdot b + z \cdot t\\ \mathbf{if}\;z \leq -3.815971493270716 \cdot 10^{-181}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.4819277209410694 \cdot 10^{-258}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;z \leq 3.356917097551678 \cdot 10^{-239}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 3.5565521991916636 \cdot 10^{-135}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error9.5
Cost968
\[\begin{array}{l} t_1 := a \cdot b + z \cdot t\\ \mathbf{if}\;a \cdot b \leq -184983751208433.6:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq 3.646899597085883 \cdot 10^{-32}:\\ \;\;\;\;z \cdot t + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error31.2
Cost712
\[\begin{array}{l} \mathbf{if}\;a \cdot b \leq -2.235730224231274 \cdot 10^{-78}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq 5.377245207412535 \cdot 10^{+27}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]
Alternative 5
Error0.0
Cost704
\[a \cdot b + \left(z \cdot t + x \cdot y\right) \]
Alternative 6
Error42.1
Cost192
\[a \cdot b \]

Error

Reproduce

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