Average Error: 0.1 → 0.0
Time: 11.9s
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
Error15.4
Cost1236
\[\begin{array}{l} t_1 := y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{if}\;y \leq -1.6943556747065267 \cdot 10^{+52}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -9.211145413881336 \cdot 10^{+36}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;y \leq -2.0999557055183067 \cdot 10^{-67}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.4939117274220489 \cdot 10^{-111}:\\ \;\;\;\;x \cdot \left(z \cdot 2\right) + x \cdot t\\ \mathbf{elif}\;y \leq 8.932705139986231 \cdot 10^{+85}:\\ \;\;\;\;y \cdot 5 + z \cdot \left(x \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error15.4
Cost1236
\[\begin{array}{l} t_1 := y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{if}\;y \leq -1.6943556747065267 \cdot 10^{+52}:\\ \;\;\;\;y \cdot 5 + x \cdot \left(y \cdot 2\right)\\ \mathbf{elif}\;y \leq -9.211145413881336 \cdot 10^{+36}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;y \leq -2.0999557055183067 \cdot 10^{-67}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.4939117274220489 \cdot 10^{-111}:\\ \;\;\;\;x \cdot \left(z \cdot 2\right) + x \cdot t\\ \mathbf{elif}\;y \leq 8.932705139986231 \cdot 10^{+85}:\\ \;\;\;\;y \cdot 5 + z \cdot \left(x \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error16.3
Cost1104
\[\begin{array}{l} t_1 := y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{if}\;y \leq -1.6943556747065267 \cdot 10^{+52}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -9.211145413881336 \cdot 10^{+36}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;y \leq -2.0999557055183067 \cdot 10^{-67}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.6884516740184029 \cdot 10^{-97}:\\ \;\;\;\;x \cdot \left(z \cdot 2\right) + x \cdot t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error33.0
Cost984
\[\begin{array}{l} t_1 := z \cdot \left(x \cdot 2\right)\\ \mathbf{if}\;y \leq -1.047789951213995 \cdot 10^{-112}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;y \leq -1.5885666356021187 \cdot 10^{-215}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;y \leq -3.472935259046197 \cdot 10^{-250}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.382762192175633 \cdot 10^{-270}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;y \leq 1.5622256122845442 \cdot 10^{-181}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.4939117274220489 \cdot 10^{-111}:\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]
Alternative 5
Error21.8
Cost976
\[\begin{array}{l} t_1 := x \cdot \left(t + z \cdot 2\right)\\ \mathbf{if}\;y \leq -1.6943556747065267 \cdot 10^{+52}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;y \leq -5.039456862664458 \cdot 10^{+32}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -4.887919779799315 \cdot 10^{-52}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;y \leq 1.6884516740184029 \cdot 10^{-97}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]
Alternative 6
Error16.3
Cost976
\[\begin{array}{l} t_1 := x \cdot \left(t + z \cdot 2\right)\\ t_2 := y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{if}\;y \leq -1.6943556747065267 \cdot 10^{+52}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -9.211145413881336 \cdot 10^{+36}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -2.0999557055183067 \cdot 10^{-67}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 1.6884516740184029 \cdot 10^{-97}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 7
Error10.3
Cost968
\[\begin{array}{l} t_1 := y \cdot 5 + 2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{if}\;y \leq -4.616864093037529 \cdot 10^{-111}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.4939117274220489 \cdot 10^{-111}:\\ \;\;\;\;x \cdot \left(z \cdot 2\right) + x \cdot t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Error7.6
Cost968
\[\begin{array}{l} t_1 := y \cdot 5 + x \cdot \left(t + y \cdot 2\right)\\ \mathbf{if}\;t \leq -1.6263857670574428 \cdot 10^{-49}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 3.6034836119339164 \cdot 10^{-5}:\\ \;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error0.1
Cost960
\[\left(x \cdot \left(\left(y + z\right) \cdot 2\right) + x \cdot t\right) + y \cdot 5 \]
Alternative 10
Error32.7
Cost456
\[\begin{array}{l} \mathbf{if}\;y \leq -1.047789951213995 \cdot 10^{-112}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;y \leq 1.4939117274220489 \cdot 10^{-111}:\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]
Alternative 11
Error38.9
Cost192
\[y \cdot 5 \]

Error

Reproduce

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