Average Error: 0.1 → 0.1
Time: 15.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(\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 y 5.0 (* 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(y, 5.0, (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(y, 5.0, 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[(y * 5.0 + 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(y, 5, 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.1

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

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

Alternatives

Alternative 1
Error33.9
Cost1508
\[\begin{array}{l} t_1 := y \cdot \left(x \cdot 2\right)\\ t_2 := z \cdot \left(x \cdot 2\right)\\ \mathbf{if}\;x \leq -2.1 \cdot 10^{+141}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq -1.0553992558608906 \cdot 10^{-71}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -3.898276757502309 \cdot 10^{-124}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 2.112528506255057 \cdot 10^{-125}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.92351541277789 \cdot 10^{-94}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 1.9553227416084183 \cdot 10^{-75}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 5749.860309125221:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 2.3 \cdot 10^{+61}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 5.8 \cdot 10^{+144}:\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error23.0
Cost1372
\[\begin{array}{l} t_1 := x \cdot \left(t + y \cdot 2\right)\\ t_2 := x \cdot \left(t + z \cdot 2\right)\\ \mathbf{if}\;x \leq -2.15 \cdot 10^{+141}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.35 \cdot 10^{+85}:\\ \;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{elif}\;x \leq -3.898276757502309 \cdot 10^{-124}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 1.991804369666201 \cdot 10^{-144}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.92351541277789 \cdot 10^{-94}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 1.9553227416084183 \cdot 10^{-75}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 5749.860309125221:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error11.0
Cost1360
\[\begin{array}{l} t_1 := x \cdot \left(\left(y + z\right) \cdot 2 + t\right)\\ \mathbf{if}\;x \leq -8.715254566785824 \cdot 10^{-119}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.3344253483317512 \cdot 10^{-126}:\\ \;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \leq 5.319790113995197 \cdot 10^{-104}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;x \leq 0.00037907154916533525:\\ \;\;\;\;z \cdot \left(x \cdot 2\right) + y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error24.1
Cost1108
\[\begin{array}{l} t_1 := x \cdot \left(t + z \cdot 2\right)\\ \mathbf{if}\;x \leq -3.898276757502309 \cdot 10^{-124}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.991804369666201 \cdot 10^{-144}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.92351541277789 \cdot 10^{-94}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.9553227416084183 \cdot 10^{-75}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 5.9 \cdot 10^{+144}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x \cdot 2\right)\\ \end{array} \]
Alternative 5
Error23.2
Cost1108
\[\begin{array}{l} t_1 := x \cdot \left(t + z \cdot 2\right)\\ \mathbf{if}\;x \leq -3.898276757502309 \cdot 10^{-124}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.991804369666201 \cdot 10^{-144}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.92351541277789 \cdot 10^{-94}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.9553227416084183 \cdot 10^{-75}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 6.8 \cdot 10^{+143}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \end{array} \]
Alternative 6
Error16.9
Cost1108
\[\begin{array}{l} t_1 := x \cdot \left(t + y \cdot 2\right)\\ t_2 := x \cdot \left(t + z \cdot 2\right)\\ \mathbf{if}\;x \leq -2.15 \cdot 10^{+141}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.35 \cdot 10^{+85}:\\ \;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{elif}\;x \leq -1.790296397342562 \cdot 10^{-96}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 1.9553227416084183 \cdot 10^{-75}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;x \leq 5749.860309125221:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error15.2
Cost1104
\[\begin{array}{l} t_1 := y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{if}\;y \leq -2.9079384283436724 \cdot 10^{+128}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -8.083104498388488 \cdot 10^{+96}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;y \leq -2.733933434286533 \cdot 10^{-148}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;y \leq 602641152.3689288:\\ \;\;\;\;2 \cdot \left(x \cdot z\right) + x \cdot t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Error11.1
Cost1104
\[\begin{array}{l} t_1 := y \cdot 5 + 2 \cdot \left(x \cdot z\right)\\ t_2 := x \cdot \left(\left(y + z\right) \cdot 2 + t\right)\\ \mathbf{if}\;x \leq -8.715254566785824 \cdot 10^{-119}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 2.3344253483317512 \cdot 10^{-126}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 5.319790113995197 \cdot 10^{-104}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;x \leq 1.192279306485456 \cdot 10^{-45}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 9
Error33.5
Cost984
\[\begin{array}{l} \mathbf{if}\;x \leq -2.1 \cdot 10^{+141}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq -1.0553992558608906 \cdot 10^{-71}:\\ \;\;\;\;z \cdot \left(x \cdot 2\right)\\ \mathbf{elif}\;x \leq -3.898276757502309 \cdot 10^{-124}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 2.112528506255057 \cdot 10^{-125}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.92351541277789 \cdot 10^{-94}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 1.192279306485456 \cdot 10^{-45}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]
Alternative 10
Error15.2
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 -2.9079384283436724 \cdot 10^{+128}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -8.083104498388488 \cdot 10^{+96}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -2.733933434286533 \cdot 10^{-148}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;y \leq 602641152.3689288:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 11
Error0.1
Cost960
\[\left(x \cdot \left(\left(y + z\right) \cdot 2\right) + x \cdot t\right) + y \cdot 5 \]
Alternative 12
Error10.7
Cost840
\[\begin{array}{l} t_1 := x \cdot \left(\left(y + z\right) \cdot 2 + t\right)\\ \mathbf{if}\;x \leq -1.790296397342562 \cdot 10^{-96}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.9553227416084183 \cdot 10^{-75}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 13
Error33.5
Cost720
\[\begin{array}{l} \mathbf{if}\;x \leq -3.898276757502309 \cdot 10^{-124}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 2.112528506255057 \cdot 10^{-125}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.92351541277789 \cdot 10^{-94}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 1.192279306485456 \cdot 10^{-45}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]
Alternative 14
Error38.1
Cost192
\[y \cdot 5 \]

Error

Reproduce

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