Average Error: 0.0 → 0.0
Time: 12.1s
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.6
Cost2528
\[\begin{array}{l} t_1 := a \cdot b + x \cdot y\\ t_2 := x \cdot y + z \cdot t\\ t_3 := a \cdot b + c \cdot i\\ \mathbf{if}\;a \cdot b \leq -4.9 \cdot 10^{+44}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;a \cdot b \leq -1.05 \cdot 10^{-62}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \cdot b \leq 1.55 \cdot 10^{-83}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 4.5 \cdot 10^{-37}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq 1.9 \cdot 10^{-18}:\\ \;\;\;\;c \cdot i + x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 2.2 \cdot 10^{+102}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \cdot b \leq 3.95 \cdot 10^{+133}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq 1.14 \cdot 10^{+220}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 2
Error38.3
Cost2272
\[\begin{array}{l} \mathbf{if}\;a \cdot b \leq -2.5 \cdot 10^{+44}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -2.2 \cdot 10^{-18}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq -2.4 \cdot 10^{-128}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq -7.6 \cdot 10^{-238}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 9.5 \cdot 10^{-182}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 3.4 \cdot 10^{-127}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 1.1 \cdot 10^{-86}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 1.08 \cdot 10^{+114}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]
Alternative 3
Error22.6
Cost2269
\[\begin{array}{l} t_1 := c \cdot i + x \cdot y\\ t_2 := a \cdot b + x \cdot y\\ t_3 := c \cdot i + z \cdot t\\ \mathbf{if}\;a \cdot b \leq -4.8 \cdot 10^{+45}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;a \cdot b \leq -1.95 \cdot 10^{-8}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \cdot b \leq -1.38 \cdot 10^{-127}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;a \cdot b \leq -4.2 \cdot 10^{-205}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq 1.12 \cdot 10^{-82}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;a \cdot b \leq 7.2 \cdot 10^{-37} \lor \neg \left(a \cdot b \leq 215\right):\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error10.2
Cost1746
\[\begin{array}{l} \mathbf{if}\;c \cdot i \leq -8.5 \cdot 10^{+16} \lor \neg \left(c \cdot i \leq 3100000000 \lor \neg \left(c \cdot i \leq 3.3 \cdot 10^{+68}\right) \land c \cdot i \leq 9 \cdot 10^{+119}\right):\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + \left(x \cdot y + z \cdot t\right)\\ \end{array} \]
Alternative 5
Error27.7
Cost1372
\[\begin{array}{l} t_1 := a \cdot b + z \cdot t\\ t_2 := a \cdot b + c \cdot i\\ t_3 := a \cdot b + x \cdot y\\ \mathbf{if}\;i \leq -2.5 \cdot 10^{-127}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;i \leq 6.8 \cdot 10^{-194}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;i \leq 9 \cdot 10^{-147}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;i \leq 1.28 \cdot 10^{+39}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;i \leq 3.8 \cdot 10^{+115}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;i \leq 6.2 \cdot 10^{+163}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;i \leq 3.3 \cdot 10^{+164}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 6
Error37.3
Cost1232
\[\begin{array}{l} \mathbf{if}\;c \cdot i \leq -8.6 \cdot 10^{+15}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -8.8 \cdot 10^{-147}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;c \cdot i \leq -3.05 \cdot 10^{-267}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;c \cdot i \leq 1.4 \cdot 10^{-17}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]
Alternative 7
Error22.7
Cost1229
\[\begin{array}{l} \mathbf{if}\;a \cdot b \leq -2.6 \cdot 10^{+45}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;a \cdot b \leq -3.4 \cdot 10^{-13} \lor \neg \left(a \cdot b \leq 2.15 \cdot 10^{-83}\right):\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \end{array} \]
Alternative 8
Error6.7
Cost1225
\[\begin{array}{l} t_1 := x \cdot y + z \cdot t\\ \mathbf{if}\;a \cdot b \leq -2.9 \cdot 10^{-56} \lor \neg \left(a \cdot b \leq 5.8 \cdot 10^{+54}\right):\\ \;\;\;\;a \cdot b + t_1\\ \mathbf{else}:\\ \;\;\;\;c \cdot i + t_1\\ \end{array} \]
Alternative 9
Error21.8
Cost969
\[\begin{array}{l} \mathbf{if}\;c \cdot i \leq -2.3 \cdot 10^{+15} \lor \neg \left(c \cdot i \leq 1450000000\right):\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \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
Error38.0
Cost712
\[\begin{array}{l} \mathbf{if}\;a \cdot b \leq -3 \cdot 10^{-56}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq 5.6 \cdot 10^{+56}:\\ \;\;\;\;c \cdot i\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]
Alternative 12
Error33.0
Cost712
\[\begin{array}{l} \mathbf{if}\;z \leq -1.65 \cdot 10^{+144}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;z \leq 7.8 \cdot 10^{-125}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{else}:\\ \;\;\;\;z \cdot t\\ \end{array} \]
Alternative 13
Error46.9
Cost192
\[a \cdot b \]

Error

Reproduce

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