?

Average Error: 0.1 → 0.0
Time: 10.1s
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
Error10.2
Cost1368
\[\begin{array}{l} t_1 := y \cdot 5 + 2 \cdot \left(x \cdot z\right)\\ t_2 := x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ t_3 := x \cdot t + y \cdot 5\\ \mathbf{if}\;x \leq -6.2:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -9.5 \cdot 10^{-7}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{elif}\;x \leq -1.5 \cdot 10^{-41}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 8.2 \cdot 10^{-184}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.65 \cdot 10^{-110}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 1.35 \cdot 10^{-11}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Error9.8
Cost1104
\[\begin{array}{l} t_1 := x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ \mathbf{if}\;x \leq -6.7:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -6.6 \cdot 10^{-9}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{elif}\;x \leq -3.4 \cdot 10^{-28}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;x \leq 4 \cdot 10^{-12}:\\ \;\;\;\;x \cdot t + y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error27.4
Cost977
\[\begin{array}{l} t_1 := y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{if}\;y \leq -1.08 \cdot 10^{-55}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -9.5 \cdot 10^{-175}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;y \leq -1.95 \cdot 10^{-203} \lor \neg \left(y \leq 4.1 \cdot 10^{-44}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \end{array} \]
Alternative 5
Error0.8
Cost969
\[\begin{array}{l} \mathbf{if}\;x \leq -2.5 \lor \neg \left(x \leq 1.18 \cdot 10^{-9}\right):\\ \;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + \left(z + z\right)\right) + y \cdot 5\\ \end{array} \]
Alternative 6
Error0.1
Cost960
\[x \cdot \left(t + \left(y + \left(z + \left(y + z\right)\right)\right)\right) + y \cdot 5 \]
Alternative 7
Error0.1
Cost960
\[x \cdot \left(\left(y + z\right) \cdot 2\right) + \left(x \cdot t + y \cdot 5\right) \]
Alternative 8
Error15.9
Cost844
\[\begin{array}{l} t_1 := y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{if}\;y \leq -9 \cdot 10^{+100}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -4.2 \cdot 10^{-203}:\\ \;\;\;\;x \cdot t + y \cdot 5\\ \mathbf{elif}\;y \leq 6 \cdot 10^{-44}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error32.4
Cost716
\[\begin{array}{l} \mathbf{if}\;y \leq -1.3 \cdot 10^{-50}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;y \leq -2 \cdot 10^{-174}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;y \leq 4.4 \cdot 10^{-44}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]
Alternative 10
Error14.8
Cost713
\[\begin{array}{l} \mathbf{if}\;y \leq -0.0265 \lor \neg \left(y \leq 7.8 \cdot 10^{-44}\right):\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \end{array} \]
Alternative 11
Error32.0
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -0.028:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 3.5 \cdot 10^{-12}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]
Alternative 12
Error38.7
Cost192
\[y \cdot 5 \]

Error

Reproduce?

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