?

Average Accuracy: 99.9% → 99.9%
Time: 11.9s
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 99.9%

    \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
  2. Applied egg-rr99.9%

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

    [Start]99.9

    \[ x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]

    +-commutative [=>]99.9

    \[ \color{blue}{y \cdot 5 + x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right)} \]

    fma-def [=>]99.9

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

    associate-+l+ [=>]99.9

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

    *-un-lft-identity [=>]99.9

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

    +-commutative [<=]99.9

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

    *-un-lft-identity [=>]99.9

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

    distribute-rgt-out [=>]99.9

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

    metadata-eval [=>]99.9

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

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

Alternatives

Alternative 1
Accuracy99.9%
Cost7104
\[\mathsf{fma}\left(x, t + \left(y + z\right) \cdot 2, y \cdot 5\right) \]
Alternative 2
Accuracy42.9%
Cost1644
\[\begin{array}{l} t_1 := 2 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;t \leq -5.8 \cdot 10^{+118}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;t \leq -4.45 \cdot 10^{+46}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;t \leq -8500:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;t \leq -5.7 \cdot 10^{-151}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;t \leq -5 \cdot 10^{-168}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -1.55 \cdot 10^{-287}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;t \leq 5.5 \cdot 10^{-182}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 8.2 \cdot 10^{-112}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;t \leq 4.2 \cdot 10^{-56}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 1.12 \cdot 10^{-14}:\\ \;\;\;\;y \cdot \left(x \cdot 2\right)\\ \mathbf{elif}\;t \leq 1.5 \cdot 10^{+68}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]
Alternative 3
Accuracy60.8%
Cost1240
\[\begin{array}{l} t_1 := \left(y + z\right) \cdot \left(x \cdot 2\right)\\ t_2 := y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{if}\;y \leq -4400000:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 1.05 \cdot 10^{-276}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.1 \cdot 10^{-171}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{-129}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{-82}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{-6}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 4
Accuracy61.0%
Cost1240
\[\begin{array}{l} t_1 := \left(y + z\right) \cdot \left(x \cdot 2\right)\\ t_2 := y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{if}\;y \leq -42:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 9 \cdot 10^{-277}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 6.6 \cdot 10^{-171}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{elif}\;y \leq 4.6 \cdot 10^{-129}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;y \leq 8 \cdot 10^{-82}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;y \leq 4.3 \cdot 10^{-8}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 5
Accuracy71.2%
Cost1104
\[\begin{array}{l} t_1 := x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ \mathbf{if}\;x \leq -5.6 \cdot 10^{-127}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.1 \cdot 10^{-162}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq -4.5 \cdot 10^{-241}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;x \leq 5.2 \cdot 10^{-102}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Accuracy82.4%
Cost1104
\[\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)\\ \mathbf{if}\;x \leq -5.2 \cdot 10^{-14}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -9.5 \cdot 10^{-76}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.1 \cdot 10^{-121}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;x \leq 5.2 \cdot 10^{-99}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 7
Accuracy82.3%
Cost1104
\[\begin{array}{l} t_1 := x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ \mathbf{if}\;x \leq -5.5 \cdot 10^{-14}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1 \cdot 10^{-75}:\\ \;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{elif}\;x \leq -1.1 \cdot 10^{-121}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;x \leq 7 \cdot 10^{-101}:\\ \;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Accuracy88.6%
Cost969
\[\begin{array}{l} \mathbf{if}\;t \leq -2.7 \cdot 10^{-33} \lor \neg \left(t \leq 1.8 \cdot 10^{+34}\right):\\ \;\;\;\;y \cdot 5 + x \cdot \left(y + \left(y + t\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \end{array} \]
Alternative 9
Accuracy99.9%
Cost960
\[y \cdot 5 + x \cdot \left(t + \left(y + \left(z + \left(y + z\right)\right)\right)\right) \]
Alternative 10
Accuracy50.5%
Cost852
\[\begin{array}{l} t_1 := 2 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;y \leq -340:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;y \leq 9.6 \cdot 10^{-277}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 6 \cdot 10^{-170}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;y \leq 2.85 \cdot 10^{-129}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{-81}:\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]
Alternative 11
Accuracy47.8%
Cost721
\[\begin{array}{l} \mathbf{if}\;x \leq -5 \cdot 10^{-14}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq -3.7 \cdot 10^{-75} \lor \neg \left(x \leq -1.02 \cdot 10^{-121}\right) \land x \leq 2.4 \cdot 10^{-78}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]
Alternative 12
Accuracy57.7%
Cost713
\[\begin{array}{l} \mathbf{if}\;x \leq -3.9 \cdot 10^{-125} \lor \neg \left(x \leq 4.3 \cdot 10^{-69}\right):\\ \;\;\;\;\left(y + z\right) \cdot \left(x \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]
Alternative 13
Accuracy78.0%
Cost713
\[\begin{array}{l} \mathbf{if}\;y \leq -800 \lor \neg \left(y \leq 5.5 \cdot 10^{-8}\right):\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \end{array} \]
Alternative 14
Accuracy26.3%
Cost192
\[x \cdot t \]

Error

Reproduce?

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