?

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

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

Alternatives

Alternative 1
Error0.1
Cost7104
\[\mathsf{fma}\left(x, 2 \cdot \left(y + z\right) + t, y \cdot 5\right) \]
Alternative 2
Error35.3
Cost1772
\[\begin{array}{l} t_1 := \left(2 \cdot z\right) \cdot x\\ t_2 := y \cdot \left(5 + x\right)\\ \mathbf{if}\;t \leq -3.2 \cdot 10^{+116}:\\ \;\;\;\;t \cdot x\\ \mathbf{elif}\;t \leq -8.2 \cdot 10^{-11}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq -1.9 \cdot 10^{-53}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -6.5 \cdot 10^{-70}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;t \leq -2 \cdot 10^{-87}:\\ \;\;\;\;\left(2 \cdot x\right) \cdot y\\ \mathbf{elif}\;t \leq -3 \cdot 10^{-204}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 1.65 \cdot 10^{-242}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 8.1 \cdot 10^{-199}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 3.3 \cdot 10^{-31}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 9.5 \cdot 10^{+69}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 5.5 \cdot 10^{+151}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t \cdot x\\ \end{array} \]
Alternative 3
Error25.5
Cost1108
\[\begin{array}{l} t_1 := \left(2 \cdot y + t\right) \cdot x\\ t_2 := \left(2 \cdot \left(z + y\right)\right) \cdot x\\ \mathbf{if}\;x \leq -7.8 \cdot 10^{+133}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -0.0135:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{-17}:\\ \;\;\;\;y \cdot \left(5 + x\right)\\ \mathbf{elif}\;x \leq 1.8 \cdot 10^{+95}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 6.7 \cdot 10^{+121}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 4
Error9.3
Cost968
\[\begin{array}{l} t_1 := t \cdot x + \left(2 \cdot x + 5\right) \cdot y\\ \mathbf{if}\;y \leq -1.5 \cdot 10^{-90}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{-8}:\\ \;\;\;\;\left(t + 2 \cdot \left(y + z\right)\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error0.6
Cost968
\[\begin{array}{l} t_1 := \left(t + 2 \cdot \left(y + z\right)\right) \cdot x\\ \mathbf{if}\;x \leq -6500:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.5:\\ \;\;\;\;x \cdot \left(z \cdot 2 + t\right) + y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error0.6
Cost968
\[\begin{array}{l} \mathbf{if}\;x \leq -6500:\\ \;\;\;\;\left(2 \cdot z + y\right) \cdot x + \left(y + t\right) \cdot x\\ \mathbf{elif}\;x \leq 2.5:\\ \;\;\;\;x \cdot \left(z \cdot 2 + t\right) + y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;\left(t + 2 \cdot \left(y + z\right)\right) \cdot x\\ \end{array} \]
Alternative 7
Error0.1
Cost960
\[\left(2 \cdot z + t\right) \cdot x + \left(2 \cdot x + 5\right) \cdot y \]
Alternative 8
Error12.3
Cost840
\[\begin{array}{l} t_1 := \left(5 - -2 \cdot x\right) \cdot y\\ \mathbf{if}\;y \leq -1200000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 0.00022:\\ \;\;\;\;\left(t + 2 \cdot \left(y + z\right)\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error9.4
Cost840
\[\begin{array}{l} t_1 := \left(t + 2 \cdot \left(y + z\right)\right) \cdot x\\ \mathbf{if}\;x \leq -0.042:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 7.8 \cdot 10^{-23}:\\ \;\;\;\;5 \cdot y + \left(y + t\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Error0.1
Cost832
\[\left(2 \cdot \left(y + z\right) + t\right) \cdot x + y \cdot 5 \]
Alternative 11
Error25.5
Cost712
\[\begin{array}{l} t_1 := \left(2 \cdot \left(z + y\right)\right) \cdot x\\ \mathbf{if}\;x \leq -0.042:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{-16}:\\ \;\;\;\;y \cdot \left(5 + x\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 12
Error18.2
Cost712
\[\begin{array}{l} t_1 := y \cdot \left(5 + x\right)\\ \mathbf{if}\;y \leq -2600000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 0.00025:\\ \;\;\;\;\left(2 \cdot z + t\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 13
Error14.1
Cost712
\[\begin{array}{l} t_1 := \left(5 - -2 \cdot x\right) \cdot y\\ \mathbf{if}\;y \leq -0.28:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 0.00031:\\ \;\;\;\;\left(2 \cdot z + t\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 14
Error31.2
Cost584
\[\begin{array}{l} t_1 := y \cdot \left(5 + x\right)\\ \mathbf{if}\;y \leq -8.5 \cdot 10^{-112}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 0.00013:\\ \;\;\;\;t \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 15
Error31.9
Cost456
\[\begin{array}{l} \mathbf{if}\;y \leq -3.5 \cdot 10^{-91}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;y \leq 0.00014:\\ \;\;\;\;t \cdot x\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]
Alternative 16
Error46.7
Cost192
\[t \cdot x \]

Error

Reproduce?

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