Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendInside from plot-0.2.3.4

Percentage Accurate: 99.9% → 100.0%
Time: 5.8s
Alternatives: 9
Speedup: 1.2×

Specification

?
\[\begin{array}{l} \\ \left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \end{array} \]
(FPCore (x y z) :precision binary64 (+ (+ (+ (+ (+ x y) y) x) z) x))
double code(double x, double y, double z) {
	return ((((x + y) + y) + x) + z) + x;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = ((((x + y) + y) + x) + z) + x
end function
public static double code(double x, double y, double z) {
	return ((((x + y) + y) + x) + z) + x;
}
def code(x, y, z):
	return ((((x + y) + y) + x) + z) + x
function code(x, y, z)
	return Float64(Float64(Float64(Float64(Float64(x + y) + y) + x) + z) + x)
end
function tmp = code(x, y, z)
	tmp = ((((x + y) + y) + x) + z) + x;
end
code[x_, y_, z_] := N[(N[(N[(N[(N[(x + y), $MachinePrecision] + y), $MachinePrecision] + x), $MachinePrecision] + z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 9 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 99.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \end{array} \]
(FPCore (x y z) :precision binary64 (+ (+ (+ (+ (+ x y) y) x) z) x))
double code(double x, double y, double z) {
	return ((((x + y) + y) + x) + z) + x;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = ((((x + y) + y) + x) + z) + x
end function
public static double code(double x, double y, double z) {
	return ((((x + y) + y) + x) + z) + x;
}
def code(x, y, z):
	return ((((x + y) + y) + x) + z) + x
function code(x, y, z)
	return Float64(Float64(Float64(Float64(Float64(x + y) + y) + x) + z) + x)
end
function tmp = code(x, y, z)
	tmp = ((((x + y) + y) + x) + z) + x;
end
code[x_, y_, z_] := N[(N[(N[(N[(N[(x + y), $MachinePrecision] + y), $MachinePrecision] + x), $MachinePrecision] + z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x
\end{array}

Alternative 1: 100.0% accurate, 0.1× speedup?

\[\begin{array}{l} \\ z + \mathsf{fma}\left(3, x, y \cdot 2\right) \end{array} \]
(FPCore (x y z) :precision binary64 (+ z (fma 3.0 x (* y 2.0))))
double code(double x, double y, double z) {
	return z + fma(3.0, x, (y * 2.0));
}
function code(x, y, z)
	return Float64(z + fma(3.0, x, Float64(y * 2.0)))
end
code[x_, y_, z_] := N[(z + N[(3.0 * x + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
z + \mathsf{fma}\left(3, x, y \cdot 2\right)
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
  2. Step-by-step derivation
    1. +-commutative99.9%

      \[\leadsto \color{blue}{\left(z + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} + x \]
    2. associate-+l+99.9%

      \[\leadsto \color{blue}{z + \left(\left(\left(\left(x + y\right) + y\right) + x\right) + x\right)} \]
    3. +-commutative99.9%

      \[\leadsto z + \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} \]
    4. +-commutative99.9%

      \[\leadsto z + \left(x + \color{blue}{\left(x + \left(\left(x + y\right) + y\right)\right)}\right) \]
    5. associate-+l+99.9%

      \[\leadsto z + \left(x + \left(x + \color{blue}{\left(x + \left(y + y\right)\right)}\right)\right) \]
    6. associate-+r+99.9%

      \[\leadsto z + \left(x + \color{blue}{\left(\left(x + x\right) + \left(y + y\right)\right)}\right) \]
    7. associate-+r+99.9%

      \[\leadsto z + \color{blue}{\left(\left(x + \left(x + x\right)\right) + \left(y + y\right)\right)} \]
    8. +-commutative99.9%

      \[\leadsto z + \left(\color{blue}{\left(\left(x + x\right) + x\right)} + \left(y + y\right)\right) \]
    9. count-299.9%

      \[\leadsto z + \left(\left(\color{blue}{2 \cdot x} + x\right) + \left(y + y\right)\right) \]
    10. distribute-lft1-in99.9%

      \[\leadsto z + \left(\color{blue}{\left(2 + 1\right) \cdot x} + \left(y + y\right)\right) \]
    11. fma-def100.0%

      \[\leadsto z + \color{blue}{\mathsf{fma}\left(2 + 1, x, y + y\right)} \]
    12. metadata-eval100.0%

      \[\leadsto z + \mathsf{fma}\left(\color{blue}{3}, x, y + y\right) \]
    13. count-2100.0%

      \[\leadsto z + \mathsf{fma}\left(3, x, \color{blue}{2 \cdot y}\right) \]
    14. *-commutative100.0%

      \[\leadsto z + \mathsf{fma}\left(3, x, \color{blue}{y \cdot 2}\right) \]
  3. Simplified100.0%

    \[\leadsto \color{blue}{z + \mathsf{fma}\left(3, x, y \cdot 2\right)} \]
  4. Final simplification100.0%

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

Alternative 2: 53.1% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.9 \cdot 10^{+105}:\\ \;\;\;\;z\\ \mathbf{elif}\;z \leq -1.2 \cdot 10^{+72}:\\ \;\;\;\;y \cdot 2\\ \mathbf{elif}\;z \leq -4.7 \cdot 10^{+33}:\\ \;\;\;\;z\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-266}:\\ \;\;\;\;3 \cdot x\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-234}:\\ \;\;\;\;y \cdot 2\\ \mathbf{elif}\;z \leq 6.4 \cdot 10^{+96}:\\ \;\;\;\;3 \cdot x\\ \mathbf{else}:\\ \;\;\;\;z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -1.9e+105)
   z
   (if (<= z -1.2e+72)
     (* y 2.0)
     (if (<= z -4.7e+33)
       z
       (if (<= z 6.5e-266)
         (* 3.0 x)
         (if (<= z 6.5e-234) (* y 2.0) (if (<= z 6.4e+96) (* 3.0 x) z)))))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -1.9e+105) {
		tmp = z;
	} else if (z <= -1.2e+72) {
		tmp = y * 2.0;
	} else if (z <= -4.7e+33) {
		tmp = z;
	} else if (z <= 6.5e-266) {
		tmp = 3.0 * x;
	} else if (z <= 6.5e-234) {
		tmp = y * 2.0;
	} else if (z <= 6.4e+96) {
		tmp = 3.0 * x;
	} else {
		tmp = z;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-1.9d+105)) then
        tmp = z
    else if (z <= (-1.2d+72)) then
        tmp = y * 2.0d0
    else if (z <= (-4.7d+33)) then
        tmp = z
    else if (z <= 6.5d-266) then
        tmp = 3.0d0 * x
    else if (z <= 6.5d-234) then
        tmp = y * 2.0d0
    else if (z <= 6.4d+96) then
        tmp = 3.0d0 * x
    else
        tmp = z
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -1.9e+105) {
		tmp = z;
	} else if (z <= -1.2e+72) {
		tmp = y * 2.0;
	} else if (z <= -4.7e+33) {
		tmp = z;
	} else if (z <= 6.5e-266) {
		tmp = 3.0 * x;
	} else if (z <= 6.5e-234) {
		tmp = y * 2.0;
	} else if (z <= 6.4e+96) {
		tmp = 3.0 * x;
	} else {
		tmp = z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -1.9e+105:
		tmp = z
	elif z <= -1.2e+72:
		tmp = y * 2.0
	elif z <= -4.7e+33:
		tmp = z
	elif z <= 6.5e-266:
		tmp = 3.0 * x
	elif z <= 6.5e-234:
		tmp = y * 2.0
	elif z <= 6.4e+96:
		tmp = 3.0 * x
	else:
		tmp = z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -1.9e+105)
		tmp = z;
	elseif (z <= -1.2e+72)
		tmp = Float64(y * 2.0);
	elseif (z <= -4.7e+33)
		tmp = z;
	elseif (z <= 6.5e-266)
		tmp = Float64(3.0 * x);
	elseif (z <= 6.5e-234)
		tmp = Float64(y * 2.0);
	elseif (z <= 6.4e+96)
		tmp = Float64(3.0 * x);
	else
		tmp = z;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -1.9e+105)
		tmp = z;
	elseif (z <= -1.2e+72)
		tmp = y * 2.0;
	elseif (z <= -4.7e+33)
		tmp = z;
	elseif (z <= 6.5e-266)
		tmp = 3.0 * x;
	elseif (z <= 6.5e-234)
		tmp = y * 2.0;
	elseif (z <= 6.4e+96)
		tmp = 3.0 * x;
	else
		tmp = z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -1.9e+105], z, If[LessEqual[z, -1.2e+72], N[(y * 2.0), $MachinePrecision], If[LessEqual[z, -4.7e+33], z, If[LessEqual[z, 6.5e-266], N[(3.0 * x), $MachinePrecision], If[LessEqual[z, 6.5e-234], N[(y * 2.0), $MachinePrecision], If[LessEqual[z, 6.4e+96], N[(3.0 * x), $MachinePrecision], z]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.9 \cdot 10^{+105}:\\
\;\;\;\;z\\

\mathbf{elif}\;z \leq -1.2 \cdot 10^{+72}:\\
\;\;\;\;y \cdot 2\\

\mathbf{elif}\;z \leq -4.7 \cdot 10^{+33}:\\
\;\;\;\;z\\

\mathbf{elif}\;z \leq 6.5 \cdot 10^{-266}:\\
\;\;\;\;3 \cdot x\\

\mathbf{elif}\;z \leq 6.5 \cdot 10^{-234}:\\
\;\;\;\;y \cdot 2\\

\mathbf{elif}\;z \leq 6.4 \cdot 10^{+96}:\\
\;\;\;\;3 \cdot x\\

\mathbf{else}:\\
\;\;\;\;z\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.9e105 or -1.20000000000000005e72 < z < -4.6999999999999998e33 or 6.40000000000000013e96 < z

    1. Initial program 99.9%

      \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
    2. Step-by-step derivation
      1. +-commutative99.9%

        \[\leadsto \color{blue}{\left(z + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} + x \]
      2. associate-+l+99.9%

        \[\leadsto \color{blue}{z + \left(\left(\left(\left(x + y\right) + y\right) + x\right) + x\right)} \]
      3. +-commutative99.9%

        \[\leadsto z + \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} \]
      4. +-commutative99.9%

        \[\leadsto z + \left(x + \color{blue}{\left(x + \left(\left(x + y\right) + y\right)\right)}\right) \]
      5. associate-+l+99.9%

        \[\leadsto z + \left(x + \left(x + \color{blue}{\left(x + \left(y + y\right)\right)}\right)\right) \]
      6. associate-+r+99.9%

        \[\leadsto z + \left(x + \color{blue}{\left(\left(x + x\right) + \left(y + y\right)\right)}\right) \]
      7. associate-+r+99.9%

        \[\leadsto z + \color{blue}{\left(\left(x + \left(x + x\right)\right) + \left(y + y\right)\right)} \]
      8. +-commutative99.9%

        \[\leadsto z + \left(\color{blue}{\left(\left(x + x\right) + x\right)} + \left(y + y\right)\right) \]
      9. count-299.9%

        \[\leadsto z + \left(\left(\color{blue}{2 \cdot x} + x\right) + \left(y + y\right)\right) \]
      10. distribute-lft1-in99.9%

        \[\leadsto z + \left(\color{blue}{\left(2 + 1\right) \cdot x} + \left(y + y\right)\right) \]
      11. fma-def100.0%

        \[\leadsto z + \color{blue}{\mathsf{fma}\left(2 + 1, x, y + y\right)} \]
      12. metadata-eval100.0%

        \[\leadsto z + \mathsf{fma}\left(\color{blue}{3}, x, y + y\right) \]
      13. count-2100.0%

        \[\leadsto z + \mathsf{fma}\left(3, x, \color{blue}{2 \cdot y}\right) \]
      14. *-commutative100.0%

        \[\leadsto z + \mathsf{fma}\left(3, x, \color{blue}{y \cdot 2}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{z + \mathsf{fma}\left(3, x, y \cdot 2\right)} \]
    4. Taylor expanded in z around inf 82.8%

      \[\leadsto \color{blue}{z} \]

    if -1.9e105 < z < -1.20000000000000005e72 or 6.50000000000000024e-266 < z < 6.4999999999999994e-234

    1. Initial program 100.0%

      \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{\left(z + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} + x \]
      2. associate-+l+100.0%

        \[\leadsto \color{blue}{z + \left(\left(\left(\left(x + y\right) + y\right) + x\right) + x\right)} \]
      3. +-commutative100.0%

        \[\leadsto z + \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} \]
      4. +-commutative100.0%

        \[\leadsto z + \left(x + \color{blue}{\left(x + \left(\left(x + y\right) + y\right)\right)}\right) \]
      5. associate-+l+100.0%

        \[\leadsto z + \left(x + \left(x + \color{blue}{\left(x + \left(y + y\right)\right)}\right)\right) \]
      6. associate-+r+100.0%

        \[\leadsto z + \left(x + \color{blue}{\left(\left(x + x\right) + \left(y + y\right)\right)}\right) \]
      7. associate-+r+100.0%

        \[\leadsto z + \color{blue}{\left(\left(x + \left(x + x\right)\right) + \left(y + y\right)\right)} \]
      8. +-commutative100.0%

        \[\leadsto z + \left(\color{blue}{\left(\left(x + x\right) + x\right)} + \left(y + y\right)\right) \]
      9. count-2100.0%

        \[\leadsto z + \left(\left(\color{blue}{2 \cdot x} + x\right) + \left(y + y\right)\right) \]
      10. distribute-lft1-in100.0%

        \[\leadsto z + \left(\color{blue}{\left(2 + 1\right) \cdot x} + \left(y + y\right)\right) \]
      11. fma-def100.0%

        \[\leadsto z + \color{blue}{\mathsf{fma}\left(2 + 1, x, y + y\right)} \]
      12. metadata-eval100.0%

        \[\leadsto z + \mathsf{fma}\left(\color{blue}{3}, x, y + y\right) \]
      13. count-2100.0%

        \[\leadsto z + \mathsf{fma}\left(3, x, \color{blue}{2 \cdot y}\right) \]
      14. *-commutative100.0%

        \[\leadsto z + \mathsf{fma}\left(3, x, \color{blue}{y \cdot 2}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{z + \mathsf{fma}\left(3, x, y \cdot 2\right)} \]
    4. Taylor expanded in y around inf 92.5%

      \[\leadsto \color{blue}{2 \cdot y} \]

    if -4.6999999999999998e33 < z < 6.50000000000000024e-266 or 6.4999999999999994e-234 < z < 6.40000000000000013e96

    1. Initial program 99.8%

      \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
    2. Step-by-step derivation
      1. +-commutative99.8%

        \[\leadsto \color{blue}{\left(z + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} + x \]
      2. associate-+l+99.8%

        \[\leadsto \color{blue}{z + \left(\left(\left(\left(x + y\right) + y\right) + x\right) + x\right)} \]
      3. +-commutative99.8%

        \[\leadsto z + \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} \]
      4. +-commutative99.8%

        \[\leadsto z + \left(x + \color{blue}{\left(x + \left(\left(x + y\right) + y\right)\right)}\right) \]
      5. associate-+l+99.8%

        \[\leadsto z + \left(x + \left(x + \color{blue}{\left(x + \left(y + y\right)\right)}\right)\right) \]
      6. associate-+r+99.8%

        \[\leadsto z + \left(x + \color{blue}{\left(\left(x + x\right) + \left(y + y\right)\right)}\right) \]
      7. associate-+r+99.8%

        \[\leadsto z + \color{blue}{\left(\left(x + \left(x + x\right)\right) + \left(y + y\right)\right)} \]
      8. +-commutative99.8%

        \[\leadsto z + \left(\color{blue}{\left(\left(x + x\right) + x\right)} + \left(y + y\right)\right) \]
      9. count-299.8%

        \[\leadsto z + \left(\left(\color{blue}{2 \cdot x} + x\right) + \left(y + y\right)\right) \]
      10. distribute-lft1-in99.8%

        \[\leadsto z + \left(\color{blue}{\left(2 + 1\right) \cdot x} + \left(y + y\right)\right) \]
      11. fma-def99.9%

        \[\leadsto z + \color{blue}{\mathsf{fma}\left(2 + 1, x, y + y\right)} \]
      12. metadata-eval99.9%

        \[\leadsto z + \mathsf{fma}\left(\color{blue}{3}, x, y + y\right) \]
      13. count-299.9%

        \[\leadsto z + \mathsf{fma}\left(3, x, \color{blue}{2 \cdot y}\right) \]
      14. *-commutative99.9%

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

      \[\leadsto \color{blue}{z + \mathsf{fma}\left(3, x, y \cdot 2\right)} \]
    4. Taylor expanded in x around inf 55.4%

      \[\leadsto \color{blue}{3 \cdot x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification66.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.9 \cdot 10^{+105}:\\ \;\;\;\;z\\ \mathbf{elif}\;z \leq -1.2 \cdot 10^{+72}:\\ \;\;\;\;y \cdot 2\\ \mathbf{elif}\;z \leq -4.7 \cdot 10^{+33}:\\ \;\;\;\;z\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-266}:\\ \;\;\;\;3 \cdot x\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-234}:\\ \;\;\;\;y \cdot 2\\ \mathbf{elif}\;z \leq 6.4 \cdot 10^{+96}:\\ \;\;\;\;3 \cdot x\\ \mathbf{else}:\\ \;\;\;\;z\\ \end{array} \]

Alternative 3: 86.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3.2 \cdot 10^{+72}:\\ \;\;\;\;z + y \cdot 2\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{+27}:\\ \;\;\;\;z + 3 \cdot x\\ \mathbf{else}:\\ \;\;\;\;x + 2 \cdot \left(x + y\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -3.2e+72)
   (+ z (* y 2.0))
   (if (<= y 4.8e+27) (+ z (* 3.0 x)) (+ x (* 2.0 (+ x y))))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -3.2e+72) {
		tmp = z + (y * 2.0);
	} else if (y <= 4.8e+27) {
		tmp = z + (3.0 * x);
	} else {
		tmp = x + (2.0 * (x + y));
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y <= (-3.2d+72)) then
        tmp = z + (y * 2.0d0)
    else if (y <= 4.8d+27) then
        tmp = z + (3.0d0 * x)
    else
        tmp = x + (2.0d0 * (x + y))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= -3.2e+72) {
		tmp = z + (y * 2.0);
	} else if (y <= 4.8e+27) {
		tmp = z + (3.0 * x);
	} else {
		tmp = x + (2.0 * (x + y));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -3.2e+72:
		tmp = z + (y * 2.0)
	elif y <= 4.8e+27:
		tmp = z + (3.0 * x)
	else:
		tmp = x + (2.0 * (x + y))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -3.2e+72)
		tmp = Float64(z + Float64(y * 2.0));
	elseif (y <= 4.8e+27)
		tmp = Float64(z + Float64(3.0 * x));
	else
		tmp = Float64(x + Float64(2.0 * Float64(x + y)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -3.2e+72)
		tmp = z + (y * 2.0);
	elseif (y <= 4.8e+27)
		tmp = z + (3.0 * x);
	else
		tmp = x + (2.0 * (x + y));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -3.2e+72], N[(z + N[(y * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.8e+27], N[(z + N[(3.0 * x), $MachinePrecision]), $MachinePrecision], N[(x + N[(2.0 * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{+72}:\\
\;\;\;\;z + y \cdot 2\\

\mathbf{elif}\;y \leq 4.8 \cdot 10^{+27}:\\
\;\;\;\;z + 3 \cdot x\\

\mathbf{else}:\\
\;\;\;\;x + 2 \cdot \left(x + y\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -3.2000000000000001e72

    1. Initial program 99.8%

      \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
    2. Step-by-step derivation
      1. +-commutative99.8%

        \[\leadsto \color{blue}{\left(z + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} + x \]
      2. associate-+l+99.8%

        \[\leadsto \color{blue}{z + \left(\left(\left(\left(x + y\right) + y\right) + x\right) + x\right)} \]
      3. +-commutative99.8%

        \[\leadsto z + \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} \]
      4. +-commutative99.8%

        \[\leadsto z + \left(x + \color{blue}{\left(x + \left(\left(x + y\right) + y\right)\right)}\right) \]
      5. associate-+l+99.8%

        \[\leadsto z + \left(x + \left(x + \color{blue}{\left(x + \left(y + y\right)\right)}\right)\right) \]
      6. associate-+r+99.8%

        \[\leadsto z + \left(x + \color{blue}{\left(\left(x + x\right) + \left(y + y\right)\right)}\right) \]
      7. associate-+r+99.9%

        \[\leadsto z + \color{blue}{\left(\left(x + \left(x + x\right)\right) + \left(y + y\right)\right)} \]
      8. +-commutative99.9%

        \[\leadsto z + \left(\color{blue}{\left(\left(x + x\right) + x\right)} + \left(y + y\right)\right) \]
      9. count-299.9%

        \[\leadsto z + \left(\left(\color{blue}{2 \cdot x} + x\right) + \left(y + y\right)\right) \]
      10. distribute-lft1-in99.9%

        \[\leadsto z + \left(\color{blue}{\left(2 + 1\right) \cdot x} + \left(y + y\right)\right) \]
      11. fma-def100.0%

        \[\leadsto z + \color{blue}{\mathsf{fma}\left(2 + 1, x, y + y\right)} \]
      12. metadata-eval100.0%

        \[\leadsto z + \mathsf{fma}\left(\color{blue}{3}, x, y + y\right) \]
      13. count-2100.0%

        \[\leadsto z + \mathsf{fma}\left(3, x, \color{blue}{2 \cdot y}\right) \]
      14. *-commutative100.0%

        \[\leadsto z + \mathsf{fma}\left(3, x, \color{blue}{y \cdot 2}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{z + \mathsf{fma}\left(3, x, y \cdot 2\right)} \]
    4. Taylor expanded in x around 0 81.2%

      \[\leadsto \color{blue}{z + 2 \cdot y} \]
    5. Step-by-step derivation
      1. +-commutative81.2%

        \[\leadsto \color{blue}{2 \cdot y + z} \]
    6. Simplified81.2%

      \[\leadsto \color{blue}{2 \cdot y + z} \]

    if -3.2000000000000001e72 < y < 4.79999999999999995e27

    1. Initial program 99.8%

      \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
    2. Step-by-step derivation
      1. +-commutative99.8%

        \[\leadsto \color{blue}{\left(z + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} + x \]
      2. associate-+l+99.8%

        \[\leadsto \color{blue}{z + \left(\left(\left(\left(x + y\right) + y\right) + x\right) + x\right)} \]
      3. +-commutative99.8%

        \[\leadsto z + \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} \]
      4. +-commutative99.8%

        \[\leadsto z + \left(x + \color{blue}{\left(x + \left(\left(x + y\right) + y\right)\right)}\right) \]
      5. associate-+l+99.8%

        \[\leadsto z + \left(x + \left(x + \color{blue}{\left(x + \left(y + y\right)\right)}\right)\right) \]
      6. associate-+r+99.8%

        \[\leadsto z + \left(x + \color{blue}{\left(\left(x + x\right) + \left(y + y\right)\right)}\right) \]
      7. associate-+r+99.8%

        \[\leadsto z + \color{blue}{\left(\left(x + \left(x + x\right)\right) + \left(y + y\right)\right)} \]
      8. +-commutative99.8%

        \[\leadsto z + \left(\color{blue}{\left(\left(x + x\right) + x\right)} + \left(y + y\right)\right) \]
      9. count-299.8%

        \[\leadsto z + \left(\left(\color{blue}{2 \cdot x} + x\right) + \left(y + y\right)\right) \]
      10. distribute-lft1-in99.8%

        \[\leadsto z + \left(\color{blue}{\left(2 + 1\right) \cdot x} + \left(y + y\right)\right) \]
      11. fma-def99.9%

        \[\leadsto z + \color{blue}{\mathsf{fma}\left(2 + 1, x, y + y\right)} \]
      12. metadata-eval99.9%

        \[\leadsto z + \mathsf{fma}\left(\color{blue}{3}, x, y + y\right) \]
      13. count-299.9%

        \[\leadsto z + \mathsf{fma}\left(3, x, \color{blue}{2 \cdot y}\right) \]
      14. *-commutative99.9%

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

      \[\leadsto \color{blue}{z + \mathsf{fma}\left(3, x, y \cdot 2\right)} \]
    4. Taylor expanded in y around 0 92.4%

      \[\leadsto \color{blue}{z + 3 \cdot x} \]
    5. Step-by-step derivation
      1. +-commutative92.4%

        \[\leadsto \color{blue}{3 \cdot x + z} \]
    6. Simplified92.4%

      \[\leadsto \color{blue}{3 \cdot x + z} \]

    if 4.79999999999999995e27 < y

    1. Initial program 100.0%

      \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
    2. Step-by-step derivation
      1. associate-+l+100.0%

        \[\leadsto \color{blue}{\left(\left(\left(x + y\right) + y\right) + x\right) + \left(z + x\right)} \]
      2. +-commutative100.0%

        \[\leadsto \left(\left(\color{blue}{\left(y + x\right)} + y\right) + x\right) + \left(z + x\right) \]
      3. associate-+l+100.0%

        \[\leadsto \color{blue}{\left(\left(y + x\right) + \left(y + x\right)\right)} + \left(z + x\right) \]
      4. count-2100.0%

        \[\leadsto \color{blue}{2 \cdot \left(y + x\right)} + \left(z + x\right) \]
      5. +-commutative100.0%

        \[\leadsto 2 \cdot \color{blue}{\left(x + y\right)} + \left(z + x\right) \]
      6. +-commutative100.0%

        \[\leadsto 2 \cdot \left(x + y\right) + \color{blue}{\left(x + z\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{2 \cdot \left(x + y\right) + \left(x + z\right)} \]
    4. Taylor expanded in z around 0 86.0%

      \[\leadsto \color{blue}{x + 2 \cdot \left(x + y\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification89.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.2 \cdot 10^{+72}:\\ \;\;\;\;z + y \cdot 2\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{+27}:\\ \;\;\;\;z + 3 \cdot x\\ \mathbf{else}:\\ \;\;\;\;x + 2 \cdot \left(x + y\right)\\ \end{array} \]

Alternative 4: 86.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -7 \cdot 10^{+71}:\\ \;\;\;\;z + y \cdot 2\\ \mathbf{elif}\;y \leq 1.02 \cdot 10^{+26}:\\ \;\;\;\;x + \left(z + x \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;x + 2 \cdot \left(x + y\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -7e+71)
   (+ z (* y 2.0))
   (if (<= y 1.02e+26) (+ x (+ z (* x 2.0))) (+ x (* 2.0 (+ x y))))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -7e+71) {
		tmp = z + (y * 2.0);
	} else if (y <= 1.02e+26) {
		tmp = x + (z + (x * 2.0));
	} else {
		tmp = x + (2.0 * (x + y));
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y <= (-7d+71)) then
        tmp = z + (y * 2.0d0)
    else if (y <= 1.02d+26) then
        tmp = x + (z + (x * 2.0d0))
    else
        tmp = x + (2.0d0 * (x + y))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= -7e+71) {
		tmp = z + (y * 2.0);
	} else if (y <= 1.02e+26) {
		tmp = x + (z + (x * 2.0));
	} else {
		tmp = x + (2.0 * (x + y));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -7e+71:
		tmp = z + (y * 2.0)
	elif y <= 1.02e+26:
		tmp = x + (z + (x * 2.0))
	else:
		tmp = x + (2.0 * (x + y))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -7e+71)
		tmp = Float64(z + Float64(y * 2.0));
	elseif (y <= 1.02e+26)
		tmp = Float64(x + Float64(z + Float64(x * 2.0)));
	else
		tmp = Float64(x + Float64(2.0 * Float64(x + y)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -7e+71)
		tmp = z + (y * 2.0);
	elseif (y <= 1.02e+26)
		tmp = x + (z + (x * 2.0));
	else
		tmp = x + (2.0 * (x + y));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -7e+71], N[(z + N[(y * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.02e+26], N[(x + N[(z + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(2.0 * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -7 \cdot 10^{+71}:\\
\;\;\;\;z + y \cdot 2\\

\mathbf{elif}\;y \leq 1.02 \cdot 10^{+26}:\\
\;\;\;\;x + \left(z + x \cdot 2\right)\\

\mathbf{else}:\\
\;\;\;\;x + 2 \cdot \left(x + y\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -6.9999999999999998e71

    1. Initial program 99.8%

      \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
    2. Step-by-step derivation
      1. +-commutative99.8%

        \[\leadsto \color{blue}{\left(z + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} + x \]
      2. associate-+l+99.8%

        \[\leadsto \color{blue}{z + \left(\left(\left(\left(x + y\right) + y\right) + x\right) + x\right)} \]
      3. +-commutative99.8%

        \[\leadsto z + \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} \]
      4. +-commutative99.8%

        \[\leadsto z + \left(x + \color{blue}{\left(x + \left(\left(x + y\right) + y\right)\right)}\right) \]
      5. associate-+l+99.8%

        \[\leadsto z + \left(x + \left(x + \color{blue}{\left(x + \left(y + y\right)\right)}\right)\right) \]
      6. associate-+r+99.8%

        \[\leadsto z + \left(x + \color{blue}{\left(\left(x + x\right) + \left(y + y\right)\right)}\right) \]
      7. associate-+r+99.9%

        \[\leadsto z + \color{blue}{\left(\left(x + \left(x + x\right)\right) + \left(y + y\right)\right)} \]
      8. +-commutative99.9%

        \[\leadsto z + \left(\color{blue}{\left(\left(x + x\right) + x\right)} + \left(y + y\right)\right) \]
      9. count-299.9%

        \[\leadsto z + \left(\left(\color{blue}{2 \cdot x} + x\right) + \left(y + y\right)\right) \]
      10. distribute-lft1-in99.9%

        \[\leadsto z + \left(\color{blue}{\left(2 + 1\right) \cdot x} + \left(y + y\right)\right) \]
      11. fma-def100.0%

        \[\leadsto z + \color{blue}{\mathsf{fma}\left(2 + 1, x, y + y\right)} \]
      12. metadata-eval100.0%

        \[\leadsto z + \mathsf{fma}\left(\color{blue}{3}, x, y + y\right) \]
      13. count-2100.0%

        \[\leadsto z + \mathsf{fma}\left(3, x, \color{blue}{2 \cdot y}\right) \]
      14. *-commutative100.0%

        \[\leadsto z + \mathsf{fma}\left(3, x, \color{blue}{y \cdot 2}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{z + \mathsf{fma}\left(3, x, y \cdot 2\right)} \]
    4. Taylor expanded in x around 0 81.2%

      \[\leadsto \color{blue}{z + 2 \cdot y} \]
    5. Step-by-step derivation
      1. +-commutative81.2%

        \[\leadsto \color{blue}{2 \cdot y + z} \]
    6. Simplified81.2%

      \[\leadsto \color{blue}{2 \cdot y + z} \]

    if -6.9999999999999998e71 < y < 1.0200000000000001e26

    1. Initial program 99.8%

      \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
    2. Step-by-step derivation
      1. associate-+l+99.8%

        \[\leadsto \color{blue}{\left(\left(\left(x + y\right) + y\right) + x\right) + \left(z + x\right)} \]
      2. +-commutative99.8%

        \[\leadsto \left(\left(\color{blue}{\left(y + x\right)} + y\right) + x\right) + \left(z + x\right) \]
      3. associate-+l+99.9%

        \[\leadsto \color{blue}{\left(\left(y + x\right) + \left(y + x\right)\right)} + \left(z + x\right) \]
      4. count-299.9%

        \[\leadsto \color{blue}{2 \cdot \left(y + x\right)} + \left(z + x\right) \]
      5. +-commutative99.9%

        \[\leadsto 2 \cdot \color{blue}{\left(x + y\right)} + \left(z + x\right) \]
      6. +-commutative99.9%

        \[\leadsto 2 \cdot \left(x + y\right) + \color{blue}{\left(x + z\right)} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{2 \cdot \left(x + y\right) + \left(x + z\right)} \]
    4. Taylor expanded in y around 0 92.4%

      \[\leadsto \color{blue}{x + \left(z + 2 \cdot x\right)} \]

    if 1.0200000000000001e26 < y

    1. Initial program 100.0%

      \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
    2. Step-by-step derivation
      1. associate-+l+100.0%

        \[\leadsto \color{blue}{\left(\left(\left(x + y\right) + y\right) + x\right) + \left(z + x\right)} \]
      2. +-commutative100.0%

        \[\leadsto \left(\left(\color{blue}{\left(y + x\right)} + y\right) + x\right) + \left(z + x\right) \]
      3. associate-+l+100.0%

        \[\leadsto \color{blue}{\left(\left(y + x\right) + \left(y + x\right)\right)} + \left(z + x\right) \]
      4. count-2100.0%

        \[\leadsto \color{blue}{2 \cdot \left(y + x\right)} + \left(z + x\right) \]
      5. +-commutative100.0%

        \[\leadsto 2 \cdot \color{blue}{\left(x + y\right)} + \left(z + x\right) \]
      6. +-commutative100.0%

        \[\leadsto 2 \cdot \left(x + y\right) + \color{blue}{\left(x + z\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{2 \cdot \left(x + y\right) + \left(x + z\right)} \]
    4. Taylor expanded in z around 0 86.0%

      \[\leadsto \color{blue}{x + 2 \cdot \left(x + y\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification89.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7 \cdot 10^{+71}:\\ \;\;\;\;z + y \cdot 2\\ \mathbf{elif}\;y \leq 1.02 \cdot 10^{+26}:\\ \;\;\;\;x + \left(z + x \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;x + 2 \cdot \left(x + y\right)\\ \end{array} \]

Alternative 5: 79.4% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2.15 \cdot 10^{+89} \lor \neg \left(x \leq 3.6 \cdot 10^{+79}\right):\\ \;\;\;\;3 \cdot x\\ \mathbf{else}:\\ \;\;\;\;z + y \cdot 2\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= x -2.15e+89) (not (<= x 3.6e+79))) (* 3.0 x) (+ z (* y 2.0))))
double code(double x, double y, double z) {
	double tmp;
	if ((x <= -2.15e+89) || !(x <= 3.6e+79)) {
		tmp = 3.0 * x;
	} else {
		tmp = z + (y * 2.0);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((x <= (-2.15d+89)) .or. (.not. (x <= 3.6d+79))) then
        tmp = 3.0d0 * x
    else
        tmp = z + (y * 2.0d0)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((x <= -2.15e+89) || !(x <= 3.6e+79)) {
		tmp = 3.0 * x;
	} else {
		tmp = z + (y * 2.0);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (x <= -2.15e+89) or not (x <= 3.6e+79):
		tmp = 3.0 * x
	else:
		tmp = z + (y * 2.0)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((x <= -2.15e+89) || !(x <= 3.6e+79))
		tmp = Float64(3.0 * x);
	else
		tmp = Float64(z + Float64(y * 2.0));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((x <= -2.15e+89) || ~((x <= 3.6e+79)))
		tmp = 3.0 * x;
	else
		tmp = z + (y * 2.0);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.15e+89], N[Not[LessEqual[x, 3.6e+79]], $MachinePrecision]], N[(3.0 * x), $MachinePrecision], N[(z + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.15 \cdot 10^{+89} \lor \neg \left(x \leq 3.6 \cdot 10^{+79}\right):\\
\;\;\;\;3 \cdot x\\

\mathbf{else}:\\
\;\;\;\;z + y \cdot 2\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.1500000000000001e89 or 3.5999999999999999e79 < x

    1. Initial program 99.8%

      \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
    2. Step-by-step derivation
      1. +-commutative99.8%

        \[\leadsto \color{blue}{\left(z + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} + x \]
      2. associate-+l+99.8%

        \[\leadsto \color{blue}{z + \left(\left(\left(\left(x + y\right) + y\right) + x\right) + x\right)} \]
      3. +-commutative99.8%

        \[\leadsto z + \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} \]
      4. +-commutative99.8%

        \[\leadsto z + \left(x + \color{blue}{\left(x + \left(\left(x + y\right) + y\right)\right)}\right) \]
      5. associate-+l+99.8%

        \[\leadsto z + \left(x + \left(x + \color{blue}{\left(x + \left(y + y\right)\right)}\right)\right) \]
      6. associate-+r+99.8%

        \[\leadsto z + \left(x + \color{blue}{\left(\left(x + x\right) + \left(y + y\right)\right)}\right) \]
      7. associate-+r+99.8%

        \[\leadsto z + \color{blue}{\left(\left(x + \left(x + x\right)\right) + \left(y + y\right)\right)} \]
      8. +-commutative99.8%

        \[\leadsto z + \left(\color{blue}{\left(\left(x + x\right) + x\right)} + \left(y + y\right)\right) \]
      9. count-299.8%

        \[\leadsto z + \left(\left(\color{blue}{2 \cdot x} + x\right) + \left(y + y\right)\right) \]
      10. distribute-lft1-in99.8%

        \[\leadsto z + \left(\color{blue}{\left(2 + 1\right) \cdot x} + \left(y + y\right)\right) \]
      11. fma-def99.9%

        \[\leadsto z + \color{blue}{\mathsf{fma}\left(2 + 1, x, y + y\right)} \]
      12. metadata-eval99.9%

        \[\leadsto z + \mathsf{fma}\left(\color{blue}{3}, x, y + y\right) \]
      13. count-299.9%

        \[\leadsto z + \mathsf{fma}\left(3, x, \color{blue}{2 \cdot y}\right) \]
      14. *-commutative99.9%

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

      \[\leadsto \color{blue}{z + \mathsf{fma}\left(3, x, y \cdot 2\right)} \]
    4. Taylor expanded in x around inf 75.9%

      \[\leadsto \color{blue}{3 \cdot x} \]

    if -2.1500000000000001e89 < x < 3.5999999999999999e79

    1. Initial program 99.9%

      \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
    2. Step-by-step derivation
      1. +-commutative99.9%

        \[\leadsto \color{blue}{\left(z + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} + x \]
      2. associate-+l+99.9%

        \[\leadsto \color{blue}{z + \left(\left(\left(\left(x + y\right) + y\right) + x\right) + x\right)} \]
      3. +-commutative99.9%

        \[\leadsto z + \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} \]
      4. +-commutative99.9%

        \[\leadsto z + \left(x + \color{blue}{\left(x + \left(\left(x + y\right) + y\right)\right)}\right) \]
      5. associate-+l+99.9%

        \[\leadsto z + \left(x + \left(x + \color{blue}{\left(x + \left(y + y\right)\right)}\right)\right) \]
      6. associate-+r+99.9%

        \[\leadsto z + \left(x + \color{blue}{\left(\left(x + x\right) + \left(y + y\right)\right)}\right) \]
      7. associate-+r+99.9%

        \[\leadsto z + \color{blue}{\left(\left(x + \left(x + x\right)\right) + \left(y + y\right)\right)} \]
      8. +-commutative99.9%

        \[\leadsto z + \left(\color{blue}{\left(\left(x + x\right) + x\right)} + \left(y + y\right)\right) \]
      9. count-299.9%

        \[\leadsto z + \left(\left(\color{blue}{2 \cdot x} + x\right) + \left(y + y\right)\right) \]
      10. distribute-lft1-in99.9%

        \[\leadsto z + \left(\color{blue}{\left(2 + 1\right) \cdot x} + \left(y + y\right)\right) \]
      11. fma-def100.0%

        \[\leadsto z + \color{blue}{\mathsf{fma}\left(2 + 1, x, y + y\right)} \]
      12. metadata-eval100.0%

        \[\leadsto z + \mathsf{fma}\left(\color{blue}{3}, x, y + y\right) \]
      13. count-2100.0%

        \[\leadsto z + \mathsf{fma}\left(3, x, \color{blue}{2 \cdot y}\right) \]
      14. *-commutative100.0%

        \[\leadsto z + \mathsf{fma}\left(3, x, \color{blue}{y \cdot 2}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{z + \mathsf{fma}\left(3, x, y \cdot 2\right)} \]
    4. Taylor expanded in x around 0 85.5%

      \[\leadsto \color{blue}{z + 2 \cdot y} \]
    5. Step-by-step derivation
      1. +-commutative85.5%

        \[\leadsto \color{blue}{2 \cdot y + z} \]
    6. Simplified85.5%

      \[\leadsto \color{blue}{2 \cdot y + z} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification82.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.15 \cdot 10^{+89} \lor \neg \left(x \leq 3.6 \cdot 10^{+79}\right):\\ \;\;\;\;3 \cdot x\\ \mathbf{else}:\\ \;\;\;\;z + y \cdot 2\\ \end{array} \]

Alternative 6: 83.1% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -6.8 \cdot 10^{+84} \lor \neg \left(x \leq 3.9 \cdot 10^{-104}\right):\\ \;\;\;\;z + 3 \cdot x\\ \mathbf{else}:\\ \;\;\;\;z + y \cdot 2\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= x -6.8e+84) (not (<= x 3.9e-104)))
   (+ z (* 3.0 x))
   (+ z (* y 2.0))))
double code(double x, double y, double z) {
	double tmp;
	if ((x <= -6.8e+84) || !(x <= 3.9e-104)) {
		tmp = z + (3.0 * x);
	} else {
		tmp = z + (y * 2.0);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((x <= (-6.8d+84)) .or. (.not. (x <= 3.9d-104))) then
        tmp = z + (3.0d0 * x)
    else
        tmp = z + (y * 2.0d0)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((x <= -6.8e+84) || !(x <= 3.9e-104)) {
		tmp = z + (3.0 * x);
	} else {
		tmp = z + (y * 2.0);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (x <= -6.8e+84) or not (x <= 3.9e-104):
		tmp = z + (3.0 * x)
	else:
		tmp = z + (y * 2.0)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((x <= -6.8e+84) || !(x <= 3.9e-104))
		tmp = Float64(z + Float64(3.0 * x));
	else
		tmp = Float64(z + Float64(y * 2.0));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((x <= -6.8e+84) || ~((x <= 3.9e-104)))
		tmp = z + (3.0 * x);
	else
		tmp = z + (y * 2.0);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[x, -6.8e+84], N[Not[LessEqual[x, 3.9e-104]], $MachinePrecision]], N[(z + N[(3.0 * x), $MachinePrecision]), $MachinePrecision], N[(z + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{+84} \lor \neg \left(x \leq 3.9 \cdot 10^{-104}\right):\\
\;\;\;\;z + 3 \cdot x\\

\mathbf{else}:\\
\;\;\;\;z + y \cdot 2\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.7999999999999996e84 or 3.9000000000000002e-104 < x

    1. Initial program 99.8%

      \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
    2. Step-by-step derivation
      1. +-commutative99.8%

        \[\leadsto \color{blue}{\left(z + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} + x \]
      2. associate-+l+99.8%

        \[\leadsto \color{blue}{z + \left(\left(\left(\left(x + y\right) + y\right) + x\right) + x\right)} \]
      3. +-commutative99.8%

        \[\leadsto z + \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} \]
      4. +-commutative99.8%

        \[\leadsto z + \left(x + \color{blue}{\left(x + \left(\left(x + y\right) + y\right)\right)}\right) \]
      5. associate-+l+99.8%

        \[\leadsto z + \left(x + \left(x + \color{blue}{\left(x + \left(y + y\right)\right)}\right)\right) \]
      6. associate-+r+99.8%

        \[\leadsto z + \left(x + \color{blue}{\left(\left(x + x\right) + \left(y + y\right)\right)}\right) \]
      7. associate-+r+99.8%

        \[\leadsto z + \color{blue}{\left(\left(x + \left(x + x\right)\right) + \left(y + y\right)\right)} \]
      8. +-commutative99.8%

        \[\leadsto z + \left(\color{blue}{\left(\left(x + x\right) + x\right)} + \left(y + y\right)\right) \]
      9. count-299.8%

        \[\leadsto z + \left(\left(\color{blue}{2 \cdot x} + x\right) + \left(y + y\right)\right) \]
      10. distribute-lft1-in99.8%

        \[\leadsto z + \left(\color{blue}{\left(2 + 1\right) \cdot x} + \left(y + y\right)\right) \]
      11. fma-def99.9%

        \[\leadsto z + \color{blue}{\mathsf{fma}\left(2 + 1, x, y + y\right)} \]
      12. metadata-eval99.9%

        \[\leadsto z + \mathsf{fma}\left(\color{blue}{3}, x, y + y\right) \]
      13. count-299.9%

        \[\leadsto z + \mathsf{fma}\left(3, x, \color{blue}{2 \cdot y}\right) \]
      14. *-commutative99.9%

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

      \[\leadsto \color{blue}{z + \mathsf{fma}\left(3, x, y \cdot 2\right)} \]
    4. Taylor expanded in y around 0 85.2%

      \[\leadsto \color{blue}{z + 3 \cdot x} \]
    5. Step-by-step derivation
      1. +-commutative85.2%

        \[\leadsto \color{blue}{3 \cdot x + z} \]
    6. Simplified85.2%

      \[\leadsto \color{blue}{3 \cdot x + z} \]

    if -6.7999999999999996e84 < x < 3.9000000000000002e-104

    1. Initial program 99.9%

      \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
    2. Step-by-step derivation
      1. +-commutative99.9%

        \[\leadsto \color{blue}{\left(z + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} + x \]
      2. associate-+l+99.9%

        \[\leadsto \color{blue}{z + \left(\left(\left(\left(x + y\right) + y\right) + x\right) + x\right)} \]
      3. +-commutative99.9%

        \[\leadsto z + \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} \]
      4. +-commutative99.9%

        \[\leadsto z + \left(x + \color{blue}{\left(x + \left(\left(x + y\right) + y\right)\right)}\right) \]
      5. associate-+l+99.9%

        \[\leadsto z + \left(x + \left(x + \color{blue}{\left(x + \left(y + y\right)\right)}\right)\right) \]
      6. associate-+r+99.9%

        \[\leadsto z + \left(x + \color{blue}{\left(\left(x + x\right) + \left(y + y\right)\right)}\right) \]
      7. associate-+r+99.9%

        \[\leadsto z + \color{blue}{\left(\left(x + \left(x + x\right)\right) + \left(y + y\right)\right)} \]
      8. +-commutative99.9%

        \[\leadsto z + \left(\color{blue}{\left(\left(x + x\right) + x\right)} + \left(y + y\right)\right) \]
      9. count-299.9%

        \[\leadsto z + \left(\left(\color{blue}{2 \cdot x} + x\right) + \left(y + y\right)\right) \]
      10. distribute-lft1-in99.9%

        \[\leadsto z + \left(\color{blue}{\left(2 + 1\right) \cdot x} + \left(y + y\right)\right) \]
      11. fma-def100.0%

        \[\leadsto z + \color{blue}{\mathsf{fma}\left(2 + 1, x, y + y\right)} \]
      12. metadata-eval100.0%

        \[\leadsto z + \mathsf{fma}\left(\color{blue}{3}, x, y + y\right) \]
      13. count-2100.0%

        \[\leadsto z + \mathsf{fma}\left(3, x, \color{blue}{2 \cdot y}\right) \]
      14. *-commutative100.0%

        \[\leadsto z + \mathsf{fma}\left(3, x, \color{blue}{y \cdot 2}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{z + \mathsf{fma}\left(3, x, y \cdot 2\right)} \]
    4. Taylor expanded in x around 0 91.2%

      \[\leadsto \color{blue}{z + 2 \cdot y} \]
    5. Step-by-step derivation
      1. +-commutative91.2%

        \[\leadsto \color{blue}{2 \cdot y + z} \]
    6. Simplified91.2%

      \[\leadsto \color{blue}{2 \cdot y + z} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification88.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.8 \cdot 10^{+84} \lor \neg \left(x \leq 3.9 \cdot 10^{-104}\right):\\ \;\;\;\;z + 3 \cdot x\\ \mathbf{else}:\\ \;\;\;\;z + y \cdot 2\\ \end{array} \]

Alternative 7: 99.9% accurate, 1.2× speedup?

\[\begin{array}{l} \\ 2 \cdot \left(x + y\right) + \left(z + x\right) \end{array} \]
(FPCore (x y z) :precision binary64 (+ (* 2.0 (+ x y)) (+ z x)))
double code(double x, double y, double z) {
	return (2.0 * (x + y)) + (z + x);
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (2.0d0 * (x + y)) + (z + x)
end function
public static double code(double x, double y, double z) {
	return (2.0 * (x + y)) + (z + x);
}
def code(x, y, z):
	return (2.0 * (x + y)) + (z + x)
function code(x, y, z)
	return Float64(Float64(2.0 * Float64(x + y)) + Float64(z + x))
end
function tmp = code(x, y, z)
	tmp = (2.0 * (x + y)) + (z + x);
end
code[x_, y_, z_] := N[(N[(2.0 * N[(x + y), $MachinePrecision]), $MachinePrecision] + N[(z + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
2 \cdot \left(x + y\right) + \left(z + x\right)
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
  2. Step-by-step derivation
    1. associate-+l+99.9%

      \[\leadsto \color{blue}{\left(\left(\left(x + y\right) + y\right) + x\right) + \left(z + x\right)} \]
    2. +-commutative99.9%

      \[\leadsto \left(\left(\color{blue}{\left(y + x\right)} + y\right) + x\right) + \left(z + x\right) \]
    3. associate-+l+99.9%

      \[\leadsto \color{blue}{\left(\left(y + x\right) + \left(y + x\right)\right)} + \left(z + x\right) \]
    4. count-299.9%

      \[\leadsto \color{blue}{2 \cdot \left(y + x\right)} + \left(z + x\right) \]
    5. +-commutative99.9%

      \[\leadsto 2 \cdot \color{blue}{\left(x + y\right)} + \left(z + x\right) \]
    6. +-commutative99.9%

      \[\leadsto 2 \cdot \left(x + y\right) + \color{blue}{\left(x + z\right)} \]
  3. Simplified99.9%

    \[\leadsto \color{blue}{2 \cdot \left(x + y\right) + \left(x + z\right)} \]
  4. Final simplification99.9%

    \[\leadsto 2 \cdot \left(x + y\right) + \left(z + x\right) \]

Alternative 8: 53.4% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.4 \cdot 10^{+94} \lor \neg \left(y \leq 1.26 \cdot 10^{+25}\right):\\ \;\;\;\;y \cdot 2\\ \mathbf{else}:\\ \;\;\;\;z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= y -2.4e+94) (not (<= y 1.26e+25))) (* y 2.0) z))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -2.4e+94) || !(y <= 1.26e+25)) {
		tmp = y * 2.0;
	} else {
		tmp = z;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((y <= (-2.4d+94)) .or. (.not. (y <= 1.26d+25))) then
        tmp = y * 2.0d0
    else
        tmp = z
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((y <= -2.4e+94) || !(y <= 1.26e+25)) {
		tmp = y * 2.0;
	} else {
		tmp = z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (y <= -2.4e+94) or not (y <= 1.26e+25):
		tmp = y * 2.0
	else:
		tmp = z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((y <= -2.4e+94) || !(y <= 1.26e+25))
		tmp = Float64(y * 2.0);
	else
		tmp = z;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((y <= -2.4e+94) || ~((y <= 1.26e+25)))
		tmp = y * 2.0;
	else
		tmp = z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.4e+94], N[Not[LessEqual[y, 1.26e+25]], $MachinePrecision]], N[(y * 2.0), $MachinePrecision], z]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.4 \cdot 10^{+94} \lor \neg \left(y \leq 1.26 \cdot 10^{+25}\right):\\
\;\;\;\;y \cdot 2\\

\mathbf{else}:\\
\;\;\;\;z\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.39999999999999983e94 or 1.26000000000000008e25 < y

    1. Initial program 99.9%

      \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
    2. Step-by-step derivation
      1. +-commutative99.9%

        \[\leadsto \color{blue}{\left(z + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} + x \]
      2. associate-+l+99.9%

        \[\leadsto \color{blue}{z + \left(\left(\left(\left(x + y\right) + y\right) + x\right) + x\right)} \]
      3. +-commutative99.9%

        \[\leadsto z + \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} \]
      4. +-commutative99.9%

        \[\leadsto z + \left(x + \color{blue}{\left(x + \left(\left(x + y\right) + y\right)\right)}\right) \]
      5. associate-+l+99.9%

        \[\leadsto z + \left(x + \left(x + \color{blue}{\left(x + \left(y + y\right)\right)}\right)\right) \]
      6. associate-+r+99.9%

        \[\leadsto z + \left(x + \color{blue}{\left(\left(x + x\right) + \left(y + y\right)\right)}\right) \]
      7. associate-+r+99.9%

        \[\leadsto z + \color{blue}{\left(\left(x + \left(x + x\right)\right) + \left(y + y\right)\right)} \]
      8. +-commutative99.9%

        \[\leadsto z + \left(\color{blue}{\left(\left(x + x\right) + x\right)} + \left(y + y\right)\right) \]
      9. count-299.9%

        \[\leadsto z + \left(\left(\color{blue}{2 \cdot x} + x\right) + \left(y + y\right)\right) \]
      10. distribute-lft1-in99.9%

        \[\leadsto z + \left(\color{blue}{\left(2 + 1\right) \cdot x} + \left(y + y\right)\right) \]
      11. fma-def100.0%

        \[\leadsto z + \color{blue}{\mathsf{fma}\left(2 + 1, x, y + y\right)} \]
      12. metadata-eval100.0%

        \[\leadsto z + \mathsf{fma}\left(\color{blue}{3}, x, y + y\right) \]
      13. count-2100.0%

        \[\leadsto z + \mathsf{fma}\left(3, x, \color{blue}{2 \cdot y}\right) \]
      14. *-commutative100.0%

        \[\leadsto z + \mathsf{fma}\left(3, x, \color{blue}{y \cdot 2}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{z + \mathsf{fma}\left(3, x, y \cdot 2\right)} \]
    4. Taylor expanded in y around inf 55.9%

      \[\leadsto \color{blue}{2 \cdot y} \]

    if -2.39999999999999983e94 < y < 1.26000000000000008e25

    1. Initial program 99.8%

      \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
    2. Step-by-step derivation
      1. +-commutative99.8%

        \[\leadsto \color{blue}{\left(z + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} + x \]
      2. associate-+l+99.8%

        \[\leadsto \color{blue}{z + \left(\left(\left(\left(x + y\right) + y\right) + x\right) + x\right)} \]
      3. +-commutative99.8%

        \[\leadsto z + \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} \]
      4. +-commutative99.8%

        \[\leadsto z + \left(x + \color{blue}{\left(x + \left(\left(x + y\right) + y\right)\right)}\right) \]
      5. associate-+l+99.8%

        \[\leadsto z + \left(x + \left(x + \color{blue}{\left(x + \left(y + y\right)\right)}\right)\right) \]
      6. associate-+r+99.8%

        \[\leadsto z + \left(x + \color{blue}{\left(\left(x + x\right) + \left(y + y\right)\right)}\right) \]
      7. associate-+r+99.8%

        \[\leadsto z + \color{blue}{\left(\left(x + \left(x + x\right)\right) + \left(y + y\right)\right)} \]
      8. +-commutative99.8%

        \[\leadsto z + \left(\color{blue}{\left(\left(x + x\right) + x\right)} + \left(y + y\right)\right) \]
      9. count-299.8%

        \[\leadsto z + \left(\left(\color{blue}{2 \cdot x} + x\right) + \left(y + y\right)\right) \]
      10. distribute-lft1-in99.8%

        \[\leadsto z + \left(\color{blue}{\left(2 + 1\right) \cdot x} + \left(y + y\right)\right) \]
      11. fma-def99.9%

        \[\leadsto z + \color{blue}{\mathsf{fma}\left(2 + 1, x, y + y\right)} \]
      12. metadata-eval99.9%

        \[\leadsto z + \mathsf{fma}\left(\color{blue}{3}, x, y + y\right) \]
      13. count-299.9%

        \[\leadsto z + \mathsf{fma}\left(3, x, \color{blue}{2 \cdot y}\right) \]
      14. *-commutative99.9%

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

      \[\leadsto \color{blue}{z + \mathsf{fma}\left(3, x, y \cdot 2\right)} \]
    4. Taylor expanded in z around inf 49.0%

      \[\leadsto \color{blue}{z} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification51.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.4 \cdot 10^{+94} \lor \neg \left(y \leq 1.26 \cdot 10^{+25}\right):\\ \;\;\;\;y \cdot 2\\ \mathbf{else}:\\ \;\;\;\;z\\ \end{array} \]

Alternative 9: 35.1% accurate, 11.0× speedup?

\[\begin{array}{l} \\ z \end{array} \]
(FPCore (x y z) :precision binary64 z)
double code(double x, double y, double z) {
	return z;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = z
end function
public static double code(double x, double y, double z) {
	return z;
}
def code(x, y, z):
	return z
function code(x, y, z)
	return z
end
function tmp = code(x, y, z)
	tmp = z;
end
code[x_, y_, z_] := z
\begin{array}{l}

\\
z
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
  2. Step-by-step derivation
    1. +-commutative99.9%

      \[\leadsto \color{blue}{\left(z + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} + x \]
    2. associate-+l+99.9%

      \[\leadsto \color{blue}{z + \left(\left(\left(\left(x + y\right) + y\right) + x\right) + x\right)} \]
    3. +-commutative99.9%

      \[\leadsto z + \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} \]
    4. +-commutative99.9%

      \[\leadsto z + \left(x + \color{blue}{\left(x + \left(\left(x + y\right) + y\right)\right)}\right) \]
    5. associate-+l+99.9%

      \[\leadsto z + \left(x + \left(x + \color{blue}{\left(x + \left(y + y\right)\right)}\right)\right) \]
    6. associate-+r+99.9%

      \[\leadsto z + \left(x + \color{blue}{\left(\left(x + x\right) + \left(y + y\right)\right)}\right) \]
    7. associate-+r+99.9%

      \[\leadsto z + \color{blue}{\left(\left(x + \left(x + x\right)\right) + \left(y + y\right)\right)} \]
    8. +-commutative99.9%

      \[\leadsto z + \left(\color{blue}{\left(\left(x + x\right) + x\right)} + \left(y + y\right)\right) \]
    9. count-299.9%

      \[\leadsto z + \left(\left(\color{blue}{2 \cdot x} + x\right) + \left(y + y\right)\right) \]
    10. distribute-lft1-in99.9%

      \[\leadsto z + \left(\color{blue}{\left(2 + 1\right) \cdot x} + \left(y + y\right)\right) \]
    11. fma-def100.0%

      \[\leadsto z + \color{blue}{\mathsf{fma}\left(2 + 1, x, y + y\right)} \]
    12. metadata-eval100.0%

      \[\leadsto z + \mathsf{fma}\left(\color{blue}{3}, x, y + y\right) \]
    13. count-2100.0%

      \[\leadsto z + \mathsf{fma}\left(3, x, \color{blue}{2 \cdot y}\right) \]
    14. *-commutative100.0%

      \[\leadsto z + \mathsf{fma}\left(3, x, \color{blue}{y \cdot 2}\right) \]
  3. Simplified100.0%

    \[\leadsto \color{blue}{z + \mathsf{fma}\left(3, x, y \cdot 2\right)} \]
  4. Taylor expanded in z around inf 37.5%

    \[\leadsto \color{blue}{z} \]
  5. Final simplification37.5%

    \[\leadsto z \]

Reproduce

?
herbie shell --seed 2023301 
(FPCore (x y z)
  :name "Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendInside from plot-0.2.3.4"
  :precision binary64
  (+ (+ (+ (+ (+ x y) y) x) z) x))