?

Average Error: 0.1 → 0.1
Time: 10.6s
Precision: binary64
Cost: 7232

?

\[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
\[\mathsf{fma}\left(\left(y + z\right) \cdot 2, x, x \cdot t\right) + y \cdot 5 \]
(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 z) 2.0) x (* x t)) (* y 5.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 + z) * 2.0), x, (x * t)) + (y * 5.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 Float64(fma(Float64(Float64(y + z) * 2.0), x, Float64(x * t)) + Float64(y * 5.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[(N[(N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision] * x + N[(x * t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\mathsf{fma}\left(\left(y + z\right) \cdot 2, x, x \cdot t\right) + y \cdot 5

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(\left(y + z\right) \cdot 2, x, x \cdot t\right)} + y \cdot 5 \]
  3. Final simplification0.1

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

Alternatives

Alternative 1
Error32.7
Cost1244
\[\begin{array}{l} t_1 := y \cdot \left(2 \cdot x\right)\\ \mathbf{if}\;x \leq -2.05 \cdot 10^{+79}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq -2.8 \cdot 10^{+41}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -3.4 \cdot 10^{-31}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 13200000:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 6.6 \cdot 10^{+72}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 4.5 \cdot 10^{+96}:\\ \;\;\;\;2 \cdot \left(z \cdot x\right)\\ \mathbf{elif}\;x \leq 10^{+164}:\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error25.3
Cost1108
\[\begin{array}{l} t_1 := \left(y + z\right) \cdot \left(2 \cdot x\right)\\ t_2 := x \cdot \left(t + y \cdot 2\right)\\ t_3 := y \cdot \left(5 + 2 \cdot x\right)\\ \mathbf{if}\;y \leq -2.95 \cdot 10^{-16}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;y \leq 6.5 \cdot 10^{-259}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.6 \cdot 10^{-152}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 5.8 \cdot 10^{-84}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.3 \cdot 10^{+16}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 3
Error16.7
Cost1108
\[\begin{array}{l} t_1 := x \cdot \left(t + z \cdot 2\right)\\ \mathbf{if}\;x \leq -1.85 \cdot 10^{+136}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -3.4 \cdot 10^{+38}:\\ \;\;\;\;\left(y + z\right) \cdot \left(2 \cdot x\right)\\ \mathbf{elif}\;x \leq -4.8 \cdot 10^{-30}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.05 \cdot 10^{-37}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;x \leq 3.05 \cdot 10^{+143}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \end{array} \]
Alternative 4
Error15.2
Cost978
\[\begin{array}{l} \mathbf{if}\;y \leq -3.1 \cdot 10^{+86} \lor \neg \left(y \leq -4.3 \cdot 10^{+24}\right) \land \left(y \leq -1.35 \cdot 10^{-9} \lor \neg \left(y \leq 1.42 \cdot 10^{+17}\right)\right):\\ \;\;\;\;y \cdot \left(5 + 2 \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \end{array} \]
Alternative 5
Error25.8
Cost977
\[\begin{array}{l} t_1 := x \cdot \left(t + y \cdot 2\right)\\ \mathbf{if}\;x \leq -3.6 \cdot 10^{-31}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 0.072:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.15 \cdot 10^{+73} \lor \neg \left(x \leq 6 \cdot 10^{+95}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\left(y + z\right) \cdot \left(2 \cdot x\right)\\ \end{array} \]
Alternative 6
Error9.9
Cost969
\[\begin{array}{l} \mathbf{if}\;x \leq -5.5 \cdot 10^{-30} \lor \neg \left(x \leq 1.65 \cdot 10^{-31}\right):\\ \;\;\;\;x \cdot \left(\left(y + z\right) \cdot 2\right) + x \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \end{array} \]
Alternative 7
Error9.8
Cost969
\[\begin{array}{l} \mathbf{if}\;x \leq -1.5 \cdot 10^{-30} \lor \neg \left(x \leq 0.225\right):\\ \;\;\;\;x \cdot \left(\left(y + z\right) \cdot 2\right) + x \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5 + x \cdot \left(t + y \cdot 2\right)\\ \end{array} \]
Alternative 8
Error0.1
Cost960
\[\left(y \cdot 5 + x \cdot \left(\left(y + z\right) \cdot 2\right)\right) + x \cdot t \]
Alternative 9
Error32.3
Cost852
\[\begin{array}{l} t_1 := 2 \cdot \left(z \cdot x\right)\\ \mathbf{if}\;y \leq -1.06 \cdot 10^{-14}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;y \leq 10^{-258}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 8.8 \cdot 10^{-158}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;y \leq 1.05 \cdot 10^{-47}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2 \cdot 10^{+16}:\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]
Alternative 10
Error9.9
Cost841
\[\begin{array}{l} \mathbf{if}\;x \leq -2.4 \cdot 10^{-30} \lor \neg \left(x \leq 1.3 \cdot 10^{-37}\right):\\ \;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \end{array} \]
Alternative 11
Error0.1
Cost832
\[y \cdot 5 + x \cdot \left(t + \left(y + z\right) \cdot 2\right) \]
Alternative 12
Error25.8
Cost713
\[\begin{array}{l} \mathbf{if}\;x \leq -3.8 \cdot 10^{-31} \lor \neg \left(x \leq 0.072\right):\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]
Alternative 13
Error32.5
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -4 \cdot 10^{-31}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 13200000:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]
Alternative 14
Error47.2
Cost192
\[x \cdot t \]

Error

Reproduce?

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