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

Percentage Accurate: 99.9% → 100.0%
Time: 7.2s
Alternatives: 10
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 10 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} \\ \mathsf{fma}\left(x, 3, z + y \cdot 2\right) \end{array} \]
(FPCore (x y z) :precision binary64 (fma x 3.0 (+ z (* y 2.0))))
double code(double x, double y, double z) {
	return fma(x, 3.0, (z + (y * 2.0)));
}
function code(x, y, z)
	return fma(x, 3.0, Float64(z + Float64(y * 2.0)))
end
code[x_, y_, z_] := N[(x * 3.0 + N[(z + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(x, 3, z + 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. associate-+l+N/A

      \[\leadsto \left(\left(\left(x + y\right) + y\right) + x\right) + \color{blue}{\left(z + x\right)} \]
    2. +-commutativeN/A

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

      \[\leadsto z + \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} \]
    4. +-lowering-+.f64N/A

      \[\leadsto \mathsf{+.f64}\left(z, \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)}\right) \]
    5. +-commutativeN/A

      \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(x + \color{blue}{\left(\left(x + y\right) + y\right)}\right)\right)\right) \]
    6. associate-+l+N/A

      \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(x + \left(x + \color{blue}{\left(y + y\right)}\right)\right)\right)\right) \]
    7. associate-+r+N/A

      \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(\left(x + x\right) + \color{blue}{\left(y + y\right)}\right)\right)\right) \]
    8. associate-+r+N/A

      \[\leadsto \mathsf{+.f64}\left(z, \left(\left(x + \left(x + x\right)\right) + \color{blue}{\left(y + y\right)}\right)\right) \]
    9. +-commutativeN/A

      \[\leadsto \mathsf{+.f64}\left(z, \left(\left(y + y\right) + \color{blue}{\left(x + \left(x + x\right)\right)}\right)\right) \]
    10. +-lowering-+.f64N/A

      \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(y + y\right), \color{blue}{\left(x + \left(x + x\right)\right)}\right)\right) \]
    11. count-2N/A

      \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(2 \cdot y\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
    12. *-commutativeN/A

      \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(y \cdot 2\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
    13. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
    14. count-2N/A

      \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(x + 2 \cdot \color{blue}{x}\right)\right)\right) \]
    15. distribute-rgt1-inN/A

      \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(\left(2 + 1\right) \cdot \color{blue}{x}\right)\right)\right) \]
    16. *-commutativeN/A

      \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(x \cdot \color{blue}{\left(2 + 1\right)}\right)\right)\right) \]
    17. *-lowering-*.f64N/A

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

      \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \mathsf{*.f64}\left(x, 3\right)\right)\right) \]
  3. Simplified99.9%

    \[\leadsto \color{blue}{z + \left(y \cdot 2 + x \cdot 3\right)} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. associate-+r+N/A

      \[\leadsto \left(z + y \cdot 2\right) + \color{blue}{x \cdot 3} \]
    2. +-commutativeN/A

      \[\leadsto x \cdot 3 + \color{blue}{\left(z + y \cdot 2\right)} \]
    3. fma-defineN/A

      \[\leadsto \mathsf{fma}\left(x, \color{blue}{3}, z + y \cdot 2\right) \]
    4. fma-lowering-fma.f64N/A

      \[\leadsto \mathsf{fma.f64}\left(x, \color{blue}{3}, \left(z + y \cdot 2\right)\right) \]
    5. +-lowering-+.f64N/A

      \[\leadsto \mathsf{fma.f64}\left(x, 3, \mathsf{+.f64}\left(z, \left(y \cdot 2\right)\right)\right) \]
    6. *-lowering-*.f64100.0%

      \[\leadsto \mathsf{fma.f64}\left(x, 3, \mathsf{+.f64}\left(z, \mathsf{*.f64}\left(y, 2\right)\right)\right) \]
  6. Applied egg-rr100.0%

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, 3, z + y \cdot 2\right)} \]
  7. Add Preprocessing

Alternative 2: 84.0% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2.6 \cdot 10^{-45}:\\ \;\;\;\;z + x \cdot 3\\ \mathbf{elif}\;x \leq 1.7 \cdot 10^{+135}:\\ \;\;\;\;z + y \cdot 2\\ \mathbf{else}:\\ \;\;\;\;x \cdot 3 + y \cdot 2\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x -2.6e-45)
   (+ z (* x 3.0))
   (if (<= x 1.7e+135) (+ z (* y 2.0)) (+ (* x 3.0) (* y 2.0)))))
double code(double x, double y, double z) {
	double tmp;
	if (x <= -2.6e-45) {
		tmp = z + (x * 3.0);
	} else if (x <= 1.7e+135) {
		tmp = z + (y * 2.0);
	} else {
		tmp = (x * 3.0) + (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.6d-45)) then
        tmp = z + (x * 3.0d0)
    else if (x <= 1.7d+135) then
        tmp = z + (y * 2.0d0)
    else
        tmp = (x * 3.0d0) + (y * 2.0d0)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= -2.6e-45) {
		tmp = z + (x * 3.0);
	} else if (x <= 1.7e+135) {
		tmp = z + (y * 2.0);
	} else {
		tmp = (x * 3.0) + (y * 2.0);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if x <= -2.6e-45:
		tmp = z + (x * 3.0)
	elif x <= 1.7e+135:
		tmp = z + (y * 2.0)
	else:
		tmp = (x * 3.0) + (y * 2.0)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (x <= -2.6e-45)
		tmp = Float64(z + Float64(x * 3.0));
	elseif (x <= 1.7e+135)
		tmp = Float64(z + Float64(y * 2.0));
	else
		tmp = Float64(Float64(x * 3.0) + Float64(y * 2.0));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= -2.6e-45)
		tmp = z + (x * 3.0);
	elseif (x <= 1.7e+135)
		tmp = z + (y * 2.0);
	else
		tmp = (x * 3.0) + (y * 2.0);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[x, -2.6e-45], N[(z + N[(x * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.7e+135], N[(z + N[(y * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(x * 3.0), $MachinePrecision] + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{-45}:\\
\;\;\;\;z + x \cdot 3\\

\mathbf{elif}\;x \leq 1.7 \cdot 10^{+135}:\\
\;\;\;\;z + y \cdot 2\\

\mathbf{else}:\\
\;\;\;\;x \cdot 3 + y \cdot 2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.59999999999999987e-45

    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+N/A

        \[\leadsto \left(\left(\left(x + y\right) + y\right) + x\right) + \color{blue}{\left(z + x\right)} \]
      2. +-commutativeN/A

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

        \[\leadsto z + \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(z, \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)}\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(x + \color{blue}{\left(\left(x + y\right) + y\right)}\right)\right)\right) \]
      6. associate-+l+N/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(x + \left(x + \color{blue}{\left(y + y\right)}\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(\left(x + x\right) + \color{blue}{\left(y + y\right)}\right)\right)\right) \]
      8. associate-+r+N/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(\left(x + \left(x + x\right)\right) + \color{blue}{\left(y + y\right)}\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(\left(y + y\right) + \color{blue}{\left(x + \left(x + x\right)\right)}\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(y + y\right), \color{blue}{\left(x + \left(x + x\right)\right)}\right)\right) \]
      11. count-2N/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(2 \cdot y\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(y \cdot 2\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
      14. count-2N/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(x + 2 \cdot \color{blue}{x}\right)\right)\right) \]
      15. distribute-rgt1-inN/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(\left(2 + 1\right) \cdot \color{blue}{x}\right)\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(x \cdot \color{blue}{\left(2 + 1\right)}\right)\right)\right) \]
      17. *-lowering-*.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \mathsf{*.f64}\left(x, 3\right)\right)\right) \]
    3. Simplified99.9%

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

      \[\leadsto \color{blue}{z + 3 \cdot x} \]
    6. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto 3 \cdot x + \color{blue}{z} \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(3 \cdot x\right), \color{blue}{z}\right) \]
      3. *-lowering-*.f6483.9%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(3, x\right), z\right) \]
    7. Simplified83.9%

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

    if -2.59999999999999987e-45 < x < 1.70000000000000005e135

    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+N/A

        \[\leadsto \left(\left(\left(x + y\right) + y\right) + x\right) + \color{blue}{\left(z + x\right)} \]
      2. +-commutativeN/A

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

        \[\leadsto z + \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(z, \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)}\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(x + \color{blue}{\left(\left(x + y\right) + y\right)}\right)\right)\right) \]
      6. associate-+l+N/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(x + \left(x + \color{blue}{\left(y + y\right)}\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(\left(x + x\right) + \color{blue}{\left(y + y\right)}\right)\right)\right) \]
      8. associate-+r+N/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(\left(x + \left(x + x\right)\right) + \color{blue}{\left(y + y\right)}\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(\left(y + y\right) + \color{blue}{\left(x + \left(x + x\right)\right)}\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(y + y\right), \color{blue}{\left(x + \left(x + x\right)\right)}\right)\right) \]
      11. count-2N/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(2 \cdot y\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(y \cdot 2\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
      14. count-2N/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(x + 2 \cdot \color{blue}{x}\right)\right)\right) \]
      15. distribute-rgt1-inN/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(\left(2 + 1\right) \cdot \color{blue}{x}\right)\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(x \cdot \color{blue}{\left(2 + 1\right)}\right)\right)\right) \]
      17. *-lowering-*.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \mathsf{*.f64}\left(x, 3\right)\right)\right) \]
    3. Simplified100.0%

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

      \[\leadsto \color{blue}{z + 2 \cdot y} \]
    6. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto 2 \cdot y + \color{blue}{z} \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(2 \cdot y\right), \color{blue}{z}\right) \]
      3. *-lowering-*.f6492.1%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(2, y\right), z\right) \]
    7. Simplified92.1%

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

    if 1.70000000000000005e135 < 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. associate-+l+N/A

        \[\leadsto \left(\left(\left(x + y\right) + y\right) + x\right) + \color{blue}{\left(z + x\right)} \]
      2. +-commutativeN/A

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

        \[\leadsto z + \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(z, \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)}\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(x + \color{blue}{\left(\left(x + y\right) + y\right)}\right)\right)\right) \]
      6. associate-+l+N/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(x + \left(x + \color{blue}{\left(y + y\right)}\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(\left(x + x\right) + \color{blue}{\left(y + y\right)}\right)\right)\right) \]
      8. associate-+r+N/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(\left(x + \left(x + x\right)\right) + \color{blue}{\left(y + y\right)}\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(\left(y + y\right) + \color{blue}{\left(x + \left(x + x\right)\right)}\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(y + y\right), \color{blue}{\left(x + \left(x + x\right)\right)}\right)\right) \]
      11. count-2N/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(2 \cdot y\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(y \cdot 2\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
      14. count-2N/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(x + 2 \cdot \color{blue}{x}\right)\right)\right) \]
      15. distribute-rgt1-inN/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(\left(2 + 1\right) \cdot \color{blue}{x}\right)\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(x \cdot \color{blue}{\left(2 + 1\right)}\right)\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \mathsf{*.f64}\left(x, \color{blue}{\left(2 + 1\right)}\right)\right)\right) \]
      18. metadata-eval99.8%

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \mathsf{*.f64}\left(x, 3\right)\right)\right) \]
    3. Simplified99.8%

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

      \[\leadsto \color{blue}{2 \cdot y + 3 \cdot x} \]
    6. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(2 \cdot y\right), \color{blue}{\left(3 \cdot x\right)}\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(2, y\right), \left(\color{blue}{3} \cdot x\right)\right) \]
      3. *-lowering-*.f6495.3%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(2, y\right), \mathsf{*.f64}\left(3, \color{blue}{x}\right)\right) \]
    7. Simplified95.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.6 \cdot 10^{-45}:\\ \;\;\;\;z + x \cdot 3\\ \mathbf{elif}\;x \leq 1.7 \cdot 10^{+135}:\\ \;\;\;\;z + y \cdot 2\\ \mathbf{else}:\\ \;\;\;\;x \cdot 3 + y \cdot 2\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 83.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z + x \cdot 3\\ \mathbf{if}\;x \leq -8.8 \cdot 10^{-46}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.05 \cdot 10^{+157}:\\ \;\;\;\;z + y \cdot 2\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ z (* x 3.0))))
   (if (<= x -8.8e-46) t_0 (if (<= x 1.05e+157) (+ z (* y 2.0)) t_0))))
double code(double x, double y, double z) {
	double t_0 = z + (x * 3.0);
	double tmp;
	if (x <= -8.8e-46) {
		tmp = t_0;
	} else if (x <= 1.05e+157) {
		tmp = z + (y * 2.0);
	} else {
		tmp = t_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) :: t_0
    real(8) :: tmp
    t_0 = z + (x * 3.0d0)
    if (x <= (-8.8d-46)) then
        tmp = t_0
    else if (x <= 1.05d+157) then
        tmp = z + (y * 2.0d0)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = z + (x * 3.0);
	double tmp;
	if (x <= -8.8e-46) {
		tmp = t_0;
	} else if (x <= 1.05e+157) {
		tmp = z + (y * 2.0);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z + (x * 3.0)
	tmp = 0
	if x <= -8.8e-46:
		tmp = t_0
	elif x <= 1.05e+157:
		tmp = z + (y * 2.0)
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(z + Float64(x * 3.0))
	tmp = 0.0
	if (x <= -8.8e-46)
		tmp = t_0;
	elseif (x <= 1.05e+157)
		tmp = Float64(z + Float64(y * 2.0));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = z + (x * 3.0);
	tmp = 0.0;
	if (x <= -8.8e-46)
		tmp = t_0;
	elseif (x <= 1.05e+157)
		tmp = z + (y * 2.0);
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(z + N[(x * 3.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -8.8e-46], t$95$0, If[LessEqual[x, 1.05e+157], N[(z + N[(y * 2.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := z + x \cdot 3\\
\mathbf{if}\;x \leq -8.8 \cdot 10^{-46}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 1.05 \cdot 10^{+157}:\\
\;\;\;\;z + y \cdot 2\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -8.8000000000000004e-46 or 1.05e157 < x

    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+N/A

        \[\leadsto \left(\left(\left(x + y\right) + y\right) + x\right) + \color{blue}{\left(z + x\right)} \]
      2. +-commutativeN/A

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

        \[\leadsto z + \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(z, \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)}\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(x + \color{blue}{\left(\left(x + y\right) + y\right)}\right)\right)\right) \]
      6. associate-+l+N/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(x + \left(x + \color{blue}{\left(y + y\right)}\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(\left(x + x\right) + \color{blue}{\left(y + y\right)}\right)\right)\right) \]
      8. associate-+r+N/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(\left(x + \left(x + x\right)\right) + \color{blue}{\left(y + y\right)}\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(\left(y + y\right) + \color{blue}{\left(x + \left(x + x\right)\right)}\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(y + y\right), \color{blue}{\left(x + \left(x + x\right)\right)}\right)\right) \]
      11. count-2N/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(2 \cdot y\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(y \cdot 2\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
      14. count-2N/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(x + 2 \cdot \color{blue}{x}\right)\right)\right) \]
      15. distribute-rgt1-inN/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(\left(2 + 1\right) \cdot \color{blue}{x}\right)\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(x \cdot \color{blue}{\left(2 + 1\right)}\right)\right)\right) \]
      17. *-lowering-*.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \mathsf{*.f64}\left(x, 3\right)\right)\right) \]
    3. Simplified99.9%

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

      \[\leadsto \color{blue}{z + 3 \cdot x} \]
    6. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto 3 \cdot x + \color{blue}{z} \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(3 \cdot x\right), \color{blue}{z}\right) \]
      3. *-lowering-*.f6483.4%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(3, x\right), z\right) \]
    7. Simplified83.4%

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

    if -8.8000000000000004e-46 < x < 1.05e157

    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+N/A

        \[\leadsto \left(\left(\left(x + y\right) + y\right) + x\right) + \color{blue}{\left(z + x\right)} \]
      2. +-commutativeN/A

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

        \[\leadsto z + \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(z, \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)}\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(x + \color{blue}{\left(\left(x + y\right) + y\right)}\right)\right)\right) \]
      6. associate-+l+N/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(x + \left(x + \color{blue}{\left(y + y\right)}\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(\left(x + x\right) + \color{blue}{\left(y + y\right)}\right)\right)\right) \]
      8. associate-+r+N/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(\left(x + \left(x + x\right)\right) + \color{blue}{\left(y + y\right)}\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(\left(y + y\right) + \color{blue}{\left(x + \left(x + x\right)\right)}\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(y + y\right), \color{blue}{\left(x + \left(x + x\right)\right)}\right)\right) \]
      11. count-2N/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(2 \cdot y\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(y \cdot 2\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
      14. count-2N/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(x + 2 \cdot \color{blue}{x}\right)\right)\right) \]
      15. distribute-rgt1-inN/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(\left(2 + 1\right) \cdot \color{blue}{x}\right)\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(x \cdot \color{blue}{\left(2 + 1\right)}\right)\right)\right) \]
      17. *-lowering-*.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \mathsf{*.f64}\left(x, 3\right)\right)\right) \]
    3. Simplified100.0%

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

      \[\leadsto \color{blue}{z + 2 \cdot y} \]
    6. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto 2 \cdot y + \color{blue}{z} \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(2 \cdot y\right), \color{blue}{z}\right) \]
      3. *-lowering-*.f6491.1%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(2, y\right), z\right) \]
    7. Simplified91.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -8.8 \cdot 10^{-46}:\\ \;\;\;\;z + x \cdot 3\\ \mathbf{elif}\;x \leq 1.05 \cdot 10^{+157}:\\ \;\;\;\;z + y \cdot 2\\ \mathbf{else}:\\ \;\;\;\;z + x \cdot 3\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 80.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -5.4 \cdot 10^{+141}:\\ \;\;\;\;x \cdot 3\\ \mathbf{elif}\;x \leq 1.25 \cdot 10^{+157}:\\ \;\;\;\;z + y \cdot 2\\ \mathbf{else}:\\ \;\;\;\;x \cdot 3\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x -5.4e+141)
   (* x 3.0)
   (if (<= x 1.25e+157) (+ z (* y 2.0)) (* x 3.0))))
double code(double x, double y, double z) {
	double tmp;
	if (x <= -5.4e+141) {
		tmp = x * 3.0;
	} else if (x <= 1.25e+157) {
		tmp = z + (y * 2.0);
	} else {
		tmp = x * 3.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 <= (-5.4d+141)) then
        tmp = x * 3.0d0
    else if (x <= 1.25d+157) then
        tmp = z + (y * 2.0d0)
    else
        tmp = x * 3.0d0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= -5.4e+141) {
		tmp = x * 3.0;
	} else if (x <= 1.25e+157) {
		tmp = z + (y * 2.0);
	} else {
		tmp = x * 3.0;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if x <= -5.4e+141:
		tmp = x * 3.0
	elif x <= 1.25e+157:
		tmp = z + (y * 2.0)
	else:
		tmp = x * 3.0
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (x <= -5.4e+141)
		tmp = Float64(x * 3.0);
	elseif (x <= 1.25e+157)
		tmp = Float64(z + Float64(y * 2.0));
	else
		tmp = Float64(x * 3.0);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= -5.4e+141)
		tmp = x * 3.0;
	elseif (x <= 1.25e+157)
		tmp = z + (y * 2.0);
	else
		tmp = x * 3.0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[x, -5.4e+141], N[(x * 3.0), $MachinePrecision], If[LessEqual[x, 1.25e+157], N[(z + N[(y * 2.0), $MachinePrecision]), $MachinePrecision], N[(x * 3.0), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.4 \cdot 10^{+141}:\\
\;\;\;\;x \cdot 3\\

\mathbf{elif}\;x \leq 1.25 \cdot 10^{+157}:\\
\;\;\;\;z + y \cdot 2\\

\mathbf{else}:\\
\;\;\;\;x \cdot 3\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.4000000000000002e141 or 1.24999999999999994e157 < 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. associate-+l+N/A

        \[\leadsto \left(\left(\left(x + y\right) + y\right) + x\right) + \color{blue}{\left(z + x\right)} \]
      2. +-commutativeN/A

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

        \[\leadsto z + \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(z, \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)}\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(x + \color{blue}{\left(\left(x + y\right) + y\right)}\right)\right)\right) \]
      6. associate-+l+N/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(x + \left(x + \color{blue}{\left(y + y\right)}\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(\left(x + x\right) + \color{blue}{\left(y + y\right)}\right)\right)\right) \]
      8. associate-+r+N/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(\left(x + \left(x + x\right)\right) + \color{blue}{\left(y + y\right)}\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(\left(y + y\right) + \color{blue}{\left(x + \left(x + x\right)\right)}\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(y + y\right), \color{blue}{\left(x + \left(x + x\right)\right)}\right)\right) \]
      11. count-2N/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(2 \cdot y\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(y \cdot 2\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
      14. count-2N/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(x + 2 \cdot \color{blue}{x}\right)\right)\right) \]
      15. distribute-rgt1-inN/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(\left(2 + 1\right) \cdot \color{blue}{x}\right)\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(x \cdot \color{blue}{\left(2 + 1\right)}\right)\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \mathsf{*.f64}\left(x, \color{blue}{\left(2 + 1\right)}\right)\right)\right) \]
      18. metadata-eval99.8%

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \mathsf{*.f64}\left(x, 3\right)\right)\right) \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{z + \left(y \cdot 2 + x \cdot 3\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf

      \[\leadsto \color{blue}{3 \cdot x} \]
    6. Step-by-step derivation
      1. *-lowering-*.f6474.4%

        \[\leadsto \mathsf{*.f64}\left(3, \color{blue}{x}\right) \]
    7. Simplified74.4%

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

    if -5.4000000000000002e141 < x < 1.24999999999999994e157

    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+N/A

        \[\leadsto \left(\left(\left(x + y\right) + y\right) + x\right) + \color{blue}{\left(z + x\right)} \]
      2. +-commutativeN/A

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

        \[\leadsto z + \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(z, \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)}\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(x + \color{blue}{\left(\left(x + y\right) + y\right)}\right)\right)\right) \]
      6. associate-+l+N/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(x + \left(x + \color{blue}{\left(y + y\right)}\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(\left(x + x\right) + \color{blue}{\left(y + y\right)}\right)\right)\right) \]
      8. associate-+r+N/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(\left(x + \left(x + x\right)\right) + \color{blue}{\left(y + y\right)}\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(z, \left(\left(y + y\right) + \color{blue}{\left(x + \left(x + x\right)\right)}\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(y + y\right), \color{blue}{\left(x + \left(x + x\right)\right)}\right)\right) \]
      11. count-2N/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(2 \cdot y\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(y \cdot 2\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
      14. count-2N/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(x + 2 \cdot \color{blue}{x}\right)\right)\right) \]
      15. distribute-rgt1-inN/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(\left(2 + 1\right) \cdot \color{blue}{x}\right)\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(x \cdot \color{blue}{\left(2 + 1\right)}\right)\right)\right) \]
      17. *-lowering-*.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \mathsf{*.f64}\left(x, 3\right)\right)\right) \]
    3. Simplified100.0%

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

      \[\leadsto \color{blue}{z + 2 \cdot y} \]
    6. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto 2 \cdot y + \color{blue}{z} \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(2 \cdot y\right), \color{blue}{z}\right) \]
      3. *-lowering-*.f6487.6%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(2, y\right), z\right) \]
    7. Simplified87.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.4 \cdot 10^{+141}:\\ \;\;\;\;x \cdot 3\\ \mathbf{elif}\;x \leq 1.25 \cdot 10^{+157}:\\ \;\;\;\;z + y \cdot 2\\ \mathbf{else}:\\ \;\;\;\;x \cdot 3\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 58.2% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.22 \cdot 10^{+57}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;z \leq 3.3 \cdot 10^{+103}:\\ \;\;\;\;x + y \cdot 2\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -1.22e+57) (+ x z) (if (<= z 3.3e+103) (+ x (* y 2.0)) (+ x z))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -1.22e+57) {
		tmp = x + z;
	} else if (z <= 3.3e+103) {
		tmp = x + (y * 2.0);
	} else {
		tmp = x + 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.22d+57)) then
        tmp = x + z
    else if (z <= 3.3d+103) then
        tmp = x + (y * 2.0d0)
    else
        tmp = x + z
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -1.22e+57) {
		tmp = x + z;
	} else if (z <= 3.3e+103) {
		tmp = x + (y * 2.0);
	} else {
		tmp = x + z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -1.22e+57:
		tmp = x + z
	elif z <= 3.3e+103:
		tmp = x + (y * 2.0)
	else:
		tmp = x + z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -1.22e+57)
		tmp = Float64(x + z);
	elseif (z <= 3.3e+103)
		tmp = Float64(x + Float64(y * 2.0));
	else
		tmp = Float64(x + z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -1.22e+57)
		tmp = x + z;
	elseif (z <= 3.3e+103)
		tmp = x + (y * 2.0);
	else
		tmp = x + z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -1.22e+57], N[(x + z), $MachinePrecision], If[LessEqual[z, 3.3e+103], N[(x + N[(y * 2.0), $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.22 \cdot 10^{+57}:\\
\;\;\;\;x + z\\

\mathbf{elif}\;z \leq 3.3 \cdot 10^{+103}:\\
\;\;\;\;x + y \cdot 2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.22e57 or 3.30000000000000009e103 < z

    1. Initial program 100.0%

      \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \mathsf{+.f64}\left(\color{blue}{z}, x\right) \]
    4. Step-by-step derivation
      1. Simplified73.5%

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

      if -1.22e57 < z < 3.30000000000000009e103

      1. Initial program 99.9%

        \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
      2. Add Preprocessing
      3. Taylor expanded in y around inf

        \[\leadsto \mathsf{+.f64}\left(\color{blue}{\left(2 \cdot y\right)}, x\right) \]
      4. Step-by-step derivation
        1. *-lowering-*.f6455.9%

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(2, y\right), x\right) \]
      5. Simplified55.9%

        \[\leadsto \color{blue}{2 \cdot y} + x \]
    5. Recombined 2 regimes into one program.
    6. Final simplification63.4%

      \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.22 \cdot 10^{+57}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;z \leq 3.3 \cdot 10^{+103}:\\ \;\;\;\;x + y \cdot 2\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \]
    7. Add Preprocessing

    Alternative 6: 56.7% accurate, 0.8× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -9 \cdot 10^{+25}:\\ \;\;\;\;y \cdot 2\\ \mathbf{elif}\;y \leq 3.6 \cdot 10^{+102}:\\ \;\;\;\;x + z\\ \mathbf{else}:\\ \;\;\;\;y \cdot 2\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (if (<= y -9e+25) (* y 2.0) (if (<= y 3.6e+102) (+ x z) (* y 2.0))))
    double code(double x, double y, double z) {
    	double tmp;
    	if (y <= -9e+25) {
    		tmp = y * 2.0;
    	} else if (y <= 3.6e+102) {
    		tmp = x + z;
    	} else {
    		tmp = 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 (y <= (-9d+25)) then
            tmp = y * 2.0d0
        else if (y <= 3.6d+102) then
            tmp = x + z
        else
            tmp = y * 2.0d0
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z) {
    	double tmp;
    	if (y <= -9e+25) {
    		tmp = y * 2.0;
    	} else if (y <= 3.6e+102) {
    		tmp = x + z;
    	} else {
    		tmp = y * 2.0;
    	}
    	return tmp;
    }
    
    def code(x, y, z):
    	tmp = 0
    	if y <= -9e+25:
    		tmp = y * 2.0
    	elif y <= 3.6e+102:
    		tmp = x + z
    	else:
    		tmp = y * 2.0
    	return tmp
    
    function code(x, y, z)
    	tmp = 0.0
    	if (y <= -9e+25)
    		tmp = Float64(y * 2.0);
    	elseif (y <= 3.6e+102)
    		tmp = Float64(x + z);
    	else
    		tmp = Float64(y * 2.0);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z)
    	tmp = 0.0;
    	if (y <= -9e+25)
    		tmp = y * 2.0;
    	elseif (y <= 3.6e+102)
    		tmp = x + z;
    	else
    		tmp = y * 2.0;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_] := If[LessEqual[y, -9e+25], N[(y * 2.0), $MachinePrecision], If[LessEqual[y, 3.6e+102], N[(x + z), $MachinePrecision], N[(y * 2.0), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y \leq -9 \cdot 10^{+25}:\\
    \;\;\;\;y \cdot 2\\
    
    \mathbf{elif}\;y \leq 3.6 \cdot 10^{+102}:\\
    \;\;\;\;x + z\\
    
    \mathbf{else}:\\
    \;\;\;\;y \cdot 2\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y < -9.0000000000000006e25 or 3.6000000000000002e102 < 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. associate-+l+N/A

          \[\leadsto \left(\left(\left(x + y\right) + y\right) + x\right) + \color{blue}{\left(z + x\right)} \]
        2. +-commutativeN/A

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

          \[\leadsto z + \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} \]
        4. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(z, \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)}\right) \]
        5. +-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(x + \color{blue}{\left(\left(x + y\right) + y\right)}\right)\right)\right) \]
        6. associate-+l+N/A

          \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(x + \left(x + \color{blue}{\left(y + y\right)}\right)\right)\right)\right) \]
        7. associate-+r+N/A

          \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(\left(x + x\right) + \color{blue}{\left(y + y\right)}\right)\right)\right) \]
        8. associate-+r+N/A

          \[\leadsto \mathsf{+.f64}\left(z, \left(\left(x + \left(x + x\right)\right) + \color{blue}{\left(y + y\right)}\right)\right) \]
        9. +-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(z, \left(\left(y + y\right) + \color{blue}{\left(x + \left(x + x\right)\right)}\right)\right) \]
        10. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(y + y\right), \color{blue}{\left(x + \left(x + x\right)\right)}\right)\right) \]
        11. count-2N/A

          \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(2 \cdot y\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
        12. *-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(y \cdot 2\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
        13. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
        14. count-2N/A

          \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(x + 2 \cdot \color{blue}{x}\right)\right)\right) \]
        15. distribute-rgt1-inN/A

          \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(\left(2 + 1\right) \cdot \color{blue}{x}\right)\right)\right) \]
        16. *-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(x \cdot \color{blue}{\left(2 + 1\right)}\right)\right)\right) \]
        17. *-lowering-*.f64N/A

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

          \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \mathsf{*.f64}\left(x, 3\right)\right)\right) \]
      3. Simplified99.9%

        \[\leadsto \color{blue}{z + \left(y \cdot 2 + x \cdot 3\right)} \]
      4. Add Preprocessing
      5. Taylor expanded in y around inf

        \[\leadsto \color{blue}{2 \cdot y} \]
      6. Step-by-step derivation
        1. *-lowering-*.f6466.3%

          \[\leadsto \mathsf{*.f64}\left(2, \color{blue}{y}\right) \]
      7. Simplified66.3%

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

      if -9.0000000000000006e25 < y < 3.6000000000000002e102

      1. Initial program 99.9%

        \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
      2. Add Preprocessing
      3. Taylor expanded in z around inf

        \[\leadsto \mathsf{+.f64}\left(\color{blue}{z}, x\right) \]
      4. Step-by-step derivation
        1. Simplified56.7%

          \[\leadsto \color{blue}{z} + x \]
      5. Recombined 2 regimes into one program.
      6. Final simplification60.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9 \cdot 10^{+25}:\\ \;\;\;\;y \cdot 2\\ \mathbf{elif}\;y \leq 3.6 \cdot 10^{+102}:\\ \;\;\;\;x + z\\ \mathbf{else}:\\ \;\;\;\;y \cdot 2\\ \end{array} \]
      7. Add Preprocessing

      Alternative 7: 53.4% accurate, 0.8× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -3 \cdot 10^{+55}:\\ \;\;\;\;z\\ \mathbf{elif}\;z \leq 8 \cdot 10^{+23}:\\ \;\;\;\;y \cdot 2\\ \mathbf{else}:\\ \;\;\;\;z\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (if (<= z -3e+55) z (if (<= z 8e+23) (* y 2.0) z)))
      double code(double x, double y, double z) {
      	double tmp;
      	if (z <= -3e+55) {
      		tmp = z;
      	} else if (z <= 8e+23) {
      		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 (z <= (-3d+55)) then
              tmp = z
          else if (z <= 8d+23) 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 (z <= -3e+55) {
      		tmp = z;
      	} else if (z <= 8e+23) {
      		tmp = y * 2.0;
      	} else {
      		tmp = z;
      	}
      	return tmp;
      }
      
      def code(x, y, z):
      	tmp = 0
      	if z <= -3e+55:
      		tmp = z
      	elif z <= 8e+23:
      		tmp = y * 2.0
      	else:
      		tmp = z
      	return tmp
      
      function code(x, y, z)
      	tmp = 0.0
      	if (z <= -3e+55)
      		tmp = z;
      	elseif (z <= 8e+23)
      		tmp = Float64(y * 2.0);
      	else
      		tmp = z;
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z)
      	tmp = 0.0;
      	if (z <= -3e+55)
      		tmp = z;
      	elseif (z <= 8e+23)
      		tmp = y * 2.0;
      	else
      		tmp = z;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_] := If[LessEqual[z, -3e+55], z, If[LessEqual[z, 8e+23], N[(y * 2.0), $MachinePrecision], z]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;z \leq -3 \cdot 10^{+55}:\\
      \;\;\;\;z\\
      
      \mathbf{elif}\;z \leq 8 \cdot 10^{+23}:\\
      \;\;\;\;y \cdot 2\\
      
      \mathbf{else}:\\
      \;\;\;\;z\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if z < -3.00000000000000017e55 or 7.9999999999999993e23 < 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. associate-+l+N/A

            \[\leadsto \left(\left(\left(x + y\right) + y\right) + x\right) + \color{blue}{\left(z + x\right)} \]
          2. +-commutativeN/A

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

            \[\leadsto z + \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} \]
          4. +-lowering-+.f64N/A

            \[\leadsto \mathsf{+.f64}\left(z, \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)}\right) \]
          5. +-commutativeN/A

            \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(x + \color{blue}{\left(\left(x + y\right) + y\right)}\right)\right)\right) \]
          6. associate-+l+N/A

            \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(x + \left(x + \color{blue}{\left(y + y\right)}\right)\right)\right)\right) \]
          7. associate-+r+N/A

            \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(\left(x + x\right) + \color{blue}{\left(y + y\right)}\right)\right)\right) \]
          8. associate-+r+N/A

            \[\leadsto \mathsf{+.f64}\left(z, \left(\left(x + \left(x + x\right)\right) + \color{blue}{\left(y + y\right)}\right)\right) \]
          9. +-commutativeN/A

            \[\leadsto \mathsf{+.f64}\left(z, \left(\left(y + y\right) + \color{blue}{\left(x + \left(x + x\right)\right)}\right)\right) \]
          10. +-lowering-+.f64N/A

            \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(y + y\right), \color{blue}{\left(x + \left(x + x\right)\right)}\right)\right) \]
          11. count-2N/A

            \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(2 \cdot y\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
          12. *-commutativeN/A

            \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(y \cdot 2\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
          13. *-lowering-*.f64N/A

            \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
          14. count-2N/A

            \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(x + 2 \cdot \color{blue}{x}\right)\right)\right) \]
          15. distribute-rgt1-inN/A

            \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(\left(2 + 1\right) \cdot \color{blue}{x}\right)\right)\right) \]
          16. *-commutativeN/A

            \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(x \cdot \color{blue}{\left(2 + 1\right)}\right)\right)\right) \]
          17. *-lowering-*.f64N/A

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

            \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \mathsf{*.f64}\left(x, 3\right)\right)\right) \]
        3. Simplified99.9%

          \[\leadsto \color{blue}{z + \left(y \cdot 2 + x \cdot 3\right)} \]
        4. Add Preprocessing
        5. Taylor expanded in z around inf

          \[\leadsto \color{blue}{z} \]
        6. Step-by-step derivation
          1. Simplified67.2%

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

          if -3.00000000000000017e55 < z < 7.9999999999999993e23

          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+N/A

              \[\leadsto \left(\left(\left(x + y\right) + y\right) + x\right) + \color{blue}{\left(z + x\right)} \]
            2. +-commutativeN/A

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

              \[\leadsto z + \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} \]
            4. +-lowering-+.f64N/A

              \[\leadsto \mathsf{+.f64}\left(z, \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)}\right) \]
            5. +-commutativeN/A

              \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(x + \color{blue}{\left(\left(x + y\right) + y\right)}\right)\right)\right) \]
            6. associate-+l+N/A

              \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(x + \left(x + \color{blue}{\left(y + y\right)}\right)\right)\right)\right) \]
            7. associate-+r+N/A

              \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(\left(x + x\right) + \color{blue}{\left(y + y\right)}\right)\right)\right) \]
            8. associate-+r+N/A

              \[\leadsto \mathsf{+.f64}\left(z, \left(\left(x + \left(x + x\right)\right) + \color{blue}{\left(y + y\right)}\right)\right) \]
            9. +-commutativeN/A

              \[\leadsto \mathsf{+.f64}\left(z, \left(\left(y + y\right) + \color{blue}{\left(x + \left(x + x\right)\right)}\right)\right) \]
            10. +-lowering-+.f64N/A

              \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(y + y\right), \color{blue}{\left(x + \left(x + x\right)\right)}\right)\right) \]
            11. count-2N/A

              \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(2 \cdot y\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
            12. *-commutativeN/A

              \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(y \cdot 2\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
            13. *-lowering-*.f64N/A

              \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
            14. count-2N/A

              \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(x + 2 \cdot \color{blue}{x}\right)\right)\right) \]
            15. distribute-rgt1-inN/A

              \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(\left(2 + 1\right) \cdot \color{blue}{x}\right)\right)\right) \]
            16. *-commutativeN/A

              \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(x \cdot \color{blue}{\left(2 + 1\right)}\right)\right)\right) \]
            17. *-lowering-*.f64N/A

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

              \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \mathsf{*.f64}\left(x, 3\right)\right)\right) \]
          3. Simplified100.0%

            \[\leadsto \color{blue}{z + \left(y \cdot 2 + x \cdot 3\right)} \]
          4. Add Preprocessing
          5. Taylor expanded in y around inf

            \[\leadsto \color{blue}{2 \cdot y} \]
          6. Step-by-step derivation
            1. *-lowering-*.f6452.1%

              \[\leadsto \mathsf{*.f64}\left(2, \color{blue}{y}\right) \]
          7. Simplified52.1%

            \[\leadsto \color{blue}{2 \cdot y} \]
        7. Recombined 2 regimes into one program.
        8. Final simplification59.4%

          \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3 \cdot 10^{+55}:\\ \;\;\;\;z\\ \mathbf{elif}\;z \leq 8 \cdot 10^{+23}:\\ \;\;\;\;y \cdot 2\\ \mathbf{else}:\\ \;\;\;\;z\\ \end{array} \]
        9. Add Preprocessing

        Alternative 8: 99.9% accurate, 1.2× speedup?

        \[\begin{array}{l} \\ z + \left(x \cdot 3 + y \cdot 2\right) \end{array} \]
        (FPCore (x y z) :precision binary64 (+ z (+ (* x 3.0) (* y 2.0))))
        double code(double x, double y, double z) {
        	return z + ((x * 3.0) + (y * 2.0));
        }
        
        real(8) function code(x, y, z)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8), intent (in) :: z
            code = z + ((x * 3.0d0) + (y * 2.0d0))
        end function
        
        public static double code(double x, double y, double z) {
        	return z + ((x * 3.0) + (y * 2.0));
        }
        
        def code(x, y, z):
        	return z + ((x * 3.0) + (y * 2.0))
        
        function code(x, y, z)
        	return Float64(z + Float64(Float64(x * 3.0) + Float64(y * 2.0)))
        end
        
        function tmp = code(x, y, z)
        	tmp = z + ((x * 3.0) + (y * 2.0));
        end
        
        code[x_, y_, z_] := N[(z + N[(N[(x * 3.0), $MachinePrecision] + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        z + \left(x \cdot 3 + 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. associate-+l+N/A

            \[\leadsto \left(\left(\left(x + y\right) + y\right) + x\right) + \color{blue}{\left(z + x\right)} \]
          2. +-commutativeN/A

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

            \[\leadsto z + \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} \]
          4. +-lowering-+.f64N/A

            \[\leadsto \mathsf{+.f64}\left(z, \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)}\right) \]
          5. +-commutativeN/A

            \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(x + \color{blue}{\left(\left(x + y\right) + y\right)}\right)\right)\right) \]
          6. associate-+l+N/A

            \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(x + \left(x + \color{blue}{\left(y + y\right)}\right)\right)\right)\right) \]
          7. associate-+r+N/A

            \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(\left(x + x\right) + \color{blue}{\left(y + y\right)}\right)\right)\right) \]
          8. associate-+r+N/A

            \[\leadsto \mathsf{+.f64}\left(z, \left(\left(x + \left(x + x\right)\right) + \color{blue}{\left(y + y\right)}\right)\right) \]
          9. +-commutativeN/A

            \[\leadsto \mathsf{+.f64}\left(z, \left(\left(y + y\right) + \color{blue}{\left(x + \left(x + x\right)\right)}\right)\right) \]
          10. +-lowering-+.f64N/A

            \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(y + y\right), \color{blue}{\left(x + \left(x + x\right)\right)}\right)\right) \]
          11. count-2N/A

            \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(2 \cdot y\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
          12. *-commutativeN/A

            \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(y \cdot 2\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
          13. *-lowering-*.f64N/A

            \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
          14. count-2N/A

            \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(x + 2 \cdot \color{blue}{x}\right)\right)\right) \]
          15. distribute-rgt1-inN/A

            \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(\left(2 + 1\right) \cdot \color{blue}{x}\right)\right)\right) \]
          16. *-commutativeN/A

            \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(x \cdot \color{blue}{\left(2 + 1\right)}\right)\right)\right) \]
          17. *-lowering-*.f64N/A

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

            \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \mathsf{*.f64}\left(x, 3\right)\right)\right) \]
        3. Simplified99.9%

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

          \[\leadsto z + \left(x \cdot 3 + y \cdot 2\right) \]
        6. Add Preprocessing

        Alternative 9: 33.9% 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. associate-+l+N/A

            \[\leadsto \left(\left(\left(x + y\right) + y\right) + x\right) + \color{blue}{\left(z + x\right)} \]
          2. +-commutativeN/A

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

            \[\leadsto z + \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} \]
          4. +-lowering-+.f64N/A

            \[\leadsto \mathsf{+.f64}\left(z, \color{blue}{\left(x + \left(\left(\left(x + y\right) + y\right) + x\right)\right)}\right) \]
          5. +-commutativeN/A

            \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(x + \color{blue}{\left(\left(x + y\right) + y\right)}\right)\right)\right) \]
          6. associate-+l+N/A

            \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(x + \left(x + \color{blue}{\left(y + y\right)}\right)\right)\right)\right) \]
          7. associate-+r+N/A

            \[\leadsto \mathsf{+.f64}\left(z, \left(x + \left(\left(x + x\right) + \color{blue}{\left(y + y\right)}\right)\right)\right) \]
          8. associate-+r+N/A

            \[\leadsto \mathsf{+.f64}\left(z, \left(\left(x + \left(x + x\right)\right) + \color{blue}{\left(y + y\right)}\right)\right) \]
          9. +-commutativeN/A

            \[\leadsto \mathsf{+.f64}\left(z, \left(\left(y + y\right) + \color{blue}{\left(x + \left(x + x\right)\right)}\right)\right) \]
          10. +-lowering-+.f64N/A

            \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(y + y\right), \color{blue}{\left(x + \left(x + x\right)\right)}\right)\right) \]
          11. count-2N/A

            \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(2 \cdot y\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
          12. *-commutativeN/A

            \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\left(y \cdot 2\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
          13. *-lowering-*.f64N/A

            \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(\color{blue}{x} + \left(x + x\right)\right)\right)\right) \]
          14. count-2N/A

            \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(x + 2 \cdot \color{blue}{x}\right)\right)\right) \]
          15. distribute-rgt1-inN/A

            \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(\left(2 + 1\right) \cdot \color{blue}{x}\right)\right)\right) \]
          16. *-commutativeN/A

            \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \left(x \cdot \color{blue}{\left(2 + 1\right)}\right)\right)\right) \]
          17. *-lowering-*.f64N/A

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

            \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 2\right), \mathsf{*.f64}\left(x, 3\right)\right)\right) \]
        3. Simplified99.9%

          \[\leadsto \color{blue}{z + \left(y \cdot 2 + x \cdot 3\right)} \]
        4. Add Preprocessing
        5. Taylor expanded in z around inf

          \[\leadsto \color{blue}{z} \]
        6. Step-by-step derivation
          1. Simplified38.3%

            \[\leadsto \color{blue}{z} \]
          2. Add Preprocessing

          Alternative 10: 7.9% accurate, 11.0× speedup?

          \[\begin{array}{l} \\ x \end{array} \]
          (FPCore (x y z) :precision binary64 x)
          double code(double x, double y, double z) {
          	return 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
          end function
          
          public static double code(double x, double y, double z) {
          	return x;
          }
          
          def code(x, y, z):
          	return x
          
          function code(x, y, z)
          	return x
          end
          
          function tmp = code(x, y, z)
          	tmp = x;
          end
          
          code[x_, y_, z_] := x
          
          \begin{array}{l}
          
          \\
          x
          \end{array}
          
          Derivation
          1. Initial program 99.9%

            \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
          2. Add Preprocessing
          3. Taylor expanded in y around inf

            \[\leadsto \mathsf{+.f64}\left(\color{blue}{\left(2 \cdot y\right)}, x\right) \]
          4. Step-by-step derivation
            1. *-lowering-*.f6440.0%

              \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(2, y\right), x\right) \]
          5. Simplified40.0%

            \[\leadsto \color{blue}{2 \cdot y} + x \]
          6. Taylor expanded in y around 0

            \[\leadsto \color{blue}{x} \]
          7. Step-by-step derivation
            1. Simplified7.1%

              \[\leadsto \color{blue}{x} \]
            2. Add Preprocessing

            Reproduce

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