Average Error: 0.1 → 0.0
Time: 10.1s
Precision: binary64
Cost: 7104
\[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
\[\mathsf{fma}\left(y, 5, x \cdot \left(\left(y + z\right) \cdot 2 + t\right)\right) \]
(FPCore (x y z t)
 :precision binary64
 (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))
(FPCore (x y z t) :precision binary64 (fma y 5.0 (* x (+ (* (+ y z) 2.0) t))))
double code(double x, double y, double z, double t) {
	return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
double code(double x, double y, double z, double t) {
	return fma(y, 5.0, (x * (((y + z) * 2.0) + t)));
}
function code(x, y, z, t)
	return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0))
end
function code(x, y, z, t)
	return fma(y, 5.0, Float64(x * Float64(Float64(Float64(y + z) * 2.0) + t)))
end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := N[(y * 5.0 + N[(x * N[(N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\mathsf{fma}\left(y, 5, x \cdot \left(\left(y + z\right) \cdot 2 + t\right)\right)

Error

Derivation

  1. Initial program 0.1

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

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

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

Alternatives

Alternative 1
Error9.3
Cost1364
\[\begin{array}{l} t_1 := y \cdot 5 + x \cdot \left(t + y \cdot 2\right)\\ t_2 := x \cdot \left(\left(y + z\right) \cdot 2 + t\right)\\ t_3 := y \cdot 5 + \left(y + z\right) \cdot \left(x \cdot 2\right)\\ \mathbf{if}\;x \leq -1.514742231343599 \cdot 10^{-35}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -3.7094904081489346 \cdot 10^{-76}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.2647753101705916 \cdot 10^{-136}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 2.223395081914315 \cdot 10^{-8}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 11.456688281619728:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 2
Error9.3
Cost1364
\[\begin{array}{l} t_1 := x \cdot \left(\left(y + z\right) \cdot 2 + t\right)\\ t_2 := y \cdot 5 + \left(y + z\right) \cdot \left(x \cdot 2\right)\\ \mathbf{if}\;x \leq -1.514742231343599 \cdot 10^{-35}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -3.7094904081489346 \cdot 10^{-76}:\\ \;\;\;\;y \cdot 5 + x \cdot \left(t + y \cdot 2\right)\\ \mathbf{elif}\;x \leq 1.2647753101705916 \cdot 10^{-136}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 2.223395081914315 \cdot 10^{-8}:\\ \;\;\;\;\left(x \cdot t + y \cdot 5\right) + 2 \cdot \left(y \cdot x\right)\\ \mathbf{elif}\;x \leq 11.456688281619728:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error12.9
Cost1232
\[\begin{array}{l} \mathbf{if}\;t \leq -1.75 \cdot 10^{+168}:\\ \;\;\;\;x \cdot \left(\left(y + z\right) \cdot 2 + t\right)\\ \mathbf{elif}\;t \leq -8.161804625723824 \cdot 10^{+115}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{elif}\;t \leq -2.891370321032443 \cdot 10^{+88}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;t \leq 3.204229558822736 \cdot 10^{+136}:\\ \;\;\;\;y \cdot 5 + \left(y + z\right) \cdot \left(x \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \end{array} \]
Alternative 4
Error0.1
Cost960
\[2 \cdot \left(x \cdot \left(y + z\right)\right) + \left(x \cdot t + y \cdot 5\right) \]
Alternative 5
Error27.9
Cost844
\[\begin{array}{l} t_1 := x \cdot \left(t + y \cdot 2\right)\\ \mathbf{if}\;x \leq -1.9703690152599765 \cdot 10^{-57}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.1186784765445553 \cdot 10^{-44}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.8 \cdot 10^{+141}:\\ \;\;\;\;z \cdot \left(x \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error12.6
Cost840
\[\begin{array}{l} t_1 := y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{if}\;y \leq -7.668617181410092 \cdot 10^{+81}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 5.906836053666133 \cdot 10^{+38}:\\ \;\;\;\;x \cdot \left(\left(y + z\right) \cdot 2 + t\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error34.7
Cost720
\[\begin{array}{l} \mathbf{if}\;t \leq -1.75 \cdot 10^{+168}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;t \leq -8.161804625723824 \cdot 10^{+115}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;t \leq -2.891370321032443 \cdot 10^{+88}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;t \leq 1.1488731676759713 \cdot 10^{+46}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]
Alternative 8
Error25.4
Cost712
\[\begin{array}{l} \mathbf{if}\;x \leq -1.9703690152599765 \cdot 10^{-57}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{elif}\;x \leq 1.1186784765445553 \cdot 10^{-44}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \end{array} \]
Alternative 9
Error19.3
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -7.668617181410092 \cdot 10^{+81}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;y \leq 5.470246135702431 \cdot 10^{+34}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]
Alternative 10
Error14.8
Cost712
\[\begin{array}{l} t_1 := y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{if}\;y \leq -8537115266251681:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 4.360258502393866 \cdot 10^{-70}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Error32.2
Cost588
\[\begin{array}{l} \mathbf{if}\;x \leq -1.32 \cdot 10^{+131}:\\ \;\;\;\;y \cdot \left(x \cdot 2\right)\\ \mathbf{elif}\;x \leq -1.9703690152599765 \cdot 10^{-57}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 5.963259965881587 \cdot 10^{-56}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]
Alternative 12
Error31.7
Cost588
\[\begin{array}{l} \mathbf{if}\;y \leq -6.27233347512862 \cdot 10^{-33}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;y \leq 3.312552422013941 \cdot 10^{-265}:\\ \;\;\;\;z \cdot \left(x \cdot 2\right)\\ \mathbf{elif}\;y \leq 2.0577775801244678 \cdot 10^{-23}:\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]
Alternative 13
Error47.0
Cost192
\[x \cdot t \]

Error

Reproduce

herbie shell --seed 2022300 
(FPCore (x y z t)
  :name "Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendOutside from plot-0.2.3.4, B"
  :precision binary64
  (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))