Average Error: 0.0 → 0.0
Time: 5.1s
Precision: binary64
Cost: 6976
\[\left(x \cdot y + z \cdot t\right) + a \cdot b \]
\[\mathsf{fma}\left(b, a, z \cdot t + x \cdot y\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 (+ (* z t) (* x y))))
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, ((z * t) + (x * y)));
}
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, Float64(Float64(z * t) + Float64(x * y)))
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[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(x \cdot y + z \cdot t\right) + a \cdot b
\mathsf{fma}\left(b, a, z \cdot t + x \cdot y\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. Applied egg-rr0.0

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

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

Alternatives

Alternative 1
Error30.1
Cost2272
\[\begin{array}{l} \mathbf{if}\;b \cdot a \leq -7.5 \cdot 10^{-5}:\\ \;\;\;\;b \cdot a\\ \mathbf{elif}\;b \cdot a \leq -4.3 \cdot 10^{-301}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;b \cdot a \leq 2.3 \cdot 10^{-248}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;b \cdot a \leq 1.55 \cdot 10^{-167}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;b \cdot a \leq 4.6 \cdot 10^{-119}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;b \cdot a \leq 1.28 \cdot 10^{-111}:\\ \;\;\;\;b \cdot a\\ \mathbf{elif}\;b \cdot a \leq 3.2 \cdot 10^{-25}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;b \cdot a \leq 2.2:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;b \cdot a\\ \end{array} \]
Alternative 2
Error21.0
Cost977
\[\begin{array}{l} \mathbf{if}\;x \leq -6.4 \cdot 10^{+175}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \leq -5.8 \cdot 10^{+44} \lor \neg \left(x \leq -8 \cdot 10^{-16}\right) \land x \leq 10^{-20}:\\ \;\;\;\;b \cdot a + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
Alternative 3
Error14.9
Cost713
\[\begin{array}{l} \mathbf{if}\;t \leq -8.2 \cdot 10^{-133} \lor \neg \left(t \leq 5 \cdot 10^{+52}\right):\\ \;\;\;\;b \cdot a + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;b \cdot a + x \cdot y\\ \end{array} \]
Alternative 4
Error30.0
Cost712
\[\begin{array}{l} \mathbf{if}\;b \cdot a \leq -1.38 \cdot 10^{-42}:\\ \;\;\;\;b \cdot a\\ \mathbf{elif}\;b \cdot a \leq 2.5:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;b \cdot a\\ \end{array} \]
Alternative 5
Error0.0
Cost704
\[\left(z \cdot t + x \cdot y\right) + b \cdot a \]
Alternative 6
Error41.9
Cost192
\[b \cdot a \]

Error

Reproduce

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