Average Error: 0.1 → 0.0
Time: 6.6s
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.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(t + \left(y + z\right) \cdot 2\right)\right) \]

Alternatives

Alternative 1
Error0.1
Cost7104
\[\mathsf{fma}\left(x, t + \left(y + z\right) \cdot 2, y \cdot 5\right) \]
Alternative 2
Error24.9
Cost1504
\[\begin{array}{l} t_1 := \left(y + z\right) \cdot \left(x \cdot 2\right)\\ t_2 := y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{if}\;y \leq -1.36 \cdot 10^{-39}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -2.3 \cdot 10^{-88}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -2 \cdot 10^{-103}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{elif}\;y \leq -7 \cdot 10^{-255}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -4 \cdot 10^{-309}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;y \leq 7.6 \cdot 10^{-170}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;y \leq 5.2 \cdot 10^{-127}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;y \leq 1.82 \cdot 10^{-93}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Error31.3
Cost1376
\[\begin{array}{l} t_1 := 2 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;y \leq -3.8 \cdot 10^{-38}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;y \leq -1.15 \cdot 10^{-87}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -4 \cdot 10^{-101}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;y \leq -5 \cdot 10^{-254}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -2.4 \cdot 10^{-306}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;y \leq 6.4 \cdot 10^{-168}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 4.7 \cdot 10^{-127}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;y \leq 5.6 \cdot 10^{-84}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]
Alternative 4
Error27.9
Cost1108
\[\begin{array}{l} t_1 := 2 \cdot \left(x \cdot z\right)\\ t_2 := x \cdot \left(t + y \cdot 2\right)\\ \mathbf{if}\;x \leq -1.78 \cdot 10^{+75}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -8.5 \cdot 10^{+30}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -9.6 \cdot 10^{-7}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -7 \cdot 10^{-127}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.65 \cdot 10^{-9}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 5
Error15.1
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 -4.5 \cdot 10^{+54}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -4.5 \cdot 10^{-5}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.2 \cdot 10^{-38}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;y \leq 4.4 \cdot 10^{-85}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 6
Error0.7
Cost968
\[\begin{array}{l} t_1 := x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ \mathbf{if}\;x \leq -3900000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.8:\\ \;\;\;\;y \cdot 5 + x \cdot \left(t + \left(z + z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error0.1
Cost960
\[y \cdot 5 + x \cdot \left(t + \left(y + \left(z + \left(y + z\right)\right)\right)\right) \]
Alternative 8
Error26.4
Cost844
\[\begin{array}{l} t_1 := \left(y + z\right) \cdot \left(x \cdot 2\right)\\ \mathbf{if}\;x \leq -7 \cdot 10^{-127}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.5 \cdot 10^{-9}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 6 \cdot 10^{+34}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error11.0
Cost840
\[\begin{array}{l} t_1 := x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ \mathbf{if}\;x \leq -7 \cdot 10^{-127}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.16 \cdot 10^{-18}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Error9.9
Cost840
\[\begin{array}{l} t_1 := x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ \mathbf{if}\;x \leq -1.4 \cdot 10^{-62}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 7 \cdot 10^{-12}:\\ \;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Error15.2
Cost712
\[\begin{array}{l} t_1 := y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{if}\;y \leq -4.5 \cdot 10^{+54}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{-92}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 12
Error32.5
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -1.45 \cdot 10^{-62}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{-9}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]
Alternative 13
Error47.5
Cost192
\[x \cdot t \]

Error

Reproduce

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