?

Average Error: 0.12% → 0.05%
Time: 9.8s
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.12

    \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
  2. Applied egg-rr0.05

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

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

Alternatives

Alternative 1
Error20.97%
Cost1499
\[\begin{array}{l} \mathbf{if}\;z \leq -1.25 \cdot 10^{+77} \lor \neg \left(z \leq -4.4 \cdot 10^{+14}\right) \land \left(z \leq -4.2 \cdot 10^{-33} \lor \neg \left(z \leq 1.18 \cdot 10^{-185} \lor \neg \left(z \leq 10^{-52}\right) \land z \leq 2.2 \cdot 10^{-21}\right)\right):\\ \;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \end{array} \]
Alternative 2
Error40.56%
Cost1108
\[\begin{array}{l} t_1 := 2 \cdot \left(x \cdot \left(y + z\right)\right)\\ t_2 := y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{if}\;y \leq -63000000000:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 5 \cdot 10^{-305}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 5.2 \cdot 10^{-263}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;y \leq 1.36 \cdot 10^{-208}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 9 \cdot 10^{-107}:\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Error22.92%
Cost1108
\[\begin{array}{l} t_1 := y \cdot \left(5 + x \cdot 2\right)\\ t_2 := x \cdot \left(t + z \cdot 2\right)\\ \mathbf{if}\;y \leq -5.9 \cdot 10^{+157}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.85 \cdot 10^{-86}:\\ \;\;\;\;y \cdot 5 + x \cdot \left(z + z\right)\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{-95}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{-27}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;y \leq 3400000:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error48.18%
Cost976
\[\begin{array}{l} t_1 := 2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{if}\;y \leq -1.65 \cdot 10^{+15}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;y \leq 3.55 \cdot 10^{-304}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 8.2 \cdot 10^{-263}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;y \leq 1.6 \cdot 10^{-208}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 4000:\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]
Alternative 5
Error24.06%
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 -1.9 \cdot 10^{+72}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 3.4 \cdot 10^{-95}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.35 \cdot 10^{-27}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;y \leq 1800000000:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 6
Error6.87%
Cost969
\[\begin{array}{l} \mathbf{if}\;t \leq -8 \cdot 10^{-185} \lor \neg \left(t \leq 86000000\right):\\ \;\;\;\;y \cdot 5 + x \cdot \left(t + z \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \end{array} \]
Alternative 7
Error0.12%
Cost960
\[x \cdot \left(t + \left(y + \left(z + \left(y + z\right)\right)\right)\right) + y \cdot 5 \]
Alternative 8
Error49.91%
Cost852
\[\begin{array}{l} t_1 := z \cdot \left(x \cdot 2\right)\\ \mathbf{if}\;y \leq -90000000000:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;y \leq 8.7 \cdot 10^{-302}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 5.6 \cdot 10^{-263}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;y \leq 1.65 \cdot 10^{-208}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 4000:\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]
Alternative 9
Error50.26%
Cost722
\[\begin{array}{l} \mathbf{if}\;x \leq -4.05 \cdot 10^{-10} \lor \neg \left(x \leq -7.2 \cdot 10^{-125}\right) \land \left(x \leq -1.15 \cdot 10^{-144} \lor \neg \left(x \leq 2.7 \cdot 10^{-16}\right)\right):\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]
Alternative 10
Error23.83%
Cost713
\[\begin{array}{l} \mathbf{if}\;y \leq -1.35 \cdot 10^{+72} \lor \neg \left(y \leq 180000000\right):\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \end{array} \]
Alternative 11
Error73.25%
Cost192
\[x \cdot t \]

Error

Reproduce?

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