Average Error: 0.0 → 0.0
Time: 13.6s
Precision: binary64
Cost: 19776
\[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
\[\mathsf{fma}\left(i, c, \mathsf{fma}\left(a, b, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\right) \]
(FPCore (x y z t a b c i)
 :precision binary64
 (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))
(FPCore (x y z t a b c i)
 :precision binary64
 (fma i c (fma a b (fma x y (* z t)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return fma(i, c, fma(a, b, fma(x, y, (z * t))));
}
function code(x, y, z, t, a, b, c, i)
	return Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) + Float64(c * i))
end
function code(x, y, z, t, a, b, c, i)
	return fma(i, c, fma(a, b, fma(x, y, Float64(z * t))))
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(i * c + N[(a * b + N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
\mathsf{fma}\left(i, c, \mathsf{fma}\left(a, b, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\right)

Error

Derivation

  1. Initial program 0.0

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

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

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

Alternatives

Alternative 1
Error22.7
Cost2528
\[\begin{array}{l} t_1 := x \cdot y + z \cdot t\\ t_2 := a \cdot b + x \cdot y\\ t_3 := a \cdot b + i \cdot c\\ \mathbf{if}\;i \cdot c \leq -2.8302187108053447 \cdot 10^{+20}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;i \cdot c \leq -3.596342916686101 \cdot 10^{-30}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;i \cdot c \leq -1.3610682972120197 \cdot 10^{-87}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;i \cdot c \leq -4.357059328936211 \cdot 10^{-136}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;i \cdot c \leq -1.060008913287305 \cdot 10^{-299}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;i \cdot c \leq 10^{-315}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;i \cdot c \leq 8.333455238014227 \cdot 10^{-215}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;i \cdot c \leq 437125.89935193403:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 2
Error32.3
Cost2428
\[\begin{array}{l} t_1 := a \cdot b + x \cdot y\\ t_2 := x \cdot y + z \cdot t\\ t_3 := a \cdot b + z \cdot t\\ \mathbf{if}\;i \leq -1.9650580797717156 \cdot 10^{+29}:\\ \;\;\;\;i \cdot c\\ \mathbf{elif}\;i \leq -1.1223033601058764 \cdot 10^{-93}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;i \leq -1.6770093913333661 \cdot 10^{-133}:\\ \;\;\;\;i \cdot c\\ \mathbf{elif}\;i \leq -4.8432852942216545 \cdot 10^{-191}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;i \leq -7.966030077335042 \cdot 10^{-251}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;i \leq 1.0577827759899617 \cdot 10^{-296}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;i \leq 2.4533357779004863 \cdot 10^{-166}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;i \leq 2483139623.3841753:\\ \;\;\;\;t_3\\ \mathbf{elif}\;i \leq 7.6 \cdot 10^{+105}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;i \leq 1.8 \cdot 10^{+120}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;i \leq 3.4 \cdot 10^{+211}:\\ \;\;\;\;i \cdot c\\ \mathbf{elif}\;i \leq 1.25 \cdot 10^{+242}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;i \leq 6.2 \cdot 10^{+261}:\\ \;\;\;\;i \cdot c\\ \mathbf{elif}\;i \leq 5.5 \cdot 10^{+267}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;i \leq 5.5 \cdot 10^{+289}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;i \cdot c\\ \end{array} \]
Alternative 3
Error22.2
Cost2268
\[\begin{array}{l} t_1 := a \cdot b + x \cdot y\\ t_2 := x \cdot y + z \cdot t\\ \mathbf{if}\;i \cdot c \leq -8.793416222011488 \cdot 10^{+62}:\\ \;\;\;\;i \cdot c + z \cdot t\\ \mathbf{elif}\;i \cdot c \leq -1.3610682972120197 \cdot 10^{-87}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;i \cdot c \leq -4.357059328936211 \cdot 10^{-136}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;i \cdot c \leq -1.060008913287305 \cdot 10^{-299}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;i \cdot c \leq 10^{-315}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;i \cdot c \leq 8.333455238014227 \cdot 10^{-215}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;i \cdot c \leq 437125.89935193403:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + i \cdot c\\ \end{array} \]
Alternative 4
Error24.7
Cost2008
\[\begin{array}{l} t_1 := a \cdot b + x \cdot y\\ t_2 := x \cdot y + z \cdot t\\ \mathbf{if}\;i \cdot c \leq -8.793416222011488 \cdot 10^{+62}:\\ \;\;\;\;i \cdot c\\ \mathbf{elif}\;i \cdot c \leq -1.3610682972120197 \cdot 10^{-87}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;i \cdot c \leq -1.060008913287305 \cdot 10^{-299}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;i \cdot c \leq 10^{-315}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;i \cdot c \leq 8.333455238014227 \cdot 10^{-215}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;i \cdot c \leq 5.970727097292295 \cdot 10^{+115}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;i \cdot c\\ \end{array} \]
Alternative 5
Error37.8
Cost1752
\[\begin{array}{l} \mathbf{if}\;i \cdot c \leq -8.793416222011488 \cdot 10^{+62}:\\ \;\;\;\;i \cdot c\\ \mathbf{elif}\;i \cdot c \leq -4.913365448243407 \cdot 10^{-88}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;i \cdot c \leq -1.087767966192197 \cdot 10^{-301}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;i \cdot c \leq 10^{-315}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;i \cdot c \leq 8.333455238014227 \cdot 10^{-215}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;i \cdot c \leq 7.790022436302111 \cdot 10^{+37}:\\ \;\;\;\;a \cdot b\\ \mathbf{else}:\\ \;\;\;\;i \cdot c\\ \end{array} \]
Alternative 6
Error9.3
Cost1748
\[\begin{array}{l} t_1 := a \cdot b + i \cdot c\\ t_2 := x \cdot y + z \cdot t\\ \mathbf{if}\;i \cdot c \leq -8.793416222011488 \cdot 10^{+62}:\\ \;\;\;\;i \cdot c + z \cdot t\\ \mathbf{elif}\;i \cdot c \leq 2.6032912727374106 \cdot 10^{+35}:\\ \;\;\;\;a \cdot b + t_2\\ \mathbf{elif}\;i \cdot c \leq 8.907689266125116 \cdot 10^{+113}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;i \cdot c \leq 1.3075467778938272 \cdot 10^{+134}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;i \cdot c \leq 9.870505300555269 \cdot 10^{+239}:\\ \;\;\;\;i \cdot c + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error37.5
Cost1492
\[\begin{array}{l} \mathbf{if}\;i \cdot c \leq -9.209706350410721 \cdot 10^{+23}:\\ \;\;\;\;i \cdot c\\ \mathbf{elif}\;i \cdot c \leq -1.060008913287305 \cdot 10^{-299}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;i \cdot c \leq 4.847049657239016 \cdot 10^{-276}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;i \cdot c \leq 6.3144954174887416 \cdot 10^{-198}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;i \cdot c \leq 0.6404107205918986:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;i \cdot c\\ \end{array} \]
Alternative 8
Error26.8
Cost1488
\[\begin{array}{l} t_1 := x \cdot y + z \cdot t\\ \mathbf{if}\;a \cdot b \leq -1.0212930956985536 \cdot 10^{+42}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -3.2879403055676475 \cdot 10^{-159}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq -4.5564246095376597 \cdot 10^{-278}:\\ \;\;\;\;i \cdot c\\ \mathbf{elif}\;a \cdot b \leq 8.624009743212617 \cdot 10^{+127}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]
Alternative 9
Error7.5
Cost1224
\[\begin{array}{l} \mathbf{if}\;i \cdot c \leq -8.793416222011488 \cdot 10^{+62}:\\ \;\;\;\;i \cdot c + z \cdot t\\ \mathbf{elif}\;i \cdot c \leq 4180.028820512171:\\ \;\;\;\;a \cdot b + \left(x \cdot y + z \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;i \cdot c + \left(a \cdot b + x \cdot y\right)\\ \end{array} \]
Alternative 10
Error6.3
Cost1224
\[\begin{array}{l} t_1 := x \cdot y + z \cdot t\\ \mathbf{if}\;i \cdot c \leq -1.1837576581311388 \cdot 10^{+61}:\\ \;\;\;\;i \cdot c + t_1\\ \mathbf{elif}\;i \cdot c \leq 4180.028820512171:\\ \;\;\;\;a \cdot b + t_1\\ \mathbf{else}:\\ \;\;\;\;i \cdot c + \left(a \cdot b + x \cdot y\right)\\ \end{array} \]
Alternative 11
Error0.0
Cost960
\[i \cdot c + \left(a \cdot b + \left(x \cdot y + z \cdot t\right)\right) \]
Alternative 12
Error37.5
Cost712
\[\begin{array}{l} \mathbf{if}\;i \cdot c \leq -9.209706350410721 \cdot 10^{+23}:\\ \;\;\;\;i \cdot c\\ \mathbf{elif}\;i \cdot c \leq 4180.028820512171:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;i \cdot c\\ \end{array} \]
Alternative 13
Error47.3
Cost192
\[z \cdot t \]

Error

Reproduce

herbie shell --seed 2022316 
(FPCore (x y z t a b c i)
  :name "Linear.V4:$cdot from linear-1.19.1.3, C"
  :precision binary64
  (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))