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

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 \left(\color{blue}{\mathsf{fma}\left(z, t, x \cdot y\right)} + a \cdot b\right) + c \cdot i \]
  3. Final simplification0.0

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

Alternatives

Alternative 1
Error22.5
Cost3308
\[\begin{array}{l} t_1 := c \cdot i + z \cdot t\\ t_2 := x \cdot y + z \cdot t\\ t_3 := a \cdot b + z \cdot t\\ \mathbf{if}\;a \cdot b \leq -4.59897655652324 \cdot 10^{+99}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;a \cdot b \leq -290858446975096.4:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq -8582.153912381755:\\ \;\;\;\;t_3\\ \mathbf{elif}\;a \cdot b \leq -2.7418902451002085 \cdot 10^{-111}:\\ \;\;\;\;c \cdot i + x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 0:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq 1.4500433854554794 \cdot 10^{-200}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \cdot b \leq 8.666019754023415 \cdot 10^{-66}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq 5547118151904124:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \cdot b \leq 7.731835391626913 \cdot 10^{+58}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 6.717108196425891 \cdot 10^{+79}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \cdot b \leq 1.94523397463608 \cdot 10^{+110}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \end{array} \]
Alternative 2
Error37.5
Cost2012
\[\begin{array}{l} \mathbf{if}\;c \cdot i \leq -1.3895319628607364 \cdot 10^{-15}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -3.401675787281868 \cdot 10^{-202}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;c \cdot i \leq -1 \cdot 10^{-315}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \cdot i \leq 2 \cdot 10^{-320}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;c \cdot i \leq 9.992171602241318 \cdot 10^{-177}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;c \cdot i \leq 1.805179611012147 \cdot 10^{+27}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \cdot i \leq 9.219536900259651 \cdot 10^{+36}:\\ \;\;\;\;a \cdot b\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]
Alternative 3
Error23.7
Cost2008
\[\begin{array}{l} t_1 := a \cdot b + z \cdot t\\ t_2 := a \cdot b + x \cdot y\\ \mathbf{if}\;c \cdot i \leq -1.358844706598043 \cdot 10^{+98}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -3.401675787281868 \cdot 10^{-202}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \cdot i \leq -1 \cdot 10^{-315}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \cdot i \leq 9.992171602241318 \cdot 10^{-177}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \cdot i \leq 1.805179611012147 \cdot 10^{+27}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \cdot i \leq 1.9210968025577913 \cdot 10^{+120}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]
Alternative 4
Error22.3
Cost2008
\[\begin{array}{l} t_1 := x \cdot y + z \cdot t\\ t_2 := a \cdot b + x \cdot y\\ t_3 := c \cdot i + z \cdot t\\ \mathbf{if}\;c \cdot i \leq -9.807819972756106 \cdot 10^{+26}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;c \cdot i \leq -2.7199292467088673 \cdot 10^{-11}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \cdot i \leq -5.073986458595875 \cdot 10^{-63}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;c \cdot i \leq -3.401675787281868 \cdot 10^{-202}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \cdot i \leq 10^{-321}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \cdot i \leq 1.1710804514326169 \cdot 10^{+55}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 5
Error37.7
Cost1752
\[\begin{array}{l} \mathbf{if}\;c \cdot i \leq -1.3895319628607364 \cdot 10^{-15}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -3.401675787281868 \cdot 10^{-202}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;c \cdot i \leq 1.9320158309344258 \cdot 10^{-269}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \cdot i \leq 9.992171602241318 \cdot 10^{-177}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;c \cdot i \leq 1.805179611012147 \cdot 10^{+27}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \cdot i \leq 9.219536900259651 \cdot 10^{+36}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]
Alternative 6
Error26.4
Cost1504
\[\begin{array}{l} t_1 := a \cdot b + z \cdot t\\ t_2 := c \cdot i + x \cdot y\\ \mathbf{if}\;i \leq -5.562923229365624 \cdot 10^{-77}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;i \leq 3.1485143957021743 \cdot 10^{-242}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;i \leq 3.886081380139228 \cdot 10^{-224}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;i \leq 1.507809531328107 \cdot 10^{-197}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;i \leq 7.061995077612288 \cdot 10^{+38}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;i \leq 9.6 \cdot 10^{+88}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;i \leq 7.6 \cdot 10^{+141}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;i \leq 3.95 \cdot 10^{+167}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 7
Error24.7
Cost1488
\[\begin{array}{l} t_1 := a \cdot b + z \cdot t\\ \mathbf{if}\;c \cdot i \leq -1.358844706598043 \cdot 10^{+98}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -1.4588827525895657 \cdot 10^{-248}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \cdot i \leq -1 \cdot 10^{-315}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \cdot i \leq 1.9210968025577913 \cdot 10^{+120}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]
Alternative 8
Error9.1
Cost1224
\[\begin{array}{l} \mathbf{if}\;a \cdot b \leq -4.59897655652324 \cdot 10^{+99}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 1.0305608485718354 \cdot 10^{+20}:\\ \;\;\;\;c \cdot i + \left(x \cdot y + z \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \end{array} \]
Alternative 9
Error6.6
Cost1224
\[\begin{array}{l} t_1 := x \cdot y + z \cdot t\\ t_2 := a \cdot b + t_1\\ \mathbf{if}\;a \cdot b \leq -4.59897655652324 \cdot 10^{+99}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \cdot b \leq 1.0305608485718354 \cdot 10^{+20}:\\ \;\;\;\;c \cdot i + t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 10
Error0.0
Cost960
\[c \cdot i + \left(a \cdot b + \left(x \cdot y + z \cdot t\right)\right) \]
Alternative 11
Error37.6
Cost712
\[\begin{array}{l} \mathbf{if}\;c \cdot i \leq -1410564359487923:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq 101369719189.28716:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]
Alternative 12
Error47.4
Cost192
\[x \cdot y \]

Error

Reproduce

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