Average Error: 0.1 → 0.0
Time: 22.8s
Precision: binary64
Cost: 7360
\[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
\[\left(y + z\right) \cdot x + \mathsf{fma}\left(5, y, \left(y + \left(t + z\right)\right) \cdot x\right) \]
(FPCore (x y z t)
 :precision binary64
 (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))
(FPCore (x y z t)
 :precision binary64
 (+ (* (+ y z) x) (fma 5.0 y (* (+ y (+ t z)) x))))
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 ((y + z) * x) + fma(5.0, y, ((y + (t + z)) * x));
}
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(Float64(Float64(y + z) * x) + fma(5.0, y, Float64(Float64(y + Float64(t + z)) * x)))
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[(y + z), $MachinePrecision] * x), $MachinePrecision] + N[(5.0 * y + N[(N[(y + N[(t + z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\left(y + z\right) \cdot x + \mathsf{fma}\left(5, y, \left(y + \left(t + z\right)\right) \cdot x\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}{\left(y + z\right) \cdot x + \left(\left(y + z\right) \cdot x + \left(x \cdot t + y \cdot 5\right)\right)} \]
  3. Taylor expanded in x around 0 0.1

    \[\leadsto \left(y + z\right) \cdot x + \color{blue}{\left(\left(y + \left(t + z\right)\right) \cdot x + 5 \cdot y\right)} \]
  4. Simplified0.0

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

Alternatives

Alternative 1
Error0.1
Cost7104
\[\mathsf{fma}\left(2 \cdot \left(z + y\right) + t, x, 5 \cdot y\right) \]
Alternative 2
Error34.3
Cost1376
\[\begin{array}{l} t_1 := x \cdot \left(y + y\right)\\ \mathbf{if}\;x \leq -2.2 \cdot 10^{+101}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -5.7 \cdot 10^{+62}:\\ \;\;\;\;t \cdot x\\ \mathbf{elif}\;x \leq -2.5:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -7.4 \cdot 10^{-121}:\\ \;\;\;\;5 \cdot y\\ \mathbf{elif}\;x \leq -1.9 \cdot 10^{-179}:\\ \;\;\;\;\left(2 \cdot z\right) \cdot x\\ \mathbf{elif}\;x \leq 3.2 \cdot 10^{-24}:\\ \;\;\;\;5 \cdot y\\ \mathbf{elif}\;x \leq 1.3 \cdot 10^{+52}:\\ \;\;\;\;t \cdot x\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{+191}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t \cdot x\\ \end{array} \]
Alternative 3
Error25.4
Cost1372
\[\begin{array}{l} t_1 := \left(2 \cdot x + 5\right) \cdot y\\ t_2 := x \cdot \left(2 \cdot y + t\right)\\ t_3 := x \cdot \left(2 \cdot \left(y + z\right)\right)\\ \mathbf{if}\;y \leq -1.65 \cdot 10^{-67}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 5.8 \cdot 10^{-269}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 3.8 \cdot 10^{-144}:\\ \;\;\;\;\left(2 \cdot z\right) \cdot x\\ \mathbf{elif}\;y \leq 2.6 \cdot 10^{-93}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 10^{-51}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;y \leq 4.5 \cdot 10^{-30}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 3.8 \cdot 10^{-27}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error17.9
Cost1240
\[\begin{array}{l} t_1 := t \cdot x + y \cdot 5\\ t_2 := x \cdot \left(2 \cdot y + t\right)\\ t_3 := \left(2 \cdot z + t\right) \cdot x\\ \mathbf{if}\;x \leq -2.5:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -1.12 \cdot 10^{-121}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.8 \cdot 10^{-169}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 3.9 \cdot 10^{-28}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.85 \cdot 10^{+72}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 3 \cdot 10^{+170}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 5
Error32.9
Cost1112
\[\begin{array}{l} t_1 := x \cdot \left(y + y\right)\\ \mathbf{if}\;x \leq -3.6 \cdot 10^{+101}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -9 \cdot 10^{+63}:\\ \;\;\;\;t \cdot x\\ \mathbf{elif}\;x \leq -2.5:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 7 \cdot 10^{-24}:\\ \;\;\;\;5 \cdot y\\ \mathbf{elif}\;x \leq 2 \cdot 10^{+53}:\\ \;\;\;\;t \cdot x\\ \mathbf{elif}\;x \leq 8.2 \cdot 10^{+192}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t \cdot x\\ \end{array} \]
Alternative 6
Error11.0
Cost1104
\[\begin{array}{l} t_1 := t \cdot x + y \cdot 5\\ t_2 := \left(t + 2 \cdot \left(y + z\right)\right) \cdot x\\ \mathbf{if}\;x \leq -1.65 \cdot 10^{-7}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -1.2 \cdot 10^{-121}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.8 \cdot 10^{-169}:\\ \;\;\;\;\left(2 \cdot z + t\right) \cdot x\\ \mathbf{elif}\;x \leq 3.8 \cdot 10^{-28}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 7
Error10.0
Cost1104
\[\begin{array}{l} t_1 := \left(z + z\right) \cdot x + y \cdot 5\\ t_2 := \left(t + 2 \cdot \left(y + z\right)\right) \cdot x\\ \mathbf{if}\;x \leq -4.6 \cdot 10^{-10}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 4.2 \cdot 10^{-77}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 5.8 \cdot 10^{-37}:\\ \;\;\;\;t \cdot x + y \cdot 5\\ \mathbf{elif}\;x \leq 1.7 \cdot 10^{-24}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 8
Error0.8
Cost1096
\[\begin{array}{l} t_1 := \left(t + 2 \cdot \left(y + z\right)\right) \cdot x\\ \mathbf{if}\;x \leq -2.5:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.58 \cdot 10^{+14}:\\ \;\;\;\;x \cdot \left(\left(\left(z + z\right) + y\right) + t\right) + y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error27.6
Cost976
\[\begin{array}{l} t_1 := x \cdot \left(2 \cdot \left(y + z\right)\right)\\ \mathbf{if}\;x \leq -1.5 \cdot 10^{-6}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.12 \cdot 10^{-121}:\\ \;\;\;\;5 \cdot y\\ \mathbf{elif}\;x \leq -1.9 \cdot 10^{-179}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 3.9 \cdot 10^{-31}:\\ \;\;\;\;5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Error27.8
Cost976
\[\begin{array}{l} t_1 := x \cdot \left(2 \cdot y + t\right)\\ \mathbf{if}\;x \leq -6.5 \cdot 10^{-11}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.12 \cdot 10^{-121}:\\ \;\;\;\;5 \cdot y\\ \mathbf{elif}\;x \leq -1.9 \cdot 10^{-179}:\\ \;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right)\\ \mathbf{elif}\;x \leq 6.6 \cdot 10^{-24}:\\ \;\;\;\;5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Error0.1
Cost960
\[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
Alternative 12
Error0.1
Cost960
\[\left(2 \cdot z + t\right) \cdot x + \left(2 \cdot x + 5\right) \cdot y \]
Alternative 13
Error14.7
Cost712
\[\begin{array}{l} t_1 := \left(2 \cdot x + 5\right) \cdot y\\ \mathbf{if}\;y \leq -2.6 \cdot 10^{-67}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 10^{-9}:\\ \;\;\;\;\left(2 \cdot z + t\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 14
Error32.5
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -1.95 \cdot 10^{-7}:\\ \;\;\;\;t \cdot x\\ \mathbf{elif}\;x \leq 3 \cdot 10^{-24}:\\ \;\;\;\;5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;t \cdot x\\ \end{array} \]
Alternative 15
Error39.1
Cost192
\[5 \cdot y \]

Error

Reproduce

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