Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendOutside from plot-0.2.3.4, B

Percentage Accurate: 99.9% → 99.9%
Time: 9.7s
Alternatives: 13
Speedup: 1.0×

Specification

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

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

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

Alternative 1: 99.9% accurate, 0.1× speedup?

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

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

    \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
  2. Step-by-step derivation
    1. fma-def99.5%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, \left(\left(\left(y + z\right) + z\right) + y\right) + t, y \cdot 5\right)} \]
    2. associate-+l+99.5%

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

      \[\leadsto \mathsf{fma}\left(x, \left(\left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t, y \cdot 5\right) \]
    4. count-299.5%

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

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

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

Alternative 2: 61.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(t + 2 \cdot y\right)\\ t_2 := x \cdot \left(2 \cdot \left(y + z\right)\right)\\ \mathbf{if}\;x \leq -1 \cdot 10^{+91}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -1.3 \cdot 10^{-146}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.4 \cdot 10^{-24}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 7 \cdot 10^{+91}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (+ t (* 2.0 y)))) (t_2 (* x (* 2.0 (+ y z)))))
   (if (<= x -1e+91)
     t_2
     (if (<= x -1.3e-146)
       t_1
       (if (<= x 2.4e-24) (* y 5.0) (if (<= x 7e+91) t_2 t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (t + (2.0 * y));
	double t_2 = x * (2.0 * (y + z));
	double tmp;
	if (x <= -1e+91) {
		tmp = t_2;
	} else if (x <= -1.3e-146) {
		tmp = t_1;
	} else if (x <= 2.4e-24) {
		tmp = y * 5.0;
	} else if (x <= 7e+91) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = x * (t + (2.0d0 * y))
    t_2 = x * (2.0d0 * (y + z))
    if (x <= (-1d+91)) then
        tmp = t_2
    else if (x <= (-1.3d-146)) then
        tmp = t_1
    else if (x <= 2.4d-24) then
        tmp = y * 5.0d0
    else if (x <= 7d+91) then
        tmp = t_2
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * (t + (2.0 * y));
	double t_2 = x * (2.0 * (y + z));
	double tmp;
	if (x <= -1e+91) {
		tmp = t_2;
	} else if (x <= -1.3e-146) {
		tmp = t_1;
	} else if (x <= 2.4e-24) {
		tmp = y * 5.0;
	} else if (x <= 7e+91) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (t + (2.0 * y))
	t_2 = x * (2.0 * (y + z))
	tmp = 0
	if x <= -1e+91:
		tmp = t_2
	elif x <= -1.3e-146:
		tmp = t_1
	elif x <= 2.4e-24:
		tmp = y * 5.0
	elif x <= 7e+91:
		tmp = t_2
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(t + Float64(2.0 * y)))
	t_2 = Float64(x * Float64(2.0 * Float64(y + z)))
	tmp = 0.0
	if (x <= -1e+91)
		tmp = t_2;
	elseif (x <= -1.3e-146)
		tmp = t_1;
	elseif (x <= 2.4e-24)
		tmp = Float64(y * 5.0);
	elseif (x <= 7e+91)
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (t + (2.0 * y));
	t_2 = x * (2.0 * (y + z));
	tmp = 0.0;
	if (x <= -1e+91)
		tmp = t_2;
	elseif (x <= -1.3e-146)
		tmp = t_1;
	elseif (x <= 2.4e-24)
		tmp = y * 5.0;
	elseif (x <= 7e+91)
		tmp = t_2;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(2.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1e+91], t$95$2, If[LessEqual[x, -1.3e-146], t$95$1, If[LessEqual[x, 2.4e-24], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 7e+91], t$95$2, t$95$1]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \left(t + 2 \cdot y\right)\\
t_2 := x \cdot \left(2 \cdot \left(y + z\right)\right)\\
\mathbf{if}\;x \leq -1 \cdot 10^{+91}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \leq -1.3 \cdot 10^{-146}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 2.4 \cdot 10^{-24}:\\
\;\;\;\;y \cdot 5\\

\mathbf{elif}\;x \leq 7 \cdot 10^{+91}:\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.00000000000000008e91 or 2.3999999999999998e-24 < x < 7.00000000000000001e91

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Taylor expanded in t around 0 84.1%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(5, y, x \cdot \left(2 \cdot \left(y + z\right)\right)\right)} \]
    4. Step-by-step derivation
      1. fma-udef84.1%

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

        \[\leadsto \color{blue}{y \cdot 5} + x \cdot \left(2 \cdot \left(y + z\right)\right) \]
    5. Applied egg-rr84.1%

      \[\leadsto \color{blue}{y \cdot 5 + x \cdot \left(2 \cdot \left(y + z\right)\right)} \]
    6. Taylor expanded in x around inf 82.8%

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot \left(y + z\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutative82.8%

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

        \[\leadsto \left(x \cdot \color{blue}{\left(z + y\right)}\right) \cdot 2 \]
      3. associate-*r*82.8%

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

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

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

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

    if -1.00000000000000008e91 < x < -1.29999999999999993e-146 or 7.00000000000000001e91 < x

    1. Initial program 98.9%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Step-by-step derivation
      1. fma-def98.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \left(\left(\left(y + z\right) + z\right) + y\right) + t, y \cdot 5\right)} \]
      2. associate-+l+98.9%

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

        \[\leadsto \mathsf{fma}\left(x, \left(\left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t, y \cdot 5\right) \]
      4. count-298.9%

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(t + 2 \cdot y\right)} \]
    6. Step-by-step derivation
      1. +-commutative71.5%

        \[\leadsto x \cdot \color{blue}{\left(2 \cdot y + t\right)} \]
      2. *-commutative71.5%

        \[\leadsto x \cdot \left(\color{blue}{y \cdot 2} + t\right) \]
    7. Simplified71.5%

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

    if -1.29999999999999993e-146 < x < 2.3999999999999998e-24

    1. Initial program 99.9%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Taylor expanded in x around 0 66.8%

      \[\leadsto \color{blue}{5 \cdot y} \]
    3. Simplified66.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1 \cdot 10^{+91}:\\ \;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right)\\ \mathbf{elif}\;x \leq -1.3 \cdot 10^{-146}:\\ \;\;\;\;x \cdot \left(t + 2 \cdot y\right)\\ \mathbf{elif}\;x \leq 2.4 \cdot 10^{-24}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 7 \cdot 10^{+91}:\\ \;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + 2 \cdot y\right)\\ \end{array} \]

