Average Error: 0.1 → 0.0
Time: 11.5s
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(5, y, 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 5.0 y (* 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(5.0, y, (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(5.0, y, 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[(5.0 * y + 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(5, y, 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(5, y, x \cdot \left(\left(y + z\right) \cdot 2 + t\right)\right)} \]
  3. Final simplification0.0

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

Alternatives

Alternative 1
Error0.1
Cost7104
\[\mathsf{fma}\left(x, \left(y + z\right) \cdot 2 + t, 5 \cdot y\right) \]
Alternative 2
Error26.6
Cost1372
\[\begin{array}{l} t_1 := 2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{if}\;x \leq -0.07018784524049974:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.910038828991574 \cdot 10^{-38}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 8.649444893928671 \cdot 10^{-76}:\\ \;\;\;\;5 \cdot y\\ \mathbf{elif}\;x \leq 1.3296886319608344 \cdot 10^{-56}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 8.314380142577797 \cdot 10^{-32}:\\ \;\;\;\;5 \cdot y\\ \mathbf{elif}\;x \leq 3 \cdot 10^{+88}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 10^{+183}:\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error17.1
Cost1372
\[\begin{array}{l} t_1 := x \cdot t + 5 \cdot y\\ t_2 := 2 \cdot \left(x \cdot z\right) + 5 \cdot y\\ \mathbf{if}\;x \leq -63947608556.62092:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{elif}\;x \leq -8.571435074495924 \cdot 10^{-109}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -4.734036140664148 \cdot 10^{-182}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -3.970493994461763 \cdot 10^{-251}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.2414041701829899 \cdot 10^{-73}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 1.9757190850307673 \cdot 10^{-24}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 5.2 \cdot 10^{+81}:\\ \;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \end{array} \]
Alternative 4
Error9.5
Cost1368
\[\begin{array}{l} t_1 := x \cdot t + 5 \cdot y\\ t_2 := x \cdot \left(\left(y + z\right) \cdot 2 + t\right)\\ t_3 := 2 \cdot \left(x \cdot z\right) + 5 \cdot y\\ \mathbf{if}\;x \leq -0.07018784524049974:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -8.571435074495924 \cdot 10^{-109}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -4.734036140664148 \cdot 10^{-182}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq -3.970493994461763 \cdot 10^{-251}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.2414041701829899 \cdot 10^{-73}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 8.314380142577797 \cdot 10^{-32}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 5
Error9.3
Cost1368
\[\begin{array}{l} t_1 := x \cdot t + 5 \cdot y\\ t_2 := x \cdot \left(\left(y + z\right) \cdot 2 + t\right)\\ t_3 := 2 \cdot \left(x \cdot z\right) + 5 \cdot y\\ \mathbf{if}\;x \leq -0.07018784524049974:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -8.571435074495924 \cdot 10^{-109}:\\ \;\;\;\;x \cdot t + y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{elif}\;x \leq -4.734036140664148 \cdot 10^{-182}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq -3.970493994461763 \cdot 10^{-251}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.2414041701829899 \cdot 10^{-73}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 8.314380142577797 \cdot 10^{-32}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 6
Error32.3
Cost1112
\[\begin{array}{l} \mathbf{if}\;x \leq -2064878861918055.5:\\ \;\;\;\;2 \cdot \left(y \cdot x\right)\\ \mathbf{elif}\;x \leq -1.910038828991574 \cdot 10^{-38}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 8.649444893928671 \cdot 10^{-76}:\\ \;\;\;\;5 \cdot y\\ \mathbf{elif}\;x \leq 1.3296886319608344 \cdot 10^{-56}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 8.314380142577797 \cdot 10^{-32}:\\ \;\;\;\;5 \cdot y\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{+105}:\\ \;\;\;\;z \cdot \left(x \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]
Alternative 7
Error26.0
Cost1108
\[\begin{array}{l} t_1 := x \cdot \left(t + y \cdot 2\right)\\ \mathbf{if}\;x \leq -1.910038828991574 \cdot 10^{-38}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 8.649444893928671 \cdot 10^{-76}:\\ \;\;\;\;5 \cdot y\\ \mathbf{elif}\;x \leq 1.3296886319608344 \cdot 10^{-56}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 8.314380142577797 \cdot 10^{-32}:\\ \;\;\;\;5 \cdot y\\ \mathbf{elif}\;x \leq 3 \cdot 10^{+88}:\\ \;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Error32.3
Cost984
\[\begin{array}{l} t_1 := z \cdot \left(x \cdot 2\right)\\ \mathbf{if}\;y \leq -1796.943448307833:\\ \;\;\;\;5 \cdot y\\ \mathbf{elif}\;y \leq -5.060888449991652 \cdot 10^{-127}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;y \leq -2.852408274113357 \cdot 10^{-220}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 7.540491452358505 \cdot 10^{-264}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;y \leq 3.413598606064249 \cdot 10^{-132}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 412851.5591902805:\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;5 \cdot y\\ \end{array} \]
Alternative 9
Error1.1
Cost968
\[\begin{array}{l} t_1 := x \cdot \left(\left(y + z\right) \cdot 2 + t\right)\\ \mathbf{if}\;x \leq -46991497894285.87:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 5.317623065941351 \cdot 10^{-12}:\\ \;\;\;\;5 \cdot y + x \cdot \left(t + z \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Error0.1
Cost960
\[\left(x \cdot \left(\left(y + z\right) \cdot 2\right) + x \cdot t\right) + 5 \cdot y \]
Alternative 11
Error17.7
Cost844
\[\begin{array}{l} t_1 := x \cdot \left(t + y \cdot 2\right)\\ \mathbf{if}\;x \leq -63947608556.62092:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.9757190850307673 \cdot 10^{-24}:\\ \;\;\;\;x \cdot t + 5 \cdot y\\ \mathbf{elif}\;x \leq 3 \cdot 10^{+88}:\\ \;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 12
Error17.5
Cost844
\[\begin{array}{l} \mathbf{if}\;x \leq -63947608556.62092:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{elif}\;x \leq 1.9757190850307673 \cdot 10^{-24}:\\ \;\;\;\;x \cdot t + 5 \cdot y\\ \mathbf{elif}\;x \leq 5.2 \cdot 10^{+81}:\\ \;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \end{array} \]
Alternative 13
Error32.7
Cost720
\[\begin{array}{l} \mathbf{if}\;x \leq -1.910038828991574 \cdot 10^{-38}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 8.649444893928671 \cdot 10^{-76}:\\ \;\;\;\;5 \cdot y\\ \mathbf{elif}\;x \leq 1.3296886319608344 \cdot 10^{-56}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 8.314380142577797 \cdot 10^{-32}:\\ \;\;\;\;5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]
Alternative 14
Error38.9
Cost192
\[5 \cdot y \]

Error

Reproduce

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