Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, A

Percentage Accurate: 95.5% → 98.2%
Time: 16.1s
Alternatives: 11
Speedup: 0.9×

Specification

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

\\
\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b
\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 11 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: 95.5% accurate, 1.0× speedup?

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

\\
\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b
\end{array}

Alternative 1: 98.2% accurate, 0.1× speedup?

\[\begin{array}{l} [y, z, t] = \mathsf{sort}([y, z, t])\\ \\ \begin{array}{l} t_1 := \left(a \cdot 27\right) \cdot b\\ \mathbf{if}\;z \leq -5 \cdot 10^{-36}:\\ \;\;\;\;\mathsf{fma}\left(x, 2, \mathsf{fma}\left(z, y \cdot \left(t \cdot -9\right), t_1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1 + \left(x \cdot 2 - t \cdot \left(z \cdot \left(y \cdot 9\right)\right)\right)\\ \end{array} \end{array} \]
NOTE: y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* (* a 27.0) b)))
   (if (<= z -5e-36)
     (fma x 2.0 (fma z (* y (* t -9.0)) t_1))
     (+ t_1 (- (* x 2.0) (* t (* z (* y 9.0))))))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (a * 27.0) * b;
	double tmp;
	if (z <= -5e-36) {
		tmp = fma(x, 2.0, fma(z, (y * (t * -9.0)), t_1));
	} else {
		tmp = t_1 + ((x * 2.0) - (t * (z * (y * 9.0))));
	}
	return tmp;
}
y, z, t = sort([y, z, t])
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(a * 27.0) * b)
	tmp = 0.0
	if (z <= -5e-36)
		tmp = fma(x, 2.0, fma(z, Float64(y * Float64(t * -9.0)), t_1));
	else
		tmp = Float64(t_1 + Float64(Float64(x * 2.0) - Float64(t * Float64(z * Float64(y * 9.0)))));
	end
	return tmp
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[z, -5e-36], N[(x * 2.0 + N[(z * N[(y * N[(t * -9.0), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(z * N[(y * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
t_1 := \left(a \cdot 27\right) \cdot b\\
\mathbf{if}\;z \leq -5 \cdot 10^{-36}:\\
\;\;\;\;\mathsf{fma}\left(x, 2, \mathsf{fma}\left(z, y \cdot \left(t \cdot -9\right), t_1\right)\right)\\

\mathbf{else}:\\
\;\;\;\;t_1 + \left(x \cdot 2 - t \cdot \left(z \cdot \left(y \cdot 9\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.00000000000000004e-36

    1. Initial program 90.5%

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

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      2. associate-+r-90.5%

        \[\leadsto \color{blue}{\left(\left(a \cdot 27\right) \cdot b + x \cdot 2\right) - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t} \]
      3. cancel-sign-sub-inv90.5%

        \[\leadsto \color{blue}{\left(\left(a \cdot 27\right) \cdot b + x \cdot 2\right) + \left(-\left(y \cdot 9\right) \cdot z\right) \cdot t} \]
      4. *-commutative90.5%

        \[\leadsto \left(\left(a \cdot 27\right) \cdot b + x \cdot 2\right) + \color{blue}{t \cdot \left(-\left(y \cdot 9\right) \cdot z\right)} \]
      5. distribute-rgt-neg-out90.5%

        \[\leadsto \left(\left(a \cdot 27\right) \cdot b + x \cdot 2\right) + t \cdot \color{blue}{\left(\left(y \cdot 9\right) \cdot \left(-z\right)\right)} \]
      6. associate-*r*95.7%

        \[\leadsto \left(\left(a \cdot 27\right) \cdot b + x \cdot 2\right) + \color{blue}{\left(t \cdot \left(y \cdot 9\right)\right) \cdot \left(-z\right)} \]
      7. *-commutative95.7%

        \[\leadsto \left(\left(a \cdot 27\right) \cdot b + x \cdot 2\right) + \color{blue}{\left(\left(y \cdot 9\right) \cdot t\right)} \cdot \left(-z\right) \]
      8. distribute-rgt-neg-in95.7%

        \[\leadsto \left(\left(a \cdot 27\right) \cdot b + x \cdot 2\right) + \color{blue}{\left(-\left(\left(y \cdot 9\right) \cdot t\right) \cdot z\right)} \]
      9. associate-+r+95.7%

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 + \left(-\left(\left(y \cdot 9\right) \cdot t\right) \cdot z\right)\right)} \]
      10. sub-neg95.7%

        \[\leadsto \left(a \cdot 27\right) \cdot b + \color{blue}{\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot t\right) \cdot z\right)} \]
      11. +-commutative95.7%

        \[\leadsto \color{blue}{\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot t\right) \cdot z\right) + \left(a \cdot 27\right) \cdot b} \]
      12. associate-+l-95.7%

        \[\leadsto \color{blue}{x \cdot 2 - \left(\left(\left(y \cdot 9\right) \cdot t\right) \cdot z - \left(a \cdot 27\right) \cdot b\right)} \]
      13. fma-neg95.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, 2, -\left(\left(\left(y \cdot 9\right) \cdot t\right) \cdot z - \left(a \cdot 27\right) \cdot b\right)\right)} \]
      14. associate-*l*89.3%

        \[\leadsto \mathsf{fma}\left(x, 2, -\left(\color{blue}{\left(y \cdot 9\right) \cdot \left(t \cdot z\right)} - \left(a \cdot 27\right) \cdot b\right)\right) \]
      15. fma-neg92.1%

        \[\leadsto \mathsf{fma}\left(x, 2, -\color{blue}{\mathsf{fma}\left(y \cdot 9, t \cdot z, -\left(a \cdot 27\right) \cdot b\right)}\right) \]
      16. *-commutative92.1%

        \[\leadsto \mathsf{fma}\left(x, 2, -\mathsf{fma}\left(y \cdot 9, \color{blue}{z \cdot t}, -\left(a \cdot 27\right) \cdot b\right)\right) \]
      17. fma-neg89.3%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(z, y \cdot \left(t \cdot -9\right), \left(a \cdot 27\right) \cdot b\right)\right)} \]

    if -5.00000000000000004e-36 < z

    1. Initial program 97.2%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
  3. Recombined 2 regimes into one program.
  4. Final simplification97.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5 \cdot 10^{-36}:\\ \;\;\;\;\mathsf{fma}\left(x, 2, \mathsf{fma}\left(z, y \cdot \left(t \cdot -9\right), \left(a \cdot 27\right) \cdot b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - t \cdot \left(z \cdot \left(y \cdot 9\right)\right)\right)\\ \end{array} \]

Alternative 2: 79.4% accurate, 0.7× speedup?

\[\begin{array}{l} [y, z, t] = \mathsf{sort}([y, z, t])\\ \\ \begin{array}{l} t_1 := 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\ t_2 := x \cdot 2 - t_1\\ \mathbf{if}\;x \cdot 2 \leq -5 \cdot 10^{+126}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot 2 \leq 2 \cdot 10^{+24}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right) - t_1\\ \mathbf{elif}\;x \cdot 2 \leq 5 \cdot 10^{+126}:\\ \;\;\;\;\left(a \cdot 27\right) \cdot b + x \cdot 2\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
NOTE: y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* 9.0 (* t (* z y)))) (t_2 (- (* x 2.0) t_1)))
   (if (<= (* x 2.0) -5e+126)
     t_2
     (if (<= (* x 2.0) 2e+24)
       (- (* 27.0 (* a b)) t_1)
       (if (<= (* x 2.0) 5e+126) (+ (* (* a 27.0) b) (* x 2.0)) t_2)))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = 9.0 * (t * (z * y));
	double t_2 = (x * 2.0) - t_1;
	double tmp;
	if ((x * 2.0) <= -5e+126) {
		tmp = t_2;
	} else if ((x * 2.0) <= 2e+24) {
		tmp = (27.0 * (a * b)) - t_1;
	} else if ((x * 2.0) <= 5e+126) {
		tmp = ((a * 27.0) * b) + (x * 2.0);
	} else {
		tmp = t_2;
	}
	return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = 9.0d0 * (t * (z * y))
    t_2 = (x * 2.0d0) - t_1
    if ((x * 2.0d0) <= (-5d+126)) then
        tmp = t_2
    else if ((x * 2.0d0) <= 2d+24) then
        tmp = (27.0d0 * (a * b)) - t_1
    else if ((x * 2.0d0) <= 5d+126) then
        tmp = ((a * 27.0d0) * b) + (x * 2.0d0)
    else
        tmp = t_2
    end if
    code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = 9.0 * (t * (z * y));
	double t_2 = (x * 2.0) - t_1;
	double tmp;
	if ((x * 2.0) <= -5e+126) {
		tmp = t_2;
	} else if ((x * 2.0) <= 2e+24) {
		tmp = (27.0 * (a * b)) - t_1;
	} else if ((x * 2.0) <= 5e+126) {
		tmp = ((a * 27.0) * b) + (x * 2.0);
	} else {
		tmp = t_2;
	}
	return tmp;
}
[y, z, t] = sort([y, z, t])
def code(x, y, z, t, a, b):
	t_1 = 9.0 * (t * (z * y))
	t_2 = (x * 2.0) - t_1
	tmp = 0
	if (x * 2.0) <= -5e+126:
		tmp = t_2
	elif (x * 2.0) <= 2e+24:
		tmp = (27.0 * (a * b)) - t_1
	elif (x * 2.0) <= 5e+126:
		tmp = ((a * 27.0) * b) + (x * 2.0)
	else:
		tmp = t_2
	return tmp
y, z, t = sort([y, z, t])
function code(x, y, z, t, a, b)
	t_1 = Float64(9.0 * Float64(t * Float64(z * y)))
	t_2 = Float64(Float64(x * 2.0) - t_1)
	tmp = 0.0
	if (Float64(x * 2.0) <= -5e+126)
		tmp = t_2;
	elseif (Float64(x * 2.0) <= 2e+24)
		tmp = Float64(Float64(27.0 * Float64(a * b)) - t_1);
	elseif (Float64(x * 2.0) <= 5e+126)
		tmp = Float64(Float64(Float64(a * 27.0) * b) + Float64(x * 2.0));
	else
		tmp = t_2;
	end
	return tmp
