Average Error: 0.1 → 0.1
Time: 13.0s
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(t + \left(y + z\right) \cdot 2\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 (+ t (* (+ y z) 2.0)))))
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 * (t + ((y + z) * 2.0))));
}
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(t + Float64(Float64(y + z) * 2.0))))
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[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $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(t + \left(y + z\right) \cdot 2\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.1

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

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

Alternatives

Alternative 1
Error16.4
Cost1372
\[\begin{array}{l} t_1 := y \cdot 5 + 2 \cdot \left(x \cdot z\right)\\ t_2 := y \cdot 5 + x \cdot t\\ \mathbf{if}\;t \leq -1.433755867923289 \cdot 10^{+76}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq -3.452289457691771 \cdot 10^{-41}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -7.714399150639959 \cdot 10^{-121}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{elif}\;t \leq 9.265100117215702 \cdot 10^{-61}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 9.410362952962034 \cdot 10^{+35}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 2.4191626766661195 \cdot 10^{+48}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;t \leq 4.805112264034117 \cdot 10^{+72}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 2
Error16.4
Cost1372
\[\begin{array}{l} t_1 := y \cdot 5 + 2 \cdot \left(x \cdot z\right)\\ t_2 := y \cdot 5 + x \cdot t\\ \mathbf{if}\;t \leq -1.433755867923289 \cdot 10^{+76}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq -3.452289457691771 \cdot 10^{-41}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -7.714399150639959 \cdot 10^{-121}:\\ \;\;\;\;y \cdot 5 + y \cdot \left(x \cdot 2\right)\\ \mathbf{elif}\;t \leq 9.265100117215702 \cdot 10^{-61}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 9.410362952962034 \cdot 10^{+35}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 2.4191626766661195 \cdot 10^{+48}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;t \leq 4.805112264034117 \cdot 10^{+72}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Error27.4
Cost1108
\[\begin{array}{l} t_1 := x \cdot \left(t + y \cdot 2\right)\\ \mathbf{if}\;x \leq -3.378035299059156 \cdot 10^{-72}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 5.186029536434914 \cdot 10^{-113}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 4.680895701701483 \cdot 10^{-24}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 7.977862782028542 \cdot 10^{-19}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 5500000000000:\\ \;\;\;\;x \cdot \left(z \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error15.8
Cost976
\[\begin{array}{l} t_1 := y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{if}\;y \leq -4.245648964463158 \cdot 10^{+85}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.4636969468169236 \cdot 10^{-17}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;y \leq -4.706163679713545 \cdot 10^{-128}:\\ \;\;\;\;x \cdot \left(\left(y + z\right) \cdot 2\right)\\ \mathbf{elif}\;y \leq 3.307153294452222 \cdot 10^{+24}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error10.2
Cost972
\[\begin{array}{l} t_1 := x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ \mathbf{if}\;x \leq -3.378035299059156 \cdot 10^{-72}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 4.478600973061447 \cdot 10^{-197}:\\ \;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \leq 7.977862782028542 \cdot 10^{-19}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error9.6
Cost968
\[\begin{array}{l} t_1 := y \cdot 5 + x \cdot t\\ \mathbf{if}\;t \leq -1.433755867923289 \cdot 10^{+76}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 9.265100117215702 \cdot 10^{-61}:\\ \;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error0.1
Cost960
\[x \cdot \left(t + z \cdot 2\right) + y \cdot \left(5 + x \cdot 2\right) \]
Alternative 8
Error0.1
Cost960
\[x \cdot \left(t + \left(y + \left(z + \left(y + z\right)\right)\right)\right) + y \cdot 5 \]
Alternative 9
Error33.1
Cost852
\[\begin{array}{l} t_1 := x \cdot \left(z \cdot 2\right)\\ \mathbf{if}\;y \leq -1.1946151379230837 \cdot 10^{+53}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;y \leq -8.287426312195098 \cdot 10^{-116}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -3.507721912982044 \cdot 10^{-211}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;y \leq -1.2256823179304415 \cdot 10^{-288}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.7481363253719933 \cdot 10^{-45}:\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]
Alternative 10
Error19.5
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -1.1946151379230837 \cdot 10^{+53}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;y \leq 5.116528806224703 \cdot 10^{+57}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]
Alternative 11
Error15.1
Cost712
\[\begin{array}{l} t_1 := y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{if}\;y \leq -1.1946151379230837 \cdot 10^{+53}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 3.307153294452222 \cdot 10^{+24}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 12
Error32.0
Cost456
\[\begin{array}{l} \mathbf{if}\;y \leq -1.514595472517589 \cdot 10^{-12}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;y \leq 2.7481363253719933 \cdot 10^{-45}:\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]
Alternative 13
Error38.7
Cost192
\[y \cdot 5 \]

Error

Reproduce

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