Alternative 3: 61.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(t + 2 \cdot y\right)\\ t_2 := x \cdot \left(2 \cdot \left(y + z\right)\right)\\ \mathbf{if}\;x \leq -3 \cdot 10^{+90}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -1.3 \cdot 10^{-146}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 4.2 \cdot 10^{-25}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{elif}\;x \leq 1.1 \cdot 10^{+90}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (+ t (* 2.0 y)))) (t_2 (* x (* 2.0 (+ y z)))))
   (if (<= x -3e+90)
     t_2
     (if (<= x -1.3e-146)
       t_1
       (if (<= x 4.2e-25)
         (* y (+ 5.0 (* x 2.0)))
         (if (<= x 1.1e+90) t_2 t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (t + (2.0 * y));
	double t_2 = x * (2.0 * (y + z));
	double tmp;
	if (x <= -3e+90) {
		tmp = t_2;
	} else if (x <= -1.3e-146) {
		tmp = t_1;
	} else if (x <= 4.2e-25) {
		tmp = y * (5.0 + (x * 2.0));
	} else if (x <= 1.1e+90) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = x * (t + (2.0d0 * y))
    t_2 = x * (2.0d0 * (y + z))
    if (x <= (-3d+90)) then
        tmp = t_2
    else if (x <= (-1.3d-146)) then
        tmp = t_1
    else if (x <= 4.2d-25) then
        tmp = y * (5.0d0 + (x * 2.0d0))
    else if (x <= 1.1d+90) then
        tmp = t_2
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * (t + (2.0 * y));
	double t_2 = x * (2.0 * (y + z));
	double tmp;
	if (x <= -3e+90) {
		tmp = t_2;
	} else if (x <= -1.3e-146) {
		tmp = t_1;
	} else if (x <= 4.2e-25) {
		tmp = y * (5.0 + (x * 2.0));
	} else if (x <= 1.1e+90) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (t + (2.0 * y))
	t_2 = x * (2.0 * (y + z))
	tmp = 0
	if x <= -3e+90:
		tmp = t_2
	elif x <= -1.3e-146:
		tmp = t_1
	elif x <= 4.2e-25:
		tmp = y * (5.0 + (x * 2.0))
	elif x <= 1.1e+90:
		tmp = t_2
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(t + Float64(2.0 * y)))
	t_2 = Float64(x * Float64(2.0 * Float64(y + z)))
	tmp = 0.0
	if (x <= -3e+90)
		tmp = t_2;
	elseif (x <= -1.3e-146)
		tmp = t_1;
	elseif (x <= 4.2e-25)
		tmp = Float64(y * Float64(5.0 + Float64(x * 2.0)));
	elseif (x <= 1.1e+90)
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (t + (2.0 * y));
	t_2 = x * (2.0 * (y + z));
	tmp = 0.0;
	if (x <= -3e+90)
		tmp = t_2;
	elseif (x <= -1.3e-146)
		tmp = t_1;
	elseif (x <= 4.2e-25)
		tmp = y * (5.0 + (x * 2.0));
	elseif (x <= 1.1e+90)
		tmp = t_2;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(2.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3e+90], t$95$2, If[LessEqual[x, -1.3e-146], t$95$1, If[LessEqual[x, 4.2e-25], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.1e+90], t$95$2, t$95$1]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \left(t + 2 \cdot y\right)\\
t_2 := x \cdot \left(2 \cdot \left(y + z\right)\right)\\
\mathbf{if}\;x \leq -3 \cdot 10^{+90}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \leq -1.3 \cdot 10^{-146}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 4.2 \cdot 10^{-25}:\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\

\mathbf{elif}\;x \leq 1.1 \cdot 10^{+90}:\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.99999999999999979e90 or 4.20000000000000005e-25 < x < 1.09999999999999995e90

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Taylor expanded in t around 0 84.1%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(5, y, x \cdot \left(2 \cdot \left(y + z\right)\right)\right)} \]
    4. Step-by-step derivation
      1. fma-udef84.1%

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

        \[\leadsto \color{blue}{y \cdot 5} + x \cdot \left(2 \cdot \left(y + z\right)\right) \]
    5. Applied egg-rr84.1%

      \[\leadsto \color{blue}{y \cdot 5 + x \cdot \left(2 \cdot \left(y + z\right)\right)} \]
    6. Taylor expanded in x around inf 82.8%

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot \left(y + z\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutative82.8%

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

        \[\leadsto \left(x \cdot \color{blue}{\left(z + y\right)}\right) \cdot 2 \]
      3. associate-*r*82.8%

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

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

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

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

    if -2.99999999999999979e90 < x < -1.29999999999999993e-146 or 1.09999999999999995e90 < x

    1. Initial program 98.9%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Step-by-step derivation
      1. fma-def98.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \left(\left(\left(y + z\right) + z\right) + y\right) + t, y \cdot 5\right)} \]
      2. associate-+l+98.9%

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

        \[\leadsto \mathsf{fma}\left(x, \left(\left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t, y \cdot 5\right) \]
      4. count-298.9%

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(t + 2 \cdot y\right)} \]
    6. Step-by-step derivation
      1. +-commutative71.5%

        \[\leadsto x \cdot \color{blue}{\left(2 \cdot y + t\right)} \]
      2. *-commutative71.5%

        \[\leadsto x \cdot \left(\color{blue}{y \cdot 2} + t\right) \]
    7. Simplified71.5%

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

    if -1.29999999999999993e-146 < x < 4.20000000000000005e-25

    1. Initial program 99.9%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Taylor expanded in y around inf 66.8%

      \[\leadsto \color{blue}{y \cdot \left(5 + 2 \cdot x\right)} \]
    3. Simplified66.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3 \cdot 10^{+90}:\\ \;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right)\\ \mathbf{elif}\;x \leq -1.3 \cdot 10^{-146}:\\ \;\;\;\;x \cdot \left(t + 2 \cdot y\right)\\ \mathbf{elif}\;x \leq 4.2 \cdot 10^{-25}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{elif}\;x \leq 1.1 \cdot 10^{+90}:\\ \;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + 2 \cdot y\right)\\ \end{array} \]

Alternative 4: 74.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(t + 2 \cdot y\right)\\ t_2 := x \cdot \left(2 \cdot \left(y + z\right)\right)\\ \mathbf{if}\;x \leq -4 \cdot 10^{+90}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -2.5:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.1 \cdot 10^{+21}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;x \leq 1.65 \cdot 10^{+91}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (+ t (* 2.0 y)))) (t_2 (* x (* 2.0 (+ y z)))))
   (if (<= x -4e+90)
     t_2
     (if (<= x -2.5)
       t_1
       (if (<= x 1.1e+21)
         (+ (* y 5.0) (* x t))
         (if (<= x 1.65e+91) t_2 t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (t + (2.0 * y));
	double t_2 = x * (2.0 * (y + z));
	double tmp;
	if (x <= -4e+90) {
		tmp = t_2;
	} else if (x <= -2.5) {
		tmp = t_1;
	} else if (x <= 1.1e+21) {
		tmp = (y * 5.0) + (x * t);
	} else if (x <= 1.65e+91) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = x * (t + (2.0d0 * y))
    t_2 = x * (2.0d0 * (y + z))
    if (x <= (-4d+90)) then
        tmp = t_2
    else if (x <= (-2.5d0)) then
        tmp = t_1
    else if (x <= 1.1d+21) then
        tmp = (y * 5.0d0) + (x * t)
    else if (x <= 1.65d+91) then
        tmp = t_2
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * (t + (2.0 * y));
	double t_2 = x * (2.0 * (y + z));
	double tmp;
	if (x <= -4e+90) {
		tmp = t_2;
	} else if (x <= -2.5) {
		tmp = t_1;
	} else if (x <= 1.1e+21) {
		tmp = (y * 5.0) + (x * t);
	} else if (x <= 1.65e+91) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (t + (2.0 * y))
	t_2 = x * (2.0 * (y + z))
	tmp = 0
	if x <= -4e+90:
		tmp = t_2
	elif x <= -2.5:
		tmp = t_1
	elif x <= 1.1e+21:
		tmp = (y * 5.0) + (x * t)
	elif x <= 1.65e+91:
		tmp = t_2
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(t + Float64(2.0 * y)))
	t_2 = Float64(x * Float64(2.0 * Float64(y + z)))
	tmp = 0.0
	if (x <= -4e+90)
		tmp = t_2;
	elseif (x <= -2.5)
		tmp = t_1;
	elseif (x <= 1.1e+21)
		tmp = Float64(Float64(y * 5.0) + Float64(x * t));
	elseif (x <= 1.65e+91)
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (t + (2.0 * y));
	t_2 = x * (2.0 * (y + z));
	tmp = 0.0;
	if (x <= -4e+90)
		tmp = t_2;
	elseif (x <= -2.5)
		tmp = t_1;
	elseif (x <= 1.1e+21)
		tmp = (y * 5.0) + (x * t);
	elseif (x <= 1.65e+91)
		tmp = t_2;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(2.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4e+90], t$95$2, If[LessEqual[x, -2.5], t$95$1, If[LessEqual[x, 1.1e+21], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.65e+91], t$95$2, t$95$1]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \left(t + 2 \cdot y\right)\\
t_2 := x \cdot \left(2 \cdot \left(y + z\right)\right)\\
\mathbf{if}\;x \leq -4 \cdot 10^{+90}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \leq -2.5:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 1.1 \cdot 10^{+21}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\

\mathbf{elif}\;x \leq 1.65 \cdot 10^{+91}:\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3.99999999999999987e90 or 1.1e21 < x < 1.65000000000000009e91

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Taylor expanded in t around 0 86.9%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(5, y, x \cdot \left(2 \cdot \left(y + z\right)\right)\right)} \]
    4. Step-by-step derivation
      1. fma-udef86.9%

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

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

      \[\leadsto \color{blue}{y \cdot 5 + x \cdot \left(2 \cdot \left(y + z\right)\right)} \]
    6. Taylor expanded in x around inf 86.9%

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot \left(y + z\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutative86.9%

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

        \[\leadsto \left(x \cdot \color{blue}{\left(z + y\right)}\right) \cdot 2 \]
      3. associate-*r*86.9%

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

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

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

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

    if -3.99999999999999987e90 < x < -2.5 or 1.65000000000000009e91 < x

    1. Initial program 98.5%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Step-by-step derivation
      1. fma-def98.5%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \left(\left(\left(y + z\right) + z\right) + y\right) + t, y \cdot 5\right)} \]
      2. associate-+l+98.5%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t, y \cdot 5\right) \]
      3. +-commutative98.5%

        \[\leadsto \mathsf{fma}\left(x, \left(\left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t, y \cdot 5\right) \]
      4. count-298.5%

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(t + 2 \cdot y\right)} \]
    6. Step-by-step derivation
      1. +-commutative82.7%

        \[\leadsto x \cdot \color{blue}{\left(2 \cdot y + t\right)} \]
      2. *-commutative82.7%

        \[\leadsto x \cdot \left(\color{blue}{y \cdot 2} + t\right) \]
    7. Simplified82.7%

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

    if -2.5 < x < 1.1e21

    1. Initial program 99.9%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Taylor expanded in t around inf 80.7%

      \[\leadsto \color{blue}{t \cdot x} + y \cdot 5 \]
    3. Simplified80.7%

      \[\leadsto \color{blue}{x \cdot t} + y \cdot 5 \]
  3. Recombined 3 regimes into one program.
  4. Final simplification82.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4 \cdot 10^{+90}:\\ \;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right)\\ \mathbf{elif}\;x \leq -2.5:\\ \;\;\;\;x \cdot \left(t + 2 \cdot y\right)\\ \mathbf{elif}\;x \leq 1.1 \cdot 10^{+21}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;x \leq 1.65 \cdot 10^{+91}:\\ \;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + 2 \cdot y\right)\\ \end{array} \]

Alternative 5: 86.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 2 \cdot \left(y + z\right)\\ \mathbf{if}\;t \leq -3.3 \cdot 10^{+62}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;t \leq 7.2 \cdot 10^{+131}:\\ \;\;\;\;y \cdot 5 + x \cdot t_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t_1 + t\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* 2.0 (+ y z))))
   (if (<= t -3.3e+62)
     (+ (* y 5.0) (* x t))
     (if (<= t 7.2e+131) (+ (* y 5.0) (* x t_1)) (* x (+ t_1 t))))))
double code(double x, double y, double z, double t) {
	double t_1 = 2.0 * (y + z);
	double tmp;
	if (t <= -3.3e+62) {
		tmp = (y * 5.0) + (x * t);
	} else if (t <= 7.2e+131) {
		tmp = (y * 5.0) + (x * t_1);
	} else {
		tmp = x * (t_1 + t);
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = 2.0d0 * (y + z)
    if (t <= (-3.3d+62)) then
        tmp = (y * 5.0d0) + (x * t)
    else if (t <= 7.2d+131) then
        tmp = (y * 5.0d0) + (x * t_1)
    else
        tmp = x * (t_1 + t)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = 2.0 * (y + z);
	double tmp;
	if (t <= -3.3e+62) {
		tmp = (y * 5.0) + (x * t);
	} else if (t <= 7.2e+131) {
		tmp = (y * 5.0) + (x * t_1);
	} else {
		tmp = x * (t_1 + t);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = 2.0 * (y + z)
	tmp = 0
	if t <= -3.3e+62:
		tmp = (y * 5.0) + (x * t)
	elif t <= 7.2e+131:
		tmp = (y * 5.0) + (x * t_1)
	else:
		tmp = x * (t_1 + t)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(2.0 * Float64(y + z))
	tmp = 0.0
	if (t <= -3.3e+62)
		tmp = Float64(Float64(y * 5.0) + Float64(x * t));
	elseif (t <= 7.2e+131)
		tmp = Float64(Float64(y * 5.0) + Float64(x * t_1));
	else
		tmp = Float64(x * Float64(t_1 + t));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = 2.0 * (y + z);
	tmp = 0.0;
	if (t <= -3.3e+62)
		tmp = (y * 5.0) + (x * t);
	elseif (t <= 7.2e+131)
		tmp = (y * 5.0) + (x * t_1);
	else
		tmp = x * (t_1 + t);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3.3e+62], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.2e+131], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t$95$1), $MachinePrecision]), $MachinePrecision], N[(x * N[(t$95$1 + t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := 2 \cdot \left(y + z\right)\\
\mathbf{if}\;t \leq -3.3 \cdot 10^{+62}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\

\mathbf{elif}\;t \leq 7.2 \cdot 10^{+131}:\\
\;\;\;\;y \cdot 5 + x \cdot t_1\\

\mathbf{else}:\\
\;\;\;\;x \cdot \left(t_1 + t\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -3.3e62

    1. Initial program 98.2%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Taylor expanded in t around inf 89.7%

      \[\leadsto \color{blue}{t \cdot x} + y \cdot 5 \]
    3. Simplified89.7%

      \[\leadsto \color{blue}{x \cdot t} + y \cdot 5 \]

    if -3.3e62 < t < 7.20000000000000063e131

    1. Initial program 99.9%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Taylor expanded in t around 0 94.7%

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

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

    if 7.20000000000000063e131 < t

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Step-by-step derivation
      1. fma-def100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \left(\left(\left(y + z\right) + z\right) + y\right) + t, y \cdot 5\right)} \]
      2. associate-+l+100.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3.3 \cdot 10^{+62}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;t \leq 7.2 \cdot 10^{+131}:\\ \;\;\;\;y \cdot 5 + x \cdot \left(2 \cdot \left(y + z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\ \end{array} \]

Alternative 6: 99.9% accurate, 1.0× speedup?

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

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

    \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
  2. Taylor expanded in y around 0 99.5%

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

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

Alternative 7: 99.9% accurate, 1.0× speedup?

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

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

    \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
  2. Final simplification99.5%

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

Alternative 8: 46.9% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(2 \cdot z\right)\\ \mathbf{if}\;x \leq -4 \cdot 10^{+86}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.15 \cdot 10^{-146}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 1.05 \cdot 10^{-24}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.5 \cdot 10^{+99}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (* 2.0 z))))
   (if (<= x -4e+86)
     t_1
     (if (<= x -1.15e-146)
       (* x t)
       (if (<= x 1.05e-24) (* y 5.0) (if (<= x 1.5e+99) t_1 (* x t)))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (2.0 * z);
	double tmp;
	if (x <= -4e+86) {
		tmp = t_1;
	} else if (x <= -1.15e-146) {
		tmp = x * t;
	} else if (x <= 1.05e-24) {
		tmp = y * 5.0;
	} else if (x <= 1.5e+99) {
		tmp = t_1;
	} else {
		tmp = x * t;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = x * (2.0d0 * z)
    if (x <= (-4d+86)) then
        tmp = t_1
    else if (x <= (-1.15d-146)) then
        tmp = x * t
    else if (x <= 1.05d-24) then
        tmp = y * 5.0d0
    else if (x <= 1.5d+99) then
        tmp = t_1
    else
        tmp = x * t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * (2.0 * z);
	double tmp;
	if (x <= -4e+86) {
		tmp = t_1;
	} else if (x <= -1.15e-146) {
		tmp = x * t;
	} else if (x <= 1.05e-24) {
		tmp = y * 5.0;
	} else if (x <= 1.5e+99) {
		tmp = t_1;
	} else {
		tmp = x * t;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (2.0 * z)
	tmp = 0
	if x <= -4e+86:
		tmp = t_1
	elif x <= -1.15e-146:
		tmp = x * t
	elif x <= 1.05e-24:
		tmp = y * 5.0
	elif x <= 1.5e+99:
		tmp = t_1
	else:
		tmp = x * t
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(2.0 * z))
	tmp = 0.0
	if (x <= -4e+86)
		tmp = t_1;
	elseif (x <= -1.15e-146)
		tmp = Float64(x * t);
	elseif (x <= 1.05e-24)
		tmp = Float64(y * 5.0);
	elseif (x <= 1.5e+99)
		tmp = t_1;
	else
		tmp = Float64(x * t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (2.0 * z);
	tmp = 0.0;
	if (x <= -4e+86)
		tmp = t_1;
	elseif (x <= -1.15e-146)
		tmp = x * t;
	elseif (x <= 1.05e-24)
		tmp = y * 5.0;
	elseif (x <= 1.5e+99)
		tmp = t_1;
	else
		tmp = x * t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(2.0 * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4e+86], t$95$1, If[LessEqual[x, -1.15e-146], N[(x * t), $MachinePrecision], If[LessEqual[x, 1.05e-24], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 1.5e+99], t$95$1, N[(x * t), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \left(2 \cdot z\right)\\
\mathbf{if}\;x \leq -4 \cdot 10^{+86}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq -1.15 \cdot 10^{-146}:\\
\;\;\;\;x \cdot t\\

\mathbf{elif}\;x \leq 1.05 \cdot 10^{-24}:\\
\;\;\;\;y \cdot 5\\

\mathbf{elif}\;x \leq 1.5 \cdot 10^{+99}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -4.0000000000000001e86 or 1.05e-24 < x < 1.50000000000000007e99

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Taylor expanded in y around 0 91.3%

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

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

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot z\right)} \]
    5. Step-by-step derivation
      1. associate-*r*49.6%

        \[\leadsto \color{blue}{\left(2 \cdot x\right) \cdot z} \]
      2. *-commutative49.6%

        \[\leadsto \color{blue}{\left(x \cdot 2\right)} \cdot z \]
      3. associate-*r*49.6%

        \[\leadsto \color{blue}{x \cdot \left(2 \cdot z\right)} \]
    6. Simplified49.6%

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

    if -4.0000000000000001e86 < x < -1.15e-146 or 1.50000000000000007e99 < x

    1. Initial program 98.9%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Taylor expanded in y around 0 97.8%

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

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

      \[\leadsto \color{blue}{t \cdot x} \]
    5. Step-by-step derivation
      1. *-commutative44.7%

        \[\leadsto \color{blue}{x \cdot t} \]
    6. Simplified44.7%

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

    if -1.15e-146 < x < 1.05e-24

    1. Initial program 99.9%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Taylor expanded in x around 0 66.8%

      \[\leadsto \color{blue}{5 \cdot y} \]
    3. Simplified66.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4 \cdot 10^{+86}:\\ \;\;\;\;x \cdot \left(2 \cdot z\right)\\ \mathbf{elif}\;x \leq -1.15 \cdot 10^{-146}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 1.05 \cdot 10^{-24}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.5 \cdot 10^{+99}:\\ \;\;\;\;x \cdot \left(2 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]

Alternative 9: 89.3% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.02 \lor \neg \left(x \leq 9 \cdot 10^{-25}\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\

\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -0.0200000000000000004 or 9.0000000000000002e-25 < x

    1. Initial program 99.2%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Step-by-step derivation
      1. fma-def99.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \left(\left(\left(y + z\right) + z\right) + y\right) + t, y \cdot 5\right)} \]
      2. associate-+l+99.3%

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

        \[\leadsto \mathsf{fma}\left(x, \left(\left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t, y \cdot 5\right) \]
      4. count-299.3%

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

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

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

    if -0.0200000000000000004 < x < 9.0000000000000002e-25

    1. Initial program 99.9%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Taylor expanded in t around inf 82.5%

      \[\leadsto \color{blue}{t \cdot x} + y \cdot 5 \]
    3. Simplified82.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -0.02 \lor \neg \left(x \leq 9 \cdot 10^{-25}\right):\\ \;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \end{array} \]

Alternative 10: 46.3% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.3 \cdot 10^{+88}:\\
\;\;\;\;x \cdot \left(2 \cdot z\right)\\

\mathbf{elif}\;x \leq -1.3 \cdot 10^{-146}:\\
\;\;\;\;x \cdot t\\

\mathbf{elif}\;x \leq 2.5:\\
\;\;\;\;y \cdot 5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -4.29999999999999974e88

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Taylor expanded in y around 0 87.7%

      \[\leadsto \color{blue}{x \cdot \left(t + 2 \cdot z\right) + y \cdot \left(5 + 2 \cdot x\right)} \]
    3. Simplified91.8%

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

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot z\right)} \]
    5. Step-by-step derivation
      1. associate-*r*51.0%

        \[\leadsto \color{blue}{\left(2 \cdot x\right) \cdot z} \]
      2. *-commutative51.0%

        \[\leadsto \color{blue}{\left(x \cdot 2\right)} \cdot z \]
      3. associate-*r*51.0%

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

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

    if -4.29999999999999974e88 < x < -1.29999999999999993e-146

    1. Initial program 97.5%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Taylor expanded in y around 0 100.0%

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

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

      \[\leadsto \color{blue}{t \cdot x} \]
    5. Step-by-step derivation
      1. *-commutative43.7%

        \[\leadsto \color{blue}{x \cdot t} \]
    6. Simplified43.7%

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

    if -1.29999999999999993e-146 < x < 2.5

    1. Initial program 99.9%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Taylor expanded in x around 0 65.9%

      \[\leadsto \color{blue}{5 \cdot y} \]
    3. Simplified65.9%

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

    if 2.5 < x

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Taylor expanded in y around inf 44.3%

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

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

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot y\right)} \]
    5. Step-by-step derivation
      1. *-commutative44.3%

        \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot 2} \]
      2. *-commutative44.3%

        \[\leadsto \color{blue}{\left(y \cdot x\right)} \cdot 2 \]
      3. associate-*r*44.3%

        \[\leadsto \color{blue}{y \cdot \left(x \cdot 2\right)} \]
    6. Simplified44.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.3 \cdot 10^{+88}:\\ \;\;\;\;x \cdot \left(2 \cdot z\right)\\ \mathbf{elif}\;x \leq -1.3 \cdot 10^{-146}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 2.5:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x \cdot 2\right)\\ \end{array} \]

Alternative 11: 63.4% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0165 \lor \neg \left(x \leq 5 \cdot 10^{-25}\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right)\\

\mathbf{else}:\\
\;\;\;\;y \cdot 5\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -0.016500000000000001 or 4.99999999999999962e-25 < x

    1. Initial program 99.2%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Taylor expanded in t around 0 73.0%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(5, y, x \cdot \left(2 \cdot \left(y + z\right)\right)\right)} \]
    4. Step-by-step derivation
      1. fma-udef73.0%

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

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

      \[\leadsto \color{blue}{y \cdot 5 + x \cdot \left(2 \cdot \left(y + z\right)\right)} \]
    6. Taylor expanded in x around inf 72.3%

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot \left(y + z\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutative72.3%

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

        \[\leadsto \left(x \cdot \color{blue}{\left(z + y\right)}\right) \cdot 2 \]
      3. associate-*r*72.3%

        \[\leadsto \color{blue}{x \cdot \left(\left(z + y\right) \cdot 2\right)} \]
      4. *-commutative72.3%

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

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

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

    if -0.016500000000000001 < x < 4.99999999999999962e-25

    1. Initial program 99.9%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Taylor expanded in x around 0 59.7%

      \[\leadsto \color{blue}{5 \cdot y} \]
    3. Simplified59.7%

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

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

Alternative 12: 47.2% accurate, 2.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{-146} \lor \neg \left(x \leq 1720\right):\\
\;\;\;\;x \cdot t\\

\mathbf{else}:\\
\;\;\;\;y \cdot 5\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.29999999999999993e-146 or 1720 < x

    1. Initial program 99.3%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Taylor expanded in y around 0 94.9%

      \[\leadsto \color{blue}{x \cdot \left(t + 2 \cdot z\right) + y \cdot \left(5 + 2 \cdot x\right)} \]
    3. Simplified97.4%

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

      \[\leadsto \color{blue}{t \cdot x} \]
    5. Step-by-step derivation
      1. *-commutative37.1%

        \[\leadsto \color{blue}{x \cdot t} \]
    6. Simplified37.1%

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

    if -1.29999999999999993e-146 < x < 1720

    1. Initial program 99.9%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Taylor expanded in x around 0 65.3%

      \[\leadsto \color{blue}{5 \cdot y} \]
    3. Simplified65.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.3 \cdot 10^{-146} \lor \neg \left(x \leq 1720\right):\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]

Alternative 13: 31.5% accurate, 5.0× speedup?

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

\\
x \cdot t
\end{array}
Derivation
  1. Initial program 99.5%

    \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
  2. Taylor expanded in y around 0 96.8%

    \[\leadsto \color{blue}{x \cdot \left(t + 2 \cdot z\right) + y \cdot \left(5 + 2 \cdot x\right)} \]
  3. Simplified98.4%

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

    \[\leadsto \color{blue}{t \cdot x} \]
  5. Step-by-step derivation
    1. *-commutative30.3%

      \[\leadsto \color{blue}{x \cdot t} \]
  6. Simplified30.3%

    \[\leadsto \color{blue}{x \cdot t} \]
  7. Final simplification30.3%

    \[\leadsto x \cdot t \]

Reproduce

?
herbie shell --seed 2023336 
(FPCore (x y z t)
  :name "Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendOutside from plot-0.2.3.4, B"
  :precision binary64
  (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))