end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = 9.0 * (t * (z * y));
	t_2 = (x * 2.0) - t_1;
	tmp = 0.0;
	if ((x * 2.0) <= -5e+126)
		tmp = t_2;
	elseif ((x * 2.0) <= 2e+24)
		tmp = (27.0 * (a * b)) - t_1;
	elseif ((x * 2.0) <= 5e+126)
		tmp = ((a * 27.0) * b) + (x * 2.0);
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(9.0 * N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * 2.0), $MachinePrecision] - t$95$1), $MachinePrecision]}, If[LessEqual[N[(x * 2.0), $MachinePrecision], -5e+126], t$95$2, If[LessEqual[N[(x * 2.0), $MachinePrecision], 2e+24], N[(N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[N[(x * 2.0), $MachinePrecision], 5e+126], N[(N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
t_1 := 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
t_2 := x \cdot 2 - t_1\\
\mathbf{if}\;x \cdot 2 \leq -5 \cdot 10^{+126}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \cdot 2 \leq 2 \cdot 10^{+24}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right) - t_1\\

\mathbf{elif}\;x \cdot 2 \leq 5 \cdot 10^{+126}:\\
\;\;\;\;\left(a \cdot 27\right) \cdot b + x \cdot 2\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x 2) < -4.99999999999999977e126 or 4.99999999999999977e126 < (*.f64 x 2)

    1. Initial program 96.5%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. sub-neg96.5%

        \[\leadsto \color{blue}{\left(x \cdot 2 + \left(-\left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\right)} + \left(a \cdot 27\right) \cdot b \]
      2. distribute-lft-neg-in96.5%

        \[\leadsto \left(x \cdot 2 + \color{blue}{\left(-\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) + \left(a \cdot 27\right) \cdot b \]
      3. associate-*l*96.5%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{y \cdot \left(9 \cdot z\right)}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      4. *-commutative96.5%

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

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(z \cdot 9\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      6. cancel-sign-sub-inv96.5%

        \[\leadsto \color{blue}{\left(x \cdot 2 - \left(\left(z \cdot 9\right) \cdot y\right) \cdot t\right)} + \left(a \cdot 27\right) \cdot b \]
      7. *-commutative96.5%

        \[\leadsto \left(x \cdot 2 - \left(\color{blue}{\left(9 \cdot z\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      8. *-commutative96.5%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot \left(9 \cdot z\right)\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      9. associate-*l*96.5%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      10. associate-*l*93.1%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot 9\right) \cdot \left(z \cdot t\right)}\right) + \left(a \cdot 27\right) \cdot b \]
      11. associate-*l*93.1%

        \[\leadsto \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + \color{blue}{a \cdot \left(27 \cdot b\right)} \]
    3. Simplified93.1%

      \[\leadsto \color{blue}{\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)} \]
    4. Taylor expanded in a around 0 86.4%

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

    if -4.99999999999999977e126 < (*.f64 x 2) < 2e24

    1. Initial program 94.8%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. sub-neg94.8%

        \[\leadsto \color{blue}{\left(x \cdot 2 + \left(-\left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\right)} + \left(a \cdot 27\right) \cdot b \]
      2. distribute-lft-neg-in94.8%

        \[\leadsto \left(x \cdot 2 + \color{blue}{\left(-\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) + \left(a \cdot 27\right) \cdot b \]
      3. associate-*l*95.4%

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

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(9 \cdot z\right) \cdot y}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      5. *-commutative95.4%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(z \cdot 9\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      6. cancel-sign-sub-inv95.4%

        \[\leadsto \color{blue}{\left(x \cdot 2 - \left(\left(z \cdot 9\right) \cdot y\right) \cdot t\right)} + \left(a \cdot 27\right) \cdot b \]
      7. *-commutative95.4%

        \[\leadsto \left(x \cdot 2 - \left(\color{blue}{\left(9 \cdot z\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      8. *-commutative95.4%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot \left(9 \cdot z\right)\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      9. associate-*l*94.8%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      10. associate-*l*94.2%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot 9\right) \cdot \left(z \cdot t\right)}\right) + \left(a \cdot 27\right) \cdot b \]
      11. associate-*l*94.8%

        \[\leadsto \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + \color{blue}{a \cdot \left(27 \cdot b\right)} \]
    3. Simplified94.8%

      \[\leadsto \color{blue}{\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)} \]
    4. Taylor expanded in x around 0 85.2%

      \[\leadsto \color{blue}{27 \cdot \left(a \cdot b\right) - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]

    if 2e24 < (*.f64 x 2) < 4.99999999999999977e126

    1. Initial program 93.1%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. sub-neg93.1%

        \[\leadsto \color{blue}{\left(x \cdot 2 + \left(-\left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\right)} + \left(a \cdot 27\right) \cdot b \]
      2. distribute-lft-neg-in93.1%

        \[\leadsto \left(x \cdot 2 + \color{blue}{\left(-\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) + \left(a \cdot 27\right) \cdot b \]
      3. associate-*l*93.1%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{y \cdot \left(9 \cdot z\right)}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      4. *-commutative93.1%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(9 \cdot z\right) \cdot y}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      5. *-commutative93.1%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(z \cdot 9\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      6. cancel-sign-sub-inv93.1%

        \[\leadsto \color{blue}{\left(x \cdot 2 - \left(\left(z \cdot 9\right) \cdot y\right) \cdot t\right)} + \left(a \cdot 27\right) \cdot b \]
      7. *-commutative93.1%

        \[\leadsto \left(x \cdot 2 - \left(\color{blue}{\left(9 \cdot z\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      8. *-commutative93.1%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot \left(9 \cdot z\right)\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      9. associate-*l*93.1%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      10. associate-*l*99.8%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot 9\right) \cdot \left(z \cdot t\right)}\right) + \left(a \cdot 27\right) \cdot b \]
      11. associate-*l*99.8%

        \[\leadsto \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + \color{blue}{a \cdot \left(27 \cdot b\right)} \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)} \]
    4. Step-by-step derivation
      1. associate-+l-99.8%

        \[\leadsto \color{blue}{x \cdot 2 - \left(\left(y \cdot 9\right) \cdot \left(z \cdot t\right) - a \cdot \left(27 \cdot b\right)\right)} \]
      2. associate-*r*93.1%

        \[\leadsto x \cdot 2 - \left(\color{blue}{\left(\left(y \cdot 9\right) \cdot z\right) \cdot t} - a \cdot \left(27 \cdot b\right)\right) \]
      3. associate-*r*93.1%

        \[\leadsto x \cdot 2 - \left(\left(\left(y \cdot 9\right) \cdot z\right) \cdot t - \color{blue}{\left(a \cdot 27\right) \cdot b}\right) \]
      4. associate-*r*99.8%

        \[\leadsto x \cdot 2 - \left(\color{blue}{\left(y \cdot 9\right) \cdot \left(z \cdot t\right)} - \left(a \cdot 27\right) \cdot b\right) \]
      5. associate-*l*99.8%

        \[\leadsto x \cdot 2 - \left(\color{blue}{y \cdot \left(9 \cdot \left(z \cdot t\right)\right)} - \left(a \cdot 27\right) \cdot b\right) \]
      6. *-commutative99.8%

        \[\leadsto x \cdot 2 - \left(y \cdot \left(9 \cdot \left(z \cdot t\right)\right) - \color{blue}{b \cdot \left(a \cdot 27\right)}\right) \]
    5. Applied egg-rr99.8%

      \[\leadsto \color{blue}{x \cdot 2 - \left(y \cdot \left(9 \cdot \left(z \cdot t\right)\right) - b \cdot \left(a \cdot 27\right)\right)} \]
    6. Taylor expanded in y around 0 93.3%

      \[\leadsto x \cdot 2 - \color{blue}{-27 \cdot \left(a \cdot b\right)} \]
    7. Step-by-step derivation
      1. cancel-sign-sub-inv93.3%

        \[\leadsto \color{blue}{x \cdot 2 + \left(--27\right) \cdot \left(a \cdot b\right)} \]
      2. metadata-eval93.3%

        \[\leadsto x \cdot 2 + \color{blue}{27} \cdot \left(a \cdot b\right) \]
      3. associate-*r*93.4%

        \[\leadsto x \cdot 2 + \color{blue}{\left(27 \cdot a\right) \cdot b} \]
      4. *-commutative93.4%

        \[\leadsto x \cdot 2 + \color{blue}{\left(a \cdot 27\right)} \cdot b \]
      5. *-commutative93.4%

        \[\leadsto x \cdot 2 + \color{blue}{b \cdot \left(a \cdot 27\right)} \]
    8. Applied egg-rr93.4%

      \[\leadsto \color{blue}{x \cdot 2 + b \cdot \left(a \cdot 27\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification86.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot 2 \leq -5 \cdot 10^{+126}:\\ \;\;\;\;x \cdot 2 - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\ \mathbf{elif}\;x \cdot 2 \leq 2 \cdot 10^{+24}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right) - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\ \mathbf{elif}\;x \cdot 2 \leq 5 \cdot 10^{+126}:\\ \;\;\;\;\left(a \cdot 27\right) \cdot b + x \cdot 2\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2 - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\ \end{array} \]

Alternative 3: 96.9% accurate, 0.9× speedup?

\[\begin{array}{l} [y, z, t] = \mathsf{sort}([y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq 4.3 \cdot 10^{+101}:\\ \;\;\;\;\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2 - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\ \end{array} \end{array} \]
NOTE: y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
 :precision binary64
 (if (<= z 4.3e+101)
   (+ (- (* x 2.0) (* (* y 9.0) (* z t))) (* a (* 27.0 b)))
   (- (* x 2.0) (* 9.0 (* t (* z y))))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (z <= 4.3e+101) {
		tmp = ((x * 2.0) - ((y * 9.0) * (z * t))) + (a * (27.0 * b));
	} else {
		tmp = (x * 2.0) - (9.0 * (t * (z * y)));
	}
	return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (z <= 4.3d+101) then
        tmp = ((x * 2.0d0) - ((y * 9.0d0) * (z * t))) + (a * (27.0d0 * b))
    else
        tmp = (x * 2.0d0) - (9.0d0 * (t * (z * y)))
    end if
    code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (z <= 4.3e+101) {
		tmp = ((x * 2.0) - ((y * 9.0) * (z * t))) + (a * (27.0 * b));
	} else {
		tmp = (x * 2.0) - (9.0 * (t * (z * y)));
	}
	return tmp;
}
[y, z, t] = sort([y, z, t])
def code(x, y, z, t, a, b):
	tmp = 0
	if z <= 4.3e+101:
		tmp = ((x * 2.0) - ((y * 9.0) * (z * t))) + (a * (27.0 * b))
	else:
		tmp = (x * 2.0) - (9.0 * (t * (z * y)))
	return tmp
y, z, t = sort([y, z, t])
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (z <= 4.3e+101)
		tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(y * 9.0) * Float64(z * t))) + Float64(a * Float64(27.0 * b)));
	else
		tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(t * Float64(z * y))));
	end
	return tmp
end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (z <= 4.3e+101)
		tmp = ((x * 2.0) - ((y * 9.0) * (z * t))) + (a * (27.0 * b));
	else
		tmp = (x * 2.0) - (9.0 * (t * (z * y)));
	end
	tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, 4.3e+101], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(y * 9.0), $MachinePrecision] * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 4.3 \cdot 10^{+101}:\\
\;\;\;\;\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)\\

\mathbf{else}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 4.3000000000000001e101

    1. Initial program 95.2%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. sub-neg95.2%

        \[\leadsto \color{blue}{\left(x \cdot 2 + \left(-\left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\right)} + \left(a \cdot 27\right) \cdot b \]
      2. distribute-lft-neg-in95.2%

        \[\leadsto \left(x \cdot 2 + \color{blue}{\left(-\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) + \left(a \cdot 27\right) \cdot b \]
      3. associate-*l*95.7%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{y \cdot \left(9 \cdot z\right)}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      4. *-commutative95.7%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(9 \cdot z\right) \cdot y}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      5. *-commutative95.7%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(z \cdot 9\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      6. cancel-sign-sub-inv95.7%

        \[\leadsto \color{blue}{\left(x \cdot 2 - \left(\left(z \cdot 9\right) \cdot y\right) \cdot t\right)} + \left(a \cdot 27\right) \cdot b \]
      7. *-commutative95.7%

        \[\leadsto \left(x \cdot 2 - \left(\color{blue}{\left(9 \cdot z\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      8. *-commutative95.7%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot \left(9 \cdot z\right)\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      9. associate-*l*95.2%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      10. associate-*l*95.2%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot 9\right) \cdot \left(z \cdot t\right)}\right) + \left(a \cdot 27\right) \cdot b \]
      11. associate-*l*95.7%

        \[\leadsto \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + \color{blue}{a \cdot \left(27 \cdot b\right)} \]
    3. Simplified95.7%

      \[\leadsto \color{blue}{\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)} \]

    if 4.3000000000000001e101 < z

    1. Initial program 95.6%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. sub-neg95.6%

        \[\leadsto \color{blue}{\left(x \cdot 2 + \left(-\left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\right)} + \left(a \cdot 27\right) \cdot b \]
      2. distribute-lft-neg-in95.6%

        \[\leadsto \left(x \cdot 2 + \color{blue}{\left(-\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) + \left(a \cdot 27\right) \cdot b \]
      3. associate-*l*95.5%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{y \cdot \left(9 \cdot z\right)}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      4. *-commutative95.5%

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

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(z \cdot 9\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      6. cancel-sign-sub-inv95.5%

        \[\leadsto \color{blue}{\left(x \cdot 2 - \left(\left(z \cdot 9\right) \cdot y\right) \cdot t\right)} + \left(a \cdot 27\right) \cdot b \]
      7. *-commutative95.5%

        \[\leadsto \left(x \cdot 2 - \left(\color{blue}{\left(9 \cdot z\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      8. *-commutative95.5%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot \left(9 \cdot z\right)\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      9. associate-*l*95.6%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      10. associate-*l*89.3%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot 9\right) \cdot \left(z \cdot t\right)}\right) + \left(a \cdot 27\right) \cdot b \]
      11. associate-*l*89.4%

        \[\leadsto \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + \color{blue}{a \cdot \left(27 \cdot b\right)} \]
    3. Simplified89.4%

      \[\leadsto \color{blue}{\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)} \]
    4. Taylor expanded in a around 0 80.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 4.3 \cdot 10^{+101}:\\ \;\;\;\;\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2 - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\ \end{array} \]

Alternative 4: 98.2% accurate, 0.9× speedup?

\[\begin{array}{l} [y, z, t] = \mathsf{sort}([y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq 2 \cdot 10^{-54}:\\ \;\;\;\;\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - t \cdot \left(z \cdot \left(y \cdot 9\right)\right)\right)\\ \end{array} \end{array} \]
NOTE: y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
 :precision binary64
 (if (<= z 2e-54)
   (+ (- (* x 2.0) (* (* y 9.0) (* z t))) (* a (* 27.0 b)))
   (+ (* (* a 27.0) b) (- (* x 2.0) (* t (* z (* y 9.0)))))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (z <= 2e-54) {
		tmp = ((x * 2.0) - ((y * 9.0) * (z * t))) + (a * (27.0 * b));
	} else {
		tmp = ((a * 27.0) * b) + ((x * 2.0) - (t * (z * (y * 9.0))));
	}
	return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (z <= 2d-54) then
        tmp = ((x * 2.0d0) - ((y * 9.0d0) * (z * t))) + (a * (27.0d0 * b))
    else
        tmp = ((a * 27.0d0) * b) + ((x * 2.0d0) - (t * (z * (y * 9.0d0))))
    end if
    code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (z <= 2e-54) {
		tmp = ((x * 2.0) - ((y * 9.0) * (z * t))) + (a * (27.0 * b));
	} else {
		tmp = ((a * 27.0) * b) + ((x * 2.0) - (t * (z * (y * 9.0))));
	}
	return tmp;
}
[y, z, t] = sort([y, z, t])
def code(x, y, z, t, a, b):
	tmp = 0
	if z <= 2e-54:
		tmp = ((x * 2.0) - ((y * 9.0) * (z * t))) + (a * (27.0 * b))
	else:
		tmp = ((a * 27.0) * b) + ((x * 2.0) - (t * (z * (y * 9.0))))
	return tmp
y, z, t = sort([y, z, t])
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (z <= 2e-54)
		tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(y * 9.0) * Float64(z * t))) + Float64(a * Float64(27.0 * b)));
	else
		tmp = Float64(Float64(Float64(a * 27.0) * b) + Float64(Float64(x * 2.0) - Float64(t * Float64(z * Float64(y * 9.0)))));
	end
	return tmp
end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (z <= 2e-54)
		tmp = ((x * 2.0) - ((y * 9.0) * (z * t))) + (a * (27.0 * b));
	else
		tmp = ((a * 27.0) * b) + ((x * 2.0) - (t * (z * (y * 9.0))));
	end
	tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, 2e-54], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(y * 9.0), $MachinePrecision] * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(z * N[(y * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2 \cdot 10^{-54}:\\
\;\;\;\;\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)\\

\mathbf{else}:\\
\;\;\;\;\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - t \cdot \left(z \cdot \left(y \cdot 9\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 2.0000000000000001e-54

    1. Initial program 94.3%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. sub-neg94.3%

        \[\leadsto \color{blue}{\left(x \cdot 2 + \left(-\left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\right)} + \left(a \cdot 27\right) \cdot b \]
      2. distribute-lft-neg-in94.3%

        \[\leadsto \left(x \cdot 2 + \color{blue}{\left(-\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) + \left(a \cdot 27\right) \cdot b \]
      3. associate-*l*94.9%

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

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

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(z \cdot 9\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      6. cancel-sign-sub-inv94.9%

        \[\leadsto \color{blue}{\left(x \cdot 2 - \left(\left(z \cdot 9\right) \cdot y\right) \cdot t\right)} + \left(a \cdot 27\right) \cdot b \]
      7. *-commutative94.9%

        \[\leadsto \left(x \cdot 2 - \left(\color{blue}{\left(9 \cdot z\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      8. *-commutative94.9%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot \left(9 \cdot z\right)\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      9. associate-*l*94.3%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      10. associate-*l*94.4%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot 9\right) \cdot \left(z \cdot t\right)}\right) + \left(a \cdot 27\right) \cdot b \]
      11. associate-*l*94.9%

        \[\leadsto \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + \color{blue}{a \cdot \left(27 \cdot b\right)} \]
    3. Simplified94.9%

      \[\leadsto \color{blue}{\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)} \]

    if 2.0000000000000001e-54 < z

    1. Initial program 97.4%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
  3. Recombined 2 regimes into one program.
  4. Final simplification95.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 2 \cdot 10^{-54}:\\ \;\;\;\;\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - t \cdot \left(z \cdot \left(y \cdot 9\right)\right)\right)\\ \end{array} \]

Alternative 5: 47.5% accurate, 1.0× speedup?

\[\begin{array}{l} [y, z, t] = \mathsf{sort}([y, z, t])\\ \\ \begin{array}{l} t_1 := a \cdot \left(27 \cdot b\right)\\ t_2 := -9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\ \mathbf{if}\;x \leq -1.4 \cdot 10^{+95}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;x \leq -7.5 \cdot 10^{-158}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;x \leq -3 \cdot 10^{-242}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 3.25 \cdot 10^{-229}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 3 \cdot 10^{-152}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 1.7 \cdot 10^{-36}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2\\ \end{array} \end{array} \]
NOTE: y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* a (* 27.0 b))) (t_2 (* -9.0 (* t (* z y)))))
   (if (<= x -1.4e+95)
     (* x 2.0)
     (if (<= x -7.5e-158)
       (* 27.0 (* a b))
       (if (<= x -3e-242)
         t_2
         (if (<= x 3.25e-229)
           t_1
           (if (<= x 3e-152) t_2 (if (<= x 1.7e-36) t_1 (* x 2.0)))))))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = a * (27.0 * b);
	double t_2 = -9.0 * (t * (z * y));
	double tmp;
	if (x <= -1.4e+95) {
		tmp = x * 2.0;
	} else if (x <= -7.5e-158) {
		tmp = 27.0 * (a * b);
	} else if (x <= -3e-242) {
		tmp = t_2;
	} else if (x <= 3.25e-229) {
		tmp = t_1;
	} else if (x <= 3e-152) {
		tmp = t_2;
	} else if (x <= 1.7e-36) {
		tmp = t_1;
	} else {
		tmp = x * 2.0;
	}
	return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = a * (27.0d0 * b)
    t_2 = (-9.0d0) * (t * (z * y))
    if (x <= (-1.4d+95)) then
        tmp = x * 2.0d0
    else if (x <= (-7.5d-158)) then
        tmp = 27.0d0 * (a * b)
    else if (x <= (-3d-242)) then
        tmp = t_2
    else if (x <= 3.25d-229) then
        tmp = t_1
    else if (x <= 3d-152) then
        tmp = t_2
    else if (x <= 1.7d-36) then
        tmp = t_1
    else
        tmp = x * 2.0d0
    end if
    code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = a * (27.0 * b);
	double t_2 = -9.0 * (t * (z * y));
	double tmp;
	if (x <= -1.4e+95) {
		tmp = x * 2.0;
	} else if (x <= -7.5e-158) {
		tmp = 27.0 * (a * b);
	} else if (x <= -3e-242) {
		tmp = t_2;
	} else if (x <= 3.25e-229) {
		tmp = t_1;
	} else if (x <= 3e-152) {
		tmp = t_2;
	} else if (x <= 1.7e-36) {
		tmp = t_1;
	} else {
		tmp = x * 2.0;
	}
	return tmp;
}
[y, z, t] = sort([y, z, t])
def code(x, y, z, t, a, b):
	t_1 = a * (27.0 * b)
	t_2 = -9.0 * (t * (z * y))
	tmp = 0
	if x <= -1.4e+95:
		tmp = x * 2.0
	elif x <= -7.5e-158:
		tmp = 27.0 * (a * b)
	elif x <= -3e-242:
		tmp = t_2
	elif x <= 3.25e-229:
		tmp = t_1
	elif x <= 3e-152:
		tmp = t_2
	elif x <= 1.7e-36:
		tmp = t_1
	else:
		tmp = x * 2.0
	return tmp
y, z, t = sort([y, z, t])
function code(x, y, z, t, a, b)
	t_1 = Float64(a * Float64(27.0 * b))
	t_2 = Float64(-9.0 * Float64(t * Float64(z * y)))
	tmp = 0.0
	if (x <= -1.4e+95)
		tmp = Float64(x * 2.0);
	elseif (x <= -7.5e-158)
		tmp = Float64(27.0 * Float64(a * b));
	elseif (x <= -3e-242)
		tmp = t_2;
	elseif (x <= 3.25e-229)
		tmp = t_1;
	elseif (x <= 3e-152)
		tmp = t_2;
	elseif (x <= 1.7e-36)
		tmp = t_1;
	else
		tmp = Float64(x * 2.0);
	end
	return tmp
end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = a * (27.0 * b);
	t_2 = -9.0 * (t * (z * y));
	tmp = 0.0;
	if (x <= -1.4e+95)
		tmp = x * 2.0;
	elseif (x <= -7.5e-158)
		tmp = 27.0 * (a * b);
	elseif (x <= -3e-242)
		tmp = t_2;
	elseif (x <= 3.25e-229)
		tmp = t_1;
	elseif (x <= 3e-152)
		tmp = t_2;
	elseif (x <= 1.7e-36)
		tmp = t_1;
	else
		tmp = x * 2.0;
	end
	tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-9.0 * N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.4e+95], N[(x * 2.0), $MachinePrecision], If[LessEqual[x, -7.5e-158], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3e-242], t$95$2, If[LessEqual[x, 3.25e-229], t$95$1, If[LessEqual[x, 3e-152], t$95$2, If[LessEqual[x, 1.7e-36], t$95$1, N[(x * 2.0), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
t_1 := a \cdot \left(27 \cdot b\right)\\
t_2 := -9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\mathbf{if}\;x \leq -1.4 \cdot 10^{+95}:\\
\;\;\;\;x \cdot 2\\

\mathbf{elif}\;x \leq -7.5 \cdot 10^{-158}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\

\mathbf{elif}\;x \leq -3 \cdot 10^{-242}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \leq 3.25 \cdot 10^{-229}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 3 \cdot 10^{-152}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \leq 1.7 \cdot 10^{-36}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.3999999999999999e95 or 1.7000000000000001e-36 < x

    1. Initial program 95.6%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. sub-neg95.6%

        \[\leadsto \color{blue}{\left(x \cdot 2 + \left(-\left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\right)} + \left(a \cdot 27\right) \cdot b \]
      2. distribute-lft-neg-in95.6%

        \[\leadsto \left(x \cdot 2 + \color{blue}{\left(-\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) + \left(a \cdot 27\right) \cdot b \]
      3. associate-*l*95.6%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{y \cdot \left(9 \cdot z\right)}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      4. *-commutative95.6%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(9 \cdot z\right) \cdot y}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      5. *-commutative95.6%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(z \cdot 9\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      6. cancel-sign-sub-inv95.6%

        \[\leadsto \color{blue}{\left(x \cdot 2 - \left(\left(z \cdot 9\right) \cdot y\right) \cdot t\right)} + \left(a \cdot 27\right) \cdot b \]
      7. *-commutative95.6%

        \[\leadsto \left(x \cdot 2 - \left(\color{blue}{\left(9 \cdot z\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      8. *-commutative95.6%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot \left(9 \cdot z\right)\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      9. associate-*l*95.6%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      10. associate-*l*94.8%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot 9\right) \cdot \left(z \cdot t\right)}\right) + \left(a \cdot 27\right) \cdot b \]
      11. associate-*l*94.8%

        \[\leadsto \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + \color{blue}{a \cdot \left(27 \cdot b\right)} \]
    3. Simplified94.8%

      \[\leadsto \color{blue}{\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)} \]
    4. Taylor expanded in x around inf 57.7%

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

    if -1.3999999999999999e95 < x < -7.5e-158

    1. Initial program 90.4%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. sub-neg90.4%

        \[\leadsto \color{blue}{\left(x \cdot 2 + \left(-\left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\right)} + \left(a \cdot 27\right) \cdot b \]
      2. distribute-lft-neg-in90.4%

        \[\leadsto \left(x \cdot 2 + \color{blue}{\left(-\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) + \left(a \cdot 27\right) \cdot b \]
      3. associate-*l*92.3%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{y \cdot \left(9 \cdot z\right)}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      4. *-commutative92.3%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(9 \cdot z\right) \cdot y}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      5. *-commutative92.3%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(z \cdot 9\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      6. cancel-sign-sub-inv92.3%

        \[\leadsto \color{blue}{\left(x \cdot 2 - \left(\left(z \cdot 9\right) \cdot y\right) \cdot t\right)} + \left(a \cdot 27\right) \cdot b \]
      7. *-commutative92.3%

        \[\leadsto \left(x \cdot 2 - \left(\color{blue}{\left(9 \cdot z\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      8. *-commutative92.3%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot \left(9 \cdot z\right)\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      9. associate-*l*90.4%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      10. associate-*l*92.4%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot 9\right) \cdot \left(z \cdot t\right)}\right) + \left(a \cdot 27\right) \cdot b \]
      11. associate-*l*94.2%

        \[\leadsto \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + \color{blue}{a \cdot \left(27 \cdot b\right)} \]
    3. Simplified94.2%

      \[\leadsto \color{blue}{\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)} \]
    4. Taylor expanded in a around inf 53.7%

      \[\leadsto \color{blue}{27 \cdot \left(a \cdot b\right)} \]

    if -7.5e-158 < x < -3e-242 or 3.25e-229 < x < 3e-152

    1. Initial program 97.4%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. sub-neg97.4%

        \[\leadsto \color{blue}{\left(x \cdot 2 + \left(-\left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\right)} + \left(a \cdot 27\right) \cdot b \]
      2. distribute-lft-neg-in97.4%

        \[\leadsto \left(x \cdot 2 + \color{blue}{\left(-\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) + \left(a \cdot 27\right) \cdot b \]
      3. associate-*l*97.2%

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

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

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(z \cdot 9\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      6. cancel-sign-sub-inv97.2%

        \[\leadsto \color{blue}{\left(x \cdot 2 - \left(\left(z \cdot 9\right) \cdot y\right) \cdot t\right)} + \left(a \cdot 27\right) \cdot b \]
      7. *-commutative97.2%

        \[\leadsto \left(x \cdot 2 - \left(\color{blue}{\left(9 \cdot z\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      8. *-commutative97.2%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot \left(9 \cdot z\right)\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      9. associate-*l*97.4%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      10. associate-*l*97.2%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot 9\right) \cdot \left(z \cdot t\right)}\right) + \left(a \cdot 27\right) \cdot b \]
      11. associate-*l*97.2%

        \[\leadsto \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + \color{blue}{a \cdot \left(27 \cdot b\right)} \]
    3. Simplified97.2%

      \[\leadsto \color{blue}{\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)} \]
    4. Taylor expanded in y around inf 63.0%

      \[\leadsto \color{blue}{-9 \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]

    if -3e-242 < x < 3.25e-229 or 3e-152 < x < 1.7000000000000001e-36

    1. Initial program 97.9%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. sub-neg97.9%

        \[\leadsto \color{blue}{\left(x \cdot 2 + \left(-\left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\right)} + \left(a \cdot 27\right) \cdot b \]
      2. distribute-lft-neg-in97.9%

        \[\leadsto \left(x \cdot 2 + \color{blue}{\left(-\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) + \left(a \cdot 27\right) \cdot b \]
      3. associate-*l*97.9%

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

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

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(z \cdot 9\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      6. cancel-sign-sub-inv97.9%

        \[\leadsto \color{blue}{\left(x \cdot 2 - \left(\left(z \cdot 9\right) \cdot y\right) \cdot t\right)} + \left(a \cdot 27\right) \cdot b \]
      7. *-commutative97.9%

        \[\leadsto \left(x \cdot 2 - \left(\color{blue}{\left(9 \cdot z\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      8. *-commutative97.9%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot \left(9 \cdot z\right)\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      9. associate-*l*97.9%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      10. associate-*l*92.6%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot 9\right) \cdot \left(z \cdot t\right)}\right) + \left(a \cdot 27\right) \cdot b \]
      11. associate-*l*92.5%

        \[\leadsto \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + \color{blue}{a \cdot \left(27 \cdot b\right)} \]
    3. Simplified92.5%

      \[\leadsto \color{blue}{\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)} \]
    4. Step-by-step derivation
      1. associate-+l-92.5%

        \[\leadsto \color{blue}{x \cdot 2 - \left(\left(y \cdot 9\right) \cdot \left(z \cdot t\right) - a \cdot \left(27 \cdot b\right)\right)} \]
      2. associate-*r*97.8%

        \[\leadsto x \cdot 2 - \left(\color{blue}{\left(\left(y \cdot 9\right) \cdot z\right) \cdot t} - a \cdot \left(27 \cdot b\right)\right) \]
      3. associate-*r*97.9%

        \[\leadsto x \cdot 2 - \left(\left(\left(y \cdot 9\right) \cdot z\right) \cdot t - \color{blue}{\left(a \cdot 27\right) \cdot b}\right) \]
      4. associate-*r*92.6%

        \[\leadsto x \cdot 2 - \left(\color{blue}{\left(y \cdot 9\right) \cdot \left(z \cdot t\right)} - \left(a \cdot 27\right) \cdot b\right) \]
      5. associate-*l*92.7%

        \[\leadsto x \cdot 2 - \left(\color{blue}{y \cdot \left(9 \cdot \left(z \cdot t\right)\right)} - \left(a \cdot 27\right) \cdot b\right) \]
      6. *-commutative92.7%

        \[\leadsto x \cdot 2 - \left(y \cdot \left(9 \cdot \left(z \cdot t\right)\right) - \color{blue}{b \cdot \left(a \cdot 27\right)}\right) \]
    5. Applied egg-rr92.7%

      \[\leadsto \color{blue}{x \cdot 2 - \left(y \cdot \left(9 \cdot \left(z \cdot t\right)\right) - b \cdot \left(a \cdot 27\right)\right)} \]
    6. Taylor expanded in y around 0 69.7%

      \[\leadsto x \cdot 2 - \color{blue}{-27 \cdot \left(a \cdot b\right)} \]
    7. Taylor expanded in x around 0 63.5%

      \[\leadsto \color{blue}{27 \cdot \left(a \cdot b\right)} \]
    8. Step-by-step derivation
      1. associate-*r*63.6%

        \[\leadsto \color{blue}{\left(27 \cdot a\right) \cdot b} \]
      2. *-commutative63.6%

        \[\leadsto \color{blue}{\left(a \cdot 27\right)} \cdot b \]
      3. associate-*l*63.6%

        \[\leadsto \color{blue}{a \cdot \left(27 \cdot b\right)} \]
      4. *-commutative63.6%

        \[\leadsto a \cdot \color{blue}{\left(b \cdot 27\right)} \]
    9. Simplified63.6%

      \[\leadsto \color{blue}{a \cdot \left(b \cdot 27\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification58.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.4 \cdot 10^{+95}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;x \leq -7.5 \cdot 10^{-158}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;x \leq -3 \cdot 10^{-242}:\\ \;\;\;\;-9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\ \mathbf{elif}\;x \leq 3.25 \cdot 10^{-229}:\\ \;\;\;\;a \cdot \left(27 \cdot b\right)\\ \mathbf{elif}\;x \leq 3 \cdot 10^{-152}:\\ \;\;\;\;-9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\ \mathbf{elif}\;x \leq 1.7 \cdot 10^{-36}:\\ \;\;\;\;a \cdot \left(27 \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2\\ \end{array} \]

Alternative 6: 47.5% accurate, 1.0× speedup?

\[\begin{array}{l} [y, z, t] = \mathsf{sort}([y, z, t])\\ \\ \begin{array}{l} t_1 := a \cdot \left(27 \cdot b\right)\\ t_2 := t \cdot \left(y \cdot \left(z \cdot -9\right)\right)\\ \mathbf{if}\;x \leq -8.8 \cdot 10^{+91}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;x \leq -7.2 \cdot 10^{-158}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;x \leq -1.5 \cdot 10^{-242}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 2.65 \cdot 10^{-229}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 3.5 \cdot 10^{-151}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 2.4 \cdot 10^{-36}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2\\ \end{array} \end{array} \]
NOTE: y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* a (* 27.0 b))) (t_2 (* t (* y (* z -9.0)))))
   (if (<= x -8.8e+91)
     (* x 2.0)
     (if (<= x -7.2e-158)
       (* 27.0 (* a b))
       (if (<= x -1.5e-242)
         t_2
         (if (<= x 2.65e-229)
           t_1
           (if (<= x 3.5e-151) t_2 (if (<= x 2.4e-36) t_1 (* x 2.0)))))))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = a * (27.0 * b);
	double t_2 = t * (y * (z * -9.0));
	double tmp;
	if (x <= -8.8e+91) {
		tmp = x * 2.0;
	} else if (x <= -7.2e-158) {
		tmp = 27.0 * (a * b);
	} else if (x <= -1.5e-242) {
		tmp = t_2;
	} else if (x <= 2.65e-229) {
		tmp = t_1;
	} else if (x <= 3.5e-151) {
		tmp = t_2;
	} else if (x <= 2.4e-36) {
		tmp = t_1;
	} else {
		tmp = x * 2.0;
	}
	return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = a * (27.0d0 * b)
    t_2 = t * (y * (z * (-9.0d0)))
    if (x <= (-8.8d+91)) then
        tmp = x * 2.0d0
    else if (x <= (-7.2d-158)) then
        tmp = 27.0d0 * (a * b)
    else if (x <= (-1.5d-242)) then
        tmp = t_2
    else if (x <= 2.65d-229) then
        tmp = t_1
    else if (x <= 3.5d-151) then
        tmp = t_2
    else if (x <= 2.4d-36) then
        tmp = t_1
    else
        tmp = x * 2.0d0
    end if
    code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = a * (27.0 * b);
	double t_2 = t * (y * (z * -9.0));
	double tmp;
	if (x <= -8.8e+91) {
		tmp = x * 2.0;
	} else if (x <= -7.2e-158) {
		tmp = 27.0 * (a * b);
	} else if (x <= -1.5e-242) {
		tmp = t_2;
	} else if (x <= 2.65e-229) {
		tmp = t_1;
	} else if (x <= 3.5e-151) {
		tmp = t_2;
	} else if (x <= 2.4e-36) {
		tmp = t_1;
	} else {
		tmp = x * 2.0;
	}
	return tmp;
}
[y, z, t] = sort([y, z, t])
def code(x, y, z, t, a, b):
	t_1 = a * (27.0 * b)
	t_2 = t * (y * (z * -9.0))
	tmp = 0
	if x <= -8.8e+91:
		tmp = x * 2.0
	elif x <= -7.2e-158:
		tmp = 27.0 * (a * b)
	elif x <= -1.5e-242:
		tmp = t_2
	elif x <= 2.65e-229:
		tmp = t_1
	elif x <= 3.5e-151:
		tmp = t_2
	elif x <= 2.4e-36:
		tmp = t_1
	else:
		tmp = x * 2.0
	return tmp
y, z, t = sort([y, z, t])
function code(x, y, z, t, a, b)
	t_1 = Float64(a * Float64(27.0 * b))
	t_2 = Float64(t * Float64(y * Float64(z * -9.0)))
	tmp = 0.0
	if (x <= -8.8e+91)
		tmp = Float64(x * 2.0);
	elseif (x <= -7.2e-158)
		tmp = Float64(27.0 * Float64(a * b));
	elseif (x <= -1.5e-242)
		tmp = t_2;
	elseif (x <= 2.65e-229)
		tmp = t_1;
	elseif (x <= 3.5e-151)
		tmp = t_2;
	elseif (x <= 2.4e-36)
		tmp = t_1;
	else
		tmp = Float64(x * 2.0);
	end
	return tmp
end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = a * (27.0 * b);
	t_2 = t * (y * (z * -9.0));
	tmp = 0.0;
	if (x <= -8.8e+91)
		tmp = x * 2.0;
	elseif (x <= -7.2e-158)
		tmp = 27.0 * (a * b);
	elseif (x <= -1.5e-242)
		tmp = t_2;
	elseif (x <= 2.65e-229)
		tmp = t_1;
	elseif (x <= 3.5e-151)
		tmp = t_2;
	elseif (x <= 2.4e-36)
		tmp = t_1;
	else
		tmp = x * 2.0;
	end
	tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t * N[(y * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -8.8e+91], N[(x * 2.0), $MachinePrecision], If[LessEqual[x, -7.2e-158], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.5e-242], t$95$2, If[LessEqual[x, 2.65e-229], t$95$1, If[LessEqual[x, 3.5e-151], t$95$2, If[LessEqual[x, 2.4e-36], t$95$1, N[(x * 2.0), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
t_1 := a \cdot \left(27 \cdot b\right)\\
t_2 := t \cdot \left(y \cdot \left(z \cdot -9\right)\right)\\
\mathbf{if}\;x \leq -8.8 \cdot 10^{+91}:\\
\;\;\;\;x \cdot 2\\

\mathbf{elif}\;x \leq -7.2 \cdot 10^{-158}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\

\mathbf{elif}\;x \leq -1.5 \cdot 10^{-242}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \leq 2.65 \cdot 10^{-229}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 3.5 \cdot 10^{-151}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \leq 2.4 \cdot 10^{-36}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -8.79999999999999998e91 or 2.4e-36 < x

    1. Initial program 95.6%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. sub-neg95.6%

        \[\leadsto \color{blue}{\left(x \cdot 2 + \left(-\left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\right)} + \left(a \cdot 27\right) \cdot b \]
      2. distribute-lft-neg-in95.6%

        \[\leadsto \left(x \cdot 2 + \color{blue}{\left(-\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) + \left(a \cdot 27\right) \cdot b \]
      3. associate-*l*95.6%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{y \cdot \left(9 \cdot z\right)}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      4. *-commutative95.6%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(9 \cdot z\right) \cdot y}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      5. *-commutative95.6%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(z \cdot 9\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      6. cancel-sign-sub-inv95.6%

        \[\leadsto \color{blue}{\left(x \cdot 2 - \left(\left(z \cdot 9\right) \cdot y\right) \cdot t\right)} + \left(a \cdot 27\right) \cdot b \]
      7. *-commutative95.6%

        \[\leadsto \left(x \cdot 2 - \left(\color{blue}{\left(9 \cdot z\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      8. *-commutative95.6%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot \left(9 \cdot z\right)\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      9. associate-*l*95.6%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      10. associate-*l*94.8%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot 9\right) \cdot \left(z \cdot t\right)}\right) + \left(a \cdot 27\right) \cdot b \]
      11. associate-*l*94.8%

        \[\leadsto \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + \color{blue}{a \cdot \left(27 \cdot b\right)} \]
    3. Simplified94.8%

      \[\leadsto \color{blue}{\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)} \]
    4. Taylor expanded in x around inf 57.7%

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

    if -8.79999999999999998e91 < x < -7.19999999999999982e-158

    1. Initial program 90.4%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. sub-neg90.4%

        \[\leadsto \color{blue}{\left(x \cdot 2 + \left(-\left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\right)} + \left(a \cdot 27\right) \cdot b \]
      2. distribute-lft-neg-in90.4%

        \[\leadsto \left(x \cdot 2 + \color{blue}{\left(-\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) + \left(a \cdot 27\right) \cdot b \]
      3. associate-*l*92.3%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{y \cdot \left(9 \cdot z\right)}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      4. *-commutative92.3%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(9 \cdot z\right) \cdot y}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      5. *-commutative92.3%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(z \cdot 9\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      6. cancel-sign-sub-inv92.3%

        \[\leadsto \color{blue}{\left(x \cdot 2 - \left(\left(z \cdot 9\right) \cdot y\right) \cdot t\right)} + \left(a \cdot 27\right) \cdot b \]
      7. *-commutative92.3%

        \[\leadsto \left(x \cdot 2 - \left(\color{blue}{\left(9 \cdot z\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      8. *-commutative92.3%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot \left(9 \cdot z\right)\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      9. associate-*l*90.4%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      10. associate-*l*92.4%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot 9\right) \cdot \left(z \cdot t\right)}\right) + \left(a \cdot 27\right) \cdot b \]
      11. associate-*l*94.2%

        \[\leadsto \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + \color{blue}{a \cdot \left(27 \cdot b\right)} \]
    3. Simplified94.2%

      \[\leadsto \color{blue}{\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)} \]
    4. Taylor expanded in a around inf 53.7%

      \[\leadsto \color{blue}{27 \cdot \left(a \cdot b\right)} \]

    if -7.19999999999999982e-158 < x < -1.5e-242 or 2.64999999999999999e-229 < x < 3.49999999999999995e-151

    1. Initial program 97.4%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. sub-neg97.4%

        \[\leadsto \color{blue}{\left(x \cdot 2 + \left(-\left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\right)} + \left(a \cdot 27\right) \cdot b \]
      2. distribute-lft-neg-in97.4%

        \[\leadsto \left(x \cdot 2 + \color{blue}{\left(-\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) + \left(a \cdot 27\right) \cdot b \]
      3. associate-*l*97.2%

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

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

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(z \cdot 9\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      6. cancel-sign-sub-inv97.2%

        \[\leadsto \color{blue}{\left(x \cdot 2 - \left(\left(z \cdot 9\right) \cdot y\right) \cdot t\right)} + \left(a \cdot 27\right) \cdot b \]
      7. *-commutative97.2%

        \[\leadsto \left(x \cdot 2 - \left(\color{blue}{\left(9 \cdot z\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      8. *-commutative97.2%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot \left(9 \cdot z\right)\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      9. associate-*l*97.4%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      10. associate-*l*97.2%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot 9\right) \cdot \left(z \cdot t\right)}\right) + \left(a \cdot 27\right) \cdot b \]
      11. associate-*l*97.2%

        \[\leadsto \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + \color{blue}{a \cdot \left(27 \cdot b\right)} \]
    3. Simplified97.2%

      \[\leadsto \color{blue}{\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)} \]
    4. Taylor expanded in y around inf 63.0%

      \[\leadsto \color{blue}{-9 \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
    5. Step-by-step derivation
      1. *-commutative63.0%

        \[\leadsto \color{blue}{\left(t \cdot \left(y \cdot z\right)\right) \cdot -9} \]
      2. associate-*l*62.9%

        \[\leadsto \color{blue}{t \cdot \left(\left(y \cdot z\right) \cdot -9\right)} \]
    6. Simplified62.9%

      \[\leadsto \color{blue}{t \cdot \left(\left(y \cdot z\right) \cdot -9\right)} \]
    7. Taylor expanded in t around 0 63.0%

      \[\leadsto \color{blue}{-9 \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
    8. Step-by-step derivation
      1. *-commutative63.0%

        \[\leadsto \color{blue}{\left(t \cdot \left(y \cdot z\right)\right) \cdot -9} \]
      2. associate-*l*62.9%

        \[\leadsto \color{blue}{t \cdot \left(\left(y \cdot z\right) \cdot -9\right)} \]
      3. associate-*r*62.9%

        \[\leadsto t \cdot \color{blue}{\left(y \cdot \left(z \cdot -9\right)\right)} \]
    9. Simplified62.9%

      \[\leadsto \color{blue}{t \cdot \left(y \cdot \left(z \cdot -9\right)\right)} \]

    if -1.5e-242 < x < 2.64999999999999999e-229 or 3.49999999999999995e-151 < x < 2.4e-36

    1. Initial program 97.9%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. sub-neg97.9%

        \[\leadsto \color{blue}{\left(x \cdot 2 + \left(-\left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\right)} + \left(a \cdot 27\right) \cdot b \]
      2. distribute-lft-neg-in97.9%

        \[\leadsto \left(x \cdot 2 + \color{blue}{\left(-\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) + \left(a \cdot 27\right) \cdot b \]
      3. associate-*l*97.9%

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

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

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(z \cdot 9\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      6. cancel-sign-sub-inv97.9%

        \[\leadsto \color{blue}{\left(x \cdot 2 - \left(\left(z \cdot 9\right) \cdot y\right) \cdot t\right)} + \left(a \cdot 27\right) \cdot b \]
      7. *-commutative97.9%

        \[\leadsto \left(x \cdot 2 - \left(\color{blue}{\left(9 \cdot z\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      8. *-commutative97.9%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot \left(9 \cdot z\right)\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      9. associate-*l*97.9%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      10. associate-*l*92.6%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot 9\right) \cdot \left(z \cdot t\right)}\right) + \left(a \cdot 27\right) \cdot b \]
      11. associate-*l*92.5%

        \[\leadsto \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + \color{blue}{a \cdot \left(27 \cdot b\right)} \]
    3. Simplified92.5%

      \[\leadsto \color{blue}{\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)} \]
    4. Step-by-step derivation
      1. associate-+l-92.5%

        \[\leadsto \color{blue}{x \cdot 2 - \left(\left(y \cdot 9\right) \cdot \left(z \cdot t\right) - a \cdot \left(27 \cdot b\right)\right)} \]
      2. associate-*r*97.8%

        \[\leadsto x \cdot 2 - \left(\color{blue}{\left(\left(y \cdot 9\right) \cdot z\right) \cdot t} - a \cdot \left(27 \cdot b\right)\right) \]
      3. associate-*r*97.9%

        \[\leadsto x \cdot 2 - \left(\left(\left(y \cdot 9\right) \cdot z\right) \cdot t - \color{blue}{\left(a \cdot 27\right) \cdot b}\right) \]
      4. associate-*r*92.6%

        \[\leadsto x \cdot 2 - \left(\color{blue}{\left(y \cdot 9\right) \cdot \left(z \cdot t\right)} - \left(a \cdot 27\right) \cdot b\right) \]
      5. associate-*l*92.7%

        \[\leadsto x \cdot 2 - \left(\color{blue}{y \cdot \left(9 \cdot \left(z \cdot t\right)\right)} - \left(a \cdot 27\right) \cdot b\right) \]
      6. *-commutative92.7%

        \[\leadsto x \cdot 2 - \left(y \cdot \left(9 \cdot \left(z \cdot t\right)\right) - \color{blue}{b \cdot \left(a \cdot 27\right)}\right) \]
    5. Applied egg-rr92.7%

      \[\leadsto \color{blue}{x \cdot 2 - \left(y \cdot \left(9 \cdot \left(z \cdot t\right)\right) - b \cdot \left(a \cdot 27\right)\right)} \]
    6. Taylor expanded in y around 0 69.7%

      \[\leadsto x \cdot 2 - \color{blue}{-27 \cdot \left(a \cdot b\right)} \]
    7. Taylor expanded in x around 0 63.5%

      \[\leadsto \color{blue}{27 \cdot \left(a \cdot b\right)} \]
    8. Step-by-step derivation
      1. associate-*r*63.6%

        \[\leadsto \color{blue}{\left(27 \cdot a\right) \cdot b} \]
      2. *-commutative63.6%

        \[\leadsto \color{blue}{\left(a \cdot 27\right)} \cdot b \]
      3. associate-*l*63.6%

        \[\leadsto \color{blue}{a \cdot \left(27 \cdot b\right)} \]
      4. *-commutative63.6%

        \[\leadsto a \cdot \color{blue}{\left(b \cdot 27\right)} \]
    9. Simplified63.6%

      \[\leadsto \color{blue}{a \cdot \left(b \cdot 27\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification58.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -8.8 \cdot 10^{+91}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;x \leq -7.2 \cdot 10^{-158}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;x \leq -1.5 \cdot 10^{-242}:\\ \;\;\;\;t \cdot \left(y \cdot \left(z \cdot -9\right)\right)\\ \mathbf{elif}\;x \leq 2.65 \cdot 10^{-229}:\\ \;\;\;\;a \cdot \left(27 \cdot b\right)\\ \mathbf{elif}\;x \leq 3.5 \cdot 10^{-151}:\\ \;\;\;\;t \cdot \left(y \cdot \left(z \cdot -9\right)\right)\\ \mathbf{elif}\;x \leq 2.4 \cdot 10^{-36}:\\ \;\;\;\;a \cdot \left(27 \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2\\ \end{array} \]

Alternative 7: 75.5% accurate, 1.3× speedup?

\[\begin{array}{l} [y, z, t] = \mathsf{sort}([y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;t \leq 3.9 \cdot 10^{+133}:\\ \;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2 - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\ \end{array} \end{array} \]
NOTE: y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
 :precision binary64
 (if (<= t 3.9e+133)
   (+ (* x 2.0) (* 27.0 (* a b)))
   (- (* x 2.0) (* 9.0 (* t (* z y))))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (t <= 3.9e+133) {
		tmp = (x * 2.0) + (27.0 * (a * b));
	} else {
		tmp = (x * 2.0) - (9.0 * (t * (z * y)));
	}
	return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (t <= 3.9d+133) then
        tmp = (x * 2.0d0) + (27.0d0 * (a * b))
    else
        tmp = (x * 2.0d0) - (9.0d0 * (t * (z * y)))
    end if
    code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (t <= 3.9e+133) {
		tmp = (x * 2.0) + (27.0 * (a * b));
	} else {
		tmp = (x * 2.0) - (9.0 * (t * (z * y)));
	}
	return tmp;
}
[y, z, t] = sort([y, z, t])
def code(x, y, z, t, a, b):
	tmp = 0
	if t <= 3.9e+133:
		tmp = (x * 2.0) + (27.0 * (a * b))
	else:
		tmp = (x * 2.0) - (9.0 * (t * (z * y)))
	return tmp
y, z, t = sort([y, z, t])
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (t <= 3.9e+133)
		tmp = Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b)));
	else
		tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(t * Float64(z * y))));
	end
	return tmp
end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (t <= 3.9e+133)
		tmp = (x * 2.0) + (27.0 * (a * b));
	else
		tmp = (x * 2.0) - (9.0 * (t * (z * y)));
	end
	tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, 3.9e+133], N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 3.9 \cdot 10^{+133}:\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\

\mathbf{else}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 3.90000000000000014e133

    1. Initial program 95.0%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. sub-neg95.0%

        \[\leadsto \color{blue}{\left(x \cdot 2 + \left(-\left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\right)} + \left(a \cdot 27\right) \cdot b \]
      2. distribute-lft-neg-in95.0%

        \[\leadsto \left(x \cdot 2 + \color{blue}{\left(-\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) + \left(a \cdot 27\right) \cdot b \]
      3. associate-*l*95.4%

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

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(9 \cdot z\right) \cdot y}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      5. *-commutative95.4%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(z \cdot 9\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      6. cancel-sign-sub-inv95.4%

        \[\leadsto \color{blue}{\left(x \cdot 2 - \left(\left(z \cdot 9\right) \cdot y\right) \cdot t\right)} + \left(a \cdot 27\right) \cdot b \]
      7. *-commutative95.4%

        \[\leadsto \left(x \cdot 2 - \left(\color{blue}{\left(9 \cdot z\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      8. *-commutative95.4%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot \left(9 \cdot z\right)\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      9. associate-*l*95.0%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      10. associate-*l*95.0%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot 9\right) \cdot \left(z \cdot t\right)}\right) + \left(a \cdot 27\right) \cdot b \]
      11. associate-*l*95.5%

        \[\leadsto \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + \color{blue}{a \cdot \left(27 \cdot b\right)} \]
    3. Simplified95.5%

      \[\leadsto \color{blue}{\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)} \]
    4. Taylor expanded in y around 0 69.6%

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

    if 3.90000000000000014e133 < t

    1. Initial program 96.9%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. sub-neg96.9%

        \[\leadsto \color{blue}{\left(x \cdot 2 + \left(-\left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\right)} + \left(a \cdot 27\right) \cdot b \]
      2. distribute-lft-neg-in96.9%

        \[\leadsto \left(x \cdot 2 + \color{blue}{\left(-\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) + \left(a \cdot 27\right) \cdot b \]
      3. associate-*l*97.0%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{y \cdot \left(9 \cdot z\right)}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      4. *-commutative97.0%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(9 \cdot z\right) \cdot y}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      5. *-commutative97.0%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(z \cdot 9\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      6. cancel-sign-sub-inv97.0%

        \[\leadsto \color{blue}{\left(x \cdot 2 - \left(\left(z \cdot 9\right) \cdot y\right) \cdot t\right)} + \left(a \cdot 27\right) \cdot b \]
      7. *-commutative97.0%

        \[\leadsto \left(x \cdot 2 - \left(\color{blue}{\left(9 \cdot z\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      8. *-commutative97.0%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot \left(9 \cdot z\right)\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      9. associate-*l*96.9%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      10. associate-*l*88.8%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot 9\right) \cdot \left(z \cdot t\right)}\right) + \left(a \cdot 27\right) \cdot b \]
      11. associate-*l*88.7%

        \[\leadsto \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + \color{blue}{a \cdot \left(27 \cdot b\right)} \]
    3. Simplified88.7%

      \[\leadsto \color{blue}{\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)} \]
    4. Taylor expanded in a around 0 83.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 3.9 \cdot 10^{+133}:\\ \;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2 - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\ \end{array} \]

Alternative 8: 70.1% accurate, 1.5× speedup?

\[\begin{array}{l} [y, z, t] = \mathsf{sort}([y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;t \leq 5 \cdot 10^{+164}:\\ \;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(-9 \cdot \left(z \cdot y\right)\right)\\ \end{array} \end{array} \]
NOTE: y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
 :precision binary64
 (if (<= t 5e+164) (+ (* x 2.0) (* 27.0 (* a b))) (* t (* -9.0 (* z y)))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (t <= 5e+164) {
		tmp = (x * 2.0) + (27.0 * (a * b));
	} else {
		tmp = t * (-9.0 * (z * y));
	}
	return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (t <= 5d+164) then
        tmp = (x * 2.0d0) + (27.0d0 * (a * b))
    else
        tmp = t * ((-9.0d0) * (z * y))
    end if
    code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (t <= 5e+164) {
		tmp = (x * 2.0) + (27.0 * (a * b));
	} else {
		tmp = t * (-9.0 * (z * y));
	}
	return tmp;
}
[y, z, t] = sort([y, z, t])
def code(x, y, z, t, a, b):
	tmp = 0
	if t <= 5e+164:
		tmp = (x * 2.0) + (27.0 * (a * b))
	else:
		tmp = t * (-9.0 * (z * y))
	return tmp
y, z, t = sort([y, z, t])
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (t <= 5e+164)
		tmp = Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b)));
	else
		tmp = Float64(t * Float64(-9.0 * Float64(z * y)));
	end
	return tmp
end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (t <= 5e+164)
		tmp = (x * 2.0) + (27.0 * (a * b));
	else
		tmp = t * (-9.0 * (z * y));
	end
	tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, 5e+164], N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(-9.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 5 \cdot 10^{+164}:\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\

\mathbf{else}:\\
\;\;\;\;t \cdot \left(-9 \cdot \left(z \cdot y\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 4.9999999999999995e164

    1. Initial program 95.0%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. sub-neg95.0%

        \[\leadsto \color{blue}{\left(x \cdot 2 + \left(-\left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\right)} + \left(a \cdot 27\right) \cdot b \]
      2. distribute-lft-neg-in95.0%

        \[\leadsto \left(x \cdot 2 + \color{blue}{\left(-\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) + \left(a \cdot 27\right) \cdot b \]
      3. associate-*l*95.5%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{y \cdot \left(9 \cdot z\right)}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      4. *-commutative95.5%

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

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(z \cdot 9\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      6. cancel-sign-sub-inv95.5%

        \[\leadsto \color{blue}{\left(x \cdot 2 - \left(\left(z \cdot 9\right) \cdot y\right) \cdot t\right)} + \left(a \cdot 27\right) \cdot b \]
      7. *-commutative95.5%

        \[\leadsto \left(x \cdot 2 - \left(\color{blue}{\left(9 \cdot z\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      8. *-commutative95.5%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot \left(9 \cdot z\right)\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      9. associate-*l*95.0%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      10. associate-*l*94.2%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot 9\right) \cdot \left(z \cdot t\right)}\right) + \left(a \cdot 27\right) \cdot b \]
      11. associate-*l*94.7%

        \[\leadsto \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + \color{blue}{a \cdot \left(27 \cdot b\right)} \]
    3. Simplified94.7%

      \[\leadsto \color{blue}{\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)} \]
    4. Taylor expanded in y around 0 69.4%

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

    if 4.9999999999999995e164 < t

    1. Initial program 96.8%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. sub-neg96.8%

        \[\leadsto \color{blue}{\left(x \cdot 2 + \left(-\left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\right)} + \left(a \cdot 27\right) \cdot b \]
      2. distribute-lft-neg-in96.8%

        \[\leadsto \left(x \cdot 2 + \color{blue}{\left(-\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) + \left(a \cdot 27\right) \cdot b \]
      3. associate-*l*96.8%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{y \cdot \left(9 \cdot z\right)}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      4. *-commutative96.8%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(9 \cdot z\right) \cdot y}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      5. *-commutative96.8%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(z \cdot 9\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      6. cancel-sign-sub-inv96.8%

        \[\leadsto \color{blue}{\left(x \cdot 2 - \left(\left(z \cdot 9\right) \cdot y\right) \cdot t\right)} + \left(a \cdot 27\right) \cdot b \]
      7. *-commutative96.8%

        \[\leadsto \left(x \cdot 2 - \left(\color{blue}{\left(9 \cdot z\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      8. *-commutative96.8%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot \left(9 \cdot z\right)\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      9. associate-*l*96.8%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      10. associate-*l*93.9%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot 9\right) \cdot \left(z \cdot t\right)}\right) + \left(a \cdot 27\right) \cdot b \]
      11. associate-*l*93.9%

        \[\leadsto \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + \color{blue}{a \cdot \left(27 \cdot b\right)} \]
    3. Simplified93.9%

      \[\leadsto \color{blue}{\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)} \]
    4. Taylor expanded in y around inf 57.6%

      \[\leadsto \color{blue}{-9 \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
    5. Step-by-step derivation
      1. *-commutative57.6%

        \[\leadsto \color{blue}{\left(t \cdot \left(y \cdot z\right)\right) \cdot -9} \]
      2. associate-*l*57.6%

        \[\leadsto \color{blue}{t \cdot \left(\left(y \cdot z\right) \cdot -9\right)} \]
    6. Simplified57.6%

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

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

Alternative 9: 47.4% accurate, 1.9× speedup?

\[\begin{array}{l} [y, z, t] = \mathsf{sort}([y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -3.1 \cdot 10^{+91}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;x \leq 2.4 \cdot 10^{-36}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2\\ \end{array} \end{array} \]
NOTE: y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
 :precision binary64
 (if (<= x -3.1e+91) (* x 2.0) (if (<= x 2.4e-36) (* 27.0 (* a b)) (* x 2.0))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (x <= -3.1e+91) {
		tmp = x * 2.0;
	} else if (x <= 2.4e-36) {
		tmp = 27.0 * (a * b);
	} else {
		tmp = x * 2.0;
	}
	return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (x <= (-3.1d+91)) then
        tmp = x * 2.0d0
    else if (x <= 2.4d-36) then
        tmp = 27.0d0 * (a * b)
    else
        tmp = x * 2.0d0
    end if
    code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (x <= -3.1e+91) {
		tmp = x * 2.0;
	} else if (x <= 2.4e-36) {
		tmp = 27.0 * (a * b);
	} else {
		tmp = x * 2.0;
	}
	return tmp;
}
[y, z, t] = sort([y, z, t])
def code(x, y, z, t, a, b):
	tmp = 0
	if x <= -3.1e+91:
		tmp = x * 2.0
	elif x <= 2.4e-36:
		tmp = 27.0 * (a * b)
	else:
		tmp = x * 2.0
	return tmp
y, z, t = sort([y, z, t])
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (x <= -3.1e+91)
		tmp = Float64(x * 2.0);
	elseif (x <= 2.4e-36)
		tmp = Float64(27.0 * Float64(a * b));
	else
		tmp = Float64(x * 2.0);
	end
	return tmp
end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (x <= -3.1e+91)
		tmp = x * 2.0;
	elseif (x <= 2.4e-36)
		tmp = 27.0 * (a * b);
	else
		tmp = x * 2.0;
	end
	tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -3.1e+91], N[(x * 2.0), $MachinePrecision], If[LessEqual[x, 2.4e-36], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], N[(x * 2.0), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.1 \cdot 10^{+91}:\\
\;\;\;\;x \cdot 2\\

\mathbf{elif}\;x \leq 2.4 \cdot 10^{-36}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.09999999999999998e91 or 2.4e-36 < x

    1. Initial program 95.6%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. sub-neg95.6%

        \[\leadsto \color{blue}{\left(x \cdot 2 + \left(-\left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\right)} + \left(a \cdot 27\right) \cdot b \]
      2. distribute-lft-neg-in95.6%

        \[\leadsto \left(x \cdot 2 + \color{blue}{\left(-\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) + \left(a \cdot 27\right) \cdot b \]
      3. associate-*l*95.6%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{y \cdot \left(9 \cdot z\right)}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      4. *-commutative95.6%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(9 \cdot z\right) \cdot y}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      5. *-commutative95.6%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(z \cdot 9\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      6. cancel-sign-sub-inv95.6%

        \[\leadsto \color{blue}{\left(x \cdot 2 - \left(\left(z \cdot 9\right) \cdot y\right) \cdot t\right)} + \left(a \cdot 27\right) \cdot b \]
      7. *-commutative95.6%

        \[\leadsto \left(x \cdot 2 - \left(\color{blue}{\left(9 \cdot z\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      8. *-commutative95.6%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot \left(9 \cdot z\right)\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      9. associate-*l*95.6%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      10. associate-*l*94.8%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot 9\right) \cdot \left(z \cdot t\right)}\right) + \left(a \cdot 27\right) \cdot b \]
      11. associate-*l*94.8%

        \[\leadsto \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + \color{blue}{a \cdot \left(27 \cdot b\right)} \]
    3. Simplified94.8%

      \[\leadsto \color{blue}{\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)} \]
    4. Taylor expanded in x around inf 57.7%

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

    if -3.09999999999999998e91 < x < 2.4e-36

    1. Initial program 95.0%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. sub-neg95.0%

        \[\leadsto \color{blue}{\left(x \cdot 2 + \left(-\left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\right)} + \left(a \cdot 27\right) \cdot b \]
      2. distribute-lft-neg-in95.0%

        \[\leadsto \left(x \cdot 2 + \color{blue}{\left(-\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) + \left(a \cdot 27\right) \cdot b \]
      3. associate-*l*95.7%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{y \cdot \left(9 \cdot z\right)}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      4. *-commutative95.7%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(9 \cdot z\right) \cdot y}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      5. *-commutative95.7%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(z \cdot 9\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      6. cancel-sign-sub-inv95.7%

        \[\leadsto \color{blue}{\left(x \cdot 2 - \left(\left(z \cdot 9\right) \cdot y\right) \cdot t\right)} + \left(a \cdot 27\right) \cdot b \]
      7. *-commutative95.7%

        \[\leadsto \left(x \cdot 2 - \left(\color{blue}{\left(9 \cdot z\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      8. *-commutative95.7%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot \left(9 \cdot z\right)\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      9. associate-*l*95.0%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      10. associate-*l*93.8%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot 9\right) \cdot \left(z \cdot t\right)}\right) + \left(a \cdot 27\right) \cdot b \]
      11. associate-*l*94.4%

        \[\leadsto \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + \color{blue}{a \cdot \left(27 \cdot b\right)} \]
    3. Simplified94.4%

      \[\leadsto \color{blue}{\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)} \]
    4. Taylor expanded in a around inf 51.0%

      \[\leadsto \color{blue}{27 \cdot \left(a \cdot b\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification53.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.1 \cdot 10^{+91}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;x \leq 2.4 \cdot 10^{-36}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2\\ \end{array} \]

Alternative 10: 47.3% accurate, 1.9× speedup?

\[\begin{array}{l} [y, z, t] = \mathsf{sort}([y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -2.1 \cdot 10^{+91}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;x \leq 2.4 \cdot 10^{-36}:\\ \;\;\;\;a \cdot \left(27 \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2\\ \end{array} \end{array} \]
NOTE: y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
 :precision binary64
 (if (<= x -2.1e+91) (* x 2.0) (if (<= x 2.4e-36) (* a (* 27.0 b)) (* x 2.0))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (x <= -2.1e+91) {
		tmp = x * 2.0;
	} else if (x <= 2.4e-36) {
		tmp = a * (27.0 * b);
	} else {
		tmp = x * 2.0;
	}
	return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (x <= (-2.1d+91)) then
        tmp = x * 2.0d0
    else if (x <= 2.4d-36) then
        tmp = a * (27.0d0 * b)
    else
        tmp = x * 2.0d0
    end if
    code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (x <= -2.1e+91) {
		tmp = x * 2.0;
	} else if (x <= 2.4e-36) {
		tmp = a * (27.0 * b);
	} else {
		tmp = x * 2.0;
	}
	return tmp;
}
[y, z, t] = sort([y, z, t])
def code(x, y, z, t, a, b):
	tmp = 0
	if x <= -2.1e+91:
		tmp = x * 2.0
	elif x <= 2.4e-36:
		tmp = a * (27.0 * b)
	else:
		tmp = x * 2.0
	return tmp
y, z, t = sort([y, z, t])
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (x <= -2.1e+91)
		tmp = Float64(x * 2.0);
	elseif (x <= 2.4e-36)
		tmp = Float64(a * Float64(27.0 * b));
	else
		tmp = Float64(x * 2.0);
	end
	return tmp
end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (x <= -2.1e+91)
		tmp = x * 2.0;
	elseif (x <= 2.4e-36)
		tmp = a * (27.0 * b);
	else
		tmp = x * 2.0;
	end
	tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -2.1e+91], N[(x * 2.0), $MachinePrecision], If[LessEqual[x, 2.4e-36], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision], N[(x * 2.0), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{+91}:\\
\;\;\;\;x \cdot 2\\

\mathbf{elif}\;x \leq 2.4 \cdot 10^{-36}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.10000000000000008e91 or 2.4e-36 < x

    1. Initial program 95.6%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. sub-neg95.6%

        \[\leadsto \color{blue}{\left(x \cdot 2 + \left(-\left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\right)} + \left(a \cdot 27\right) \cdot b \]
      2. distribute-lft-neg-in95.6%

        \[\leadsto \left(x \cdot 2 + \color{blue}{\left(-\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) + \left(a \cdot 27\right) \cdot b \]
      3. associate-*l*95.6%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{y \cdot \left(9 \cdot z\right)}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      4. *-commutative95.6%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(9 \cdot z\right) \cdot y}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      5. *-commutative95.6%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(z \cdot 9\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      6. cancel-sign-sub-inv95.6%

        \[\leadsto \color{blue}{\left(x \cdot 2 - \left(\left(z \cdot 9\right) \cdot y\right) \cdot t\right)} + \left(a \cdot 27\right) \cdot b \]
      7. *-commutative95.6%

        \[\leadsto \left(x \cdot 2 - \left(\color{blue}{\left(9 \cdot z\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      8. *-commutative95.6%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot \left(9 \cdot z\right)\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      9. associate-*l*95.6%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      10. associate-*l*94.8%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot 9\right) \cdot \left(z \cdot t\right)}\right) + \left(a \cdot 27\right) \cdot b \]
      11. associate-*l*94.8%

        \[\leadsto \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + \color{blue}{a \cdot \left(27 \cdot b\right)} \]
    3. Simplified94.8%

      \[\leadsto \color{blue}{\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)} \]
    4. Taylor expanded in x around inf 57.7%

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

    if -2.10000000000000008e91 < x < 2.4e-36

    1. Initial program 95.0%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. sub-neg95.0%

        \[\leadsto \color{blue}{\left(x \cdot 2 + \left(-\left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\right)} + \left(a \cdot 27\right) \cdot b \]
      2. distribute-lft-neg-in95.0%

        \[\leadsto \left(x \cdot 2 + \color{blue}{\left(-\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) + \left(a \cdot 27\right) \cdot b \]
      3. associate-*l*95.7%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{y \cdot \left(9 \cdot z\right)}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      4. *-commutative95.7%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(9 \cdot z\right) \cdot y}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      5. *-commutative95.7%

        \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(z \cdot 9\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      6. cancel-sign-sub-inv95.7%

        \[\leadsto \color{blue}{\left(x \cdot 2 - \left(\left(z \cdot 9\right) \cdot y\right) \cdot t\right)} + \left(a \cdot 27\right) \cdot b \]
      7. *-commutative95.7%

        \[\leadsto \left(x \cdot 2 - \left(\color{blue}{\left(9 \cdot z\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      8. *-commutative95.7%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot \left(9 \cdot z\right)\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      9. associate-*l*95.0%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      10. associate-*l*93.8%

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot 9\right) \cdot \left(z \cdot t\right)}\right) + \left(a \cdot 27\right) \cdot b \]
      11. associate-*l*94.4%

        \[\leadsto \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + \color{blue}{a \cdot \left(27 \cdot b\right)} \]
    3. Simplified94.4%

      \[\leadsto \color{blue}{\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)} \]
    4. Step-by-step derivation
      1. associate-+l-94.4%

        \[\leadsto \color{blue}{x \cdot 2 - \left(\left(y \cdot 9\right) \cdot \left(z \cdot t\right) - a \cdot \left(27 \cdot b\right)\right)} \]
      2. associate-*r*95.7%

        \[\leadsto x \cdot 2 - \left(\color{blue}{\left(\left(y \cdot 9\right) \cdot z\right) \cdot t} - a \cdot \left(27 \cdot b\right)\right) \]
      3. associate-*r*95.0%

        \[\leadsto x \cdot 2 - \left(\left(\left(y \cdot 9\right) \cdot z\right) \cdot t - \color{blue}{\left(a \cdot 27\right) \cdot b}\right) \]
      4. associate-*r*93.8%

        \[\leadsto x \cdot 2 - \left(\color{blue}{\left(y \cdot 9\right) \cdot \left(z \cdot t\right)} - \left(a \cdot 27\right) \cdot b\right) \]
      5. associate-*l*94.5%

        \[\leadsto x \cdot 2 - \left(\color{blue}{y \cdot \left(9 \cdot \left(z \cdot t\right)\right)} - \left(a \cdot 27\right) \cdot b\right) \]
      6. *-commutative94.5%

        \[\leadsto x \cdot 2 - \left(y \cdot \left(9 \cdot \left(z \cdot t\right)\right) - \color{blue}{b \cdot \left(a \cdot 27\right)}\right) \]
    5. Applied egg-rr94.5%

      \[\leadsto \color{blue}{x \cdot 2 - \left(y \cdot \left(9 \cdot \left(z \cdot t\right)\right) - b \cdot \left(a \cdot 27\right)\right)} \]
    6. Taylor expanded in y around 0 60.0%

      \[\leadsto x \cdot 2 - \color{blue}{-27 \cdot \left(a \cdot b\right)} \]
    7. Taylor expanded in x around 0 51.0%

      \[\leadsto \color{blue}{27 \cdot \left(a \cdot b\right)} \]
    8. Step-by-step derivation
      1. associate-*r*50.3%

        \[\leadsto \color{blue}{\left(27 \cdot a\right) \cdot b} \]
      2. *-commutative50.3%

        \[\leadsto \color{blue}{\left(a \cdot 27\right)} \cdot b \]
      3. associate-*l*51.0%

        \[\leadsto \color{blue}{a \cdot \left(27 \cdot b\right)} \]
      4. *-commutative51.0%

        \[\leadsto a \cdot \color{blue}{\left(b \cdot 27\right)} \]
    9. Simplified51.0%

      \[\leadsto \color{blue}{a \cdot \left(b \cdot 27\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification53.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.1 \cdot 10^{+91}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;x \leq 2.4 \cdot 10^{-36}:\\ \;\;\;\;a \cdot \left(27 \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2\\ \end{array} \]

Alternative 11: 31.0% accurate, 5.7× speedup?

\[\begin{array}{l} [y, z, t] = \mathsf{sort}([y, z, t])\\ \\ x \cdot 2 \end{array} \]
NOTE: y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a b) :precision binary64 (* x 2.0))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
	return x * 2.0;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = x * 2.0d0
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
	return x * 2.0;
}
[y, z, t] = sort([y, z, t])
def code(x, y, z, t, a, b):
	return x * 2.0
y, z, t = sort([y, z, t])
function code(x, y, z, t, a, b)
	return Float64(x * 2.0)
end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp = code(x, y, z, t, a, b)
	tmp = x * 2.0;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := N[(x * 2.0), $MachinePrecision]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
x \cdot 2
\end{array}
Derivation
  1. Initial program 95.3%

    \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
  2. Step-by-step derivation
    1. sub-neg95.3%

      \[\leadsto \color{blue}{\left(x \cdot 2 + \left(-\left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\right)} + \left(a \cdot 27\right) \cdot b \]
    2. distribute-lft-neg-in95.3%

      \[\leadsto \left(x \cdot 2 + \color{blue}{\left(-\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) + \left(a \cdot 27\right) \cdot b \]
    3. associate-*l*95.6%

      \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{y \cdot \left(9 \cdot z\right)}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    4. *-commutative95.6%

      \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(9 \cdot z\right) \cdot y}\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    5. *-commutative95.6%

      \[\leadsto \left(x \cdot 2 + \left(-\color{blue}{\left(z \cdot 9\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    6. cancel-sign-sub-inv95.6%

      \[\leadsto \color{blue}{\left(x \cdot 2 - \left(\left(z \cdot 9\right) \cdot y\right) \cdot t\right)} + \left(a \cdot 27\right) \cdot b \]
    7. *-commutative95.6%

      \[\leadsto \left(x \cdot 2 - \left(\color{blue}{\left(9 \cdot z\right)} \cdot y\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    8. *-commutative95.6%

      \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot \left(9 \cdot z\right)\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    9. associate-*l*95.3%

      \[\leadsto \left(x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    10. associate-*l*94.2%

      \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot 9\right) \cdot \left(z \cdot t\right)}\right) + \left(a \cdot 27\right) \cdot b \]
    11. associate-*l*94.6%

      \[\leadsto \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + \color{blue}{a \cdot \left(27 \cdot b\right)} \]
  3. Simplified94.6%

    \[\leadsto \color{blue}{\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)} \]
  4. Taylor expanded in x around inf 31.4%

    \[\leadsto \color{blue}{2 \cdot x} \]
  5. Final simplification31.4%

    \[\leadsto x \cdot 2 \]

Developer target: 95.1% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y < 7.590524218811189 \cdot 10^{-161}:\\ \;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot 2 - 9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right) + \left(a \cdot 27\right) \cdot b\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (< y 7.590524218811189e-161)
   (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* a (* 27.0 b)))
   (+ (- (* x 2.0) (* 9.0 (* y (* t z)))) (* (* a 27.0) b))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (y < 7.590524218811189e-161) {
		tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b));
	} else {
		tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b);
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (y < 7.590524218811189d-161) then
        tmp = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + (a * (27.0d0 * b))
    else
        tmp = ((x * 2.0d0) - (9.0d0 * (y * (t * z)))) + ((a * 27.0d0) * b)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (y < 7.590524218811189e-161) {
		tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b));
	} else {
		tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b);
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if y < 7.590524218811189e-161:
		tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b))
	else:
		tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b)
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (y < 7.590524218811189e-161)
		tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(a * Float64(27.0 * b)));
	else
		tmp = Float64(Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(t * z)))) + Float64(Float64(a * 27.0) * b));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (y < 7.590524218811189e-161)
		tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b));
	else
		tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[Less[y, 7.590524218811189e-161], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y < 7.590524218811189 \cdot 10^{-161}:\\
\;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\

\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - 9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right) + \left(a \cdot 27\right) \cdot b\\


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023279 
(FPCore (x y z t a b)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, A"
  :precision binary64

  :herbie-target
  (if (< y 7.590524218811189e-161) (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* a (* 27.0 b))) (+ (- (* x 2.0) (* 9.0 (* y (* t z)))) (* (* a 27.0) b)))

  (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))