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

Percentage Accurate: 95.3% → 98.9%
Time: 12.7s
Alternatives: 14
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 14 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.3% 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.9% accurate, 0.1× speedup?

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

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


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

    1. Initial program 93.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. +-commutative93.9%

        \[\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-*l*94.4%

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

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

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

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

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

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

    if 3.0000000000000001e-12 < z

    1. Initial program 89.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. associate-+l-89.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x, 2, \mathsf{fma}\left(t, -\color{blue}{\left(z \cdot y\right) \cdot 9}, \left(a \cdot 27\right) \cdot b\right)\right) \]
      11. distribute-rgt-neg-in90.7%

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(t, \left(y \cdot z\right) \cdot -9, \left(a \cdot 27\right) \cdot b\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification94.7%

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

Alternative 2: 98.7% accurate, 0.1× speedup?

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

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


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

    1. Initial program 93.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. +-commutative93.9%

        \[\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-*l*94.4%

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

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

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

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

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

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

    if 9.9999999999999998e-13 < z

    1. Initial program 89.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. associate-+l-89.1%

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

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

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

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

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

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

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

        \[\leadsto x \cdot 2 - \color{blue}{\left(\left(\left(y \cdot 9\right) \cdot z\right) \cdot t - \left(a \cdot 27\right) \cdot b\right)} \]
      9. associate-*l*87.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) \]
      10. associate-*l*87.8%

        \[\leadsto x \cdot 2 - \left(\left(y \cdot 9\right) \cdot \left(z \cdot t\right) - \color{blue}{a \cdot \left(27 \cdot b\right)}\right) \]
    3. Simplified87.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)} \]
    4. Step-by-step derivation
      1. sub-neg87.8%

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

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

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

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

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

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

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

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

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

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

Alternative 3: 97.5% accurate, 0.7× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 y 9) z) < 5.0000000000000003e275

    1. Initial program 95.8%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]

    if 5.0000000000000003e275 < (*.f64 (*.f64 y 9) z)

    1. Initial program 49.7%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Taylor expanded in x around 0 82.6%

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

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

Alternative 4: 97.5% accurate, 0.7× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 y 9) z) < 5.0000000000000003e275

    1. Initial program 95.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. associate-+l-95.8%

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

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

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

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

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

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

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

        \[\leadsto x \cdot 2 - \color{blue}{\left(\left(\left(y \cdot 9\right) \cdot z\right) \cdot t - \left(a \cdot 27\right) \cdot b\right)} \]
      9. associate-*l*93.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) \]
      10. associate-*l*93.6%

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

      \[\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)} \]
    4. Step-by-step derivation
      1. sub-neg93.6%

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

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

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

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

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

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

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

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

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

    if 5.0000000000000003e275 < (*.f64 (*.f64 y 9) z)

    1. Initial program 49.7%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Taylor expanded in x around 0 82.6%

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

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

Alternative 5: 98.3% accurate, 0.9× speedup?

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

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


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

    1. Initial program 94.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. associate-+l-94.0%

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

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

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

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

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

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

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

        \[\leadsto x \cdot 2 - \color{blue}{\left(\left(\left(y \cdot 9\right) \cdot z\right) \cdot t - \left(a \cdot 27\right) \cdot b\right)} \]
      9. associate-*l*95.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) \]
      10. associate-*l*95.5%

        \[\leadsto x \cdot 2 - \left(\left(y \cdot 9\right) \cdot \left(z \cdot t\right) - \color{blue}{a \cdot \left(27 \cdot b\right)}\right) \]
    3. Simplified95.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)} \]

    if 4.00000000000000019e-4 < z

    1. Initial program 88.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. associate-+l-88.9%

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

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

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

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

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

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

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

        \[\leadsto x \cdot 2 - \color{blue}{\left(\left(\left(y \cdot 9\right) \cdot z\right) \cdot t - \left(a \cdot 27\right) \cdot b\right)} \]
      9. associate-*l*87.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) \]
      10. associate-*l*87.6%

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

      \[\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)} \]
    4. Step-by-step derivation
      1. sub-neg87.6%

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

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

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

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

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

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

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

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

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

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

Alternative 6: 47.6% accurate, 1.0× speedup?

\[\begin{array}{l} [y, z, t] = \mathsf{sort}([y, z, t])\\ [a, b] = \mathsf{sort}([a, b])\\ \\ \begin{array}{l} t_1 := -9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\ \mathbf{if}\;b \leq -1.08 \cdot 10^{+18}:\\ \;\;\;\;a \cdot \left(27 \cdot b\right)\\ \mathbf{elif}\;b \leq 9 \cdot 10^{-290}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;b \leq 1.75 \cdot 10^{-255}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \leq 1.35 \cdot 10^{-227}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;b \leq 2.5 \cdot 10^{-171}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \leq 100000:\\ \;\;\;\;x \cdot 2\\ \mathbf{else}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \end{array} \end{array} \]
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* -9.0 (* y (* z t)))))
   (if (<= b -1.08e+18)
     (* a (* 27.0 b))
     (if (<= b 9e-290)
       (* x 2.0)
       (if (<= b 1.75e-255)
         t_1
         (if (<= b 1.35e-227)
           (* x 2.0)
           (if (<= b 2.5e-171)
             t_1
             (if (<= b 100000.0) (* x 2.0) (* 27.0 (* a b))))))))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = -9.0 * (y * (z * t));
	double tmp;
	if (b <= -1.08e+18) {
		tmp = a * (27.0 * b);
	} else if (b <= 9e-290) {
		tmp = x * 2.0;
	} else if (b <= 1.75e-255) {
		tmp = t_1;
	} else if (b <= 1.35e-227) {
		tmp = x * 2.0;
	} else if (b <= 2.5e-171) {
		tmp = t_1;
	} else if (b <= 100000.0) {
		tmp = x * 2.0;
	} else {
		tmp = 27.0 * (a * b);
	}
	return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b 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) :: tmp
    t_1 = (-9.0d0) * (y * (z * t))
    if (b <= (-1.08d+18)) then
        tmp = a * (27.0d0 * b)
    else if (b <= 9d-290) then
        tmp = x * 2.0d0
    else if (b <= 1.75d-255) then
        tmp = t_1
    else if (b <= 1.35d-227) then
        tmp = x * 2.0d0
    else if (b <= 2.5d-171) then
        tmp = t_1
    else if (b <= 100000.0d0) then
        tmp = x * 2.0d0
    else
        tmp = 27.0d0 * (a * b)
    end if
    code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = -9.0 * (y * (z * t));
	double tmp;
	if (b <= -1.08e+18) {
		tmp = a * (27.0 * b);
	} else if (b <= 9e-290) {
		tmp = x * 2.0;
	} else if (b <= 1.75e-255) {
		tmp = t_1;
	} else if (b <= 1.35e-227) {
		tmp = x * 2.0;
	} else if (b <= 2.5e-171) {
		tmp = t_1;
	} else if (b <= 100000.0) {
		tmp = x * 2.0;
	} else {
		tmp = 27.0 * (a * b);
	}
	return tmp;
}
[y, z, t] = sort([y, z, t])
[a, b] = sort([a, b])
def code(x, y, z, t, a, b):
	t_1 = -9.0 * (y * (z * t))
	tmp = 0
	if b <= -1.08e+18:
		tmp = a * (27.0 * b)
	elif b <= 9e-290:
		tmp = x * 2.0
	elif b <= 1.75e-255:
		tmp = t_1
	elif b <= 1.35e-227:
		tmp = x * 2.0
	elif b <= 2.5e-171:
		tmp = t_1
	elif b <= 100000.0:
		tmp = x * 2.0
	else:
		tmp = 27.0 * (a * b)
	return tmp
y, z, t = sort([y, z, t])
a, b = sort([a, b])
function code(x, y, z, t, a, b)
	t_1 = Float64(-9.0 * Float64(y * Float64(z * t)))
	tmp = 0.0
	if (b <= -1.08e+18)
		tmp = Float64(a * Float64(27.0 * b));
	elseif (b <= 9e-290)
		tmp = Float64(x * 2.0);
	elseif (b <= 1.75e-255)
		tmp = t_1;
	elseif (b <= 1.35e-227)
		tmp = Float64(x * 2.0);
	elseif (b <= 2.5e-171)
		tmp = t_1;
	elseif (b <= 100000.0)
		tmp = Float64(x * 2.0);
	else
		tmp = Float64(27.0 * Float64(a * b));
	end
	return tmp
end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = -9.0 * (y * (z * t));
	tmp = 0.0;
	if (b <= -1.08e+18)
		tmp = a * (27.0 * b);
	elseif (b <= 9e-290)
		tmp = x * 2.0;
	elseif (b <= 1.75e-255)
		tmp = t_1;
	elseif (b <= 1.35e-227)
		tmp = x * 2.0;
	elseif (b <= 2.5e-171)
		tmp = t_1;
	elseif (b <= 100000.0)
		tmp = x * 2.0;
	else
		tmp = 27.0 * (a * b);
	end
	tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b 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[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.08e+18], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 9e-290], N[(x * 2.0), $MachinePrecision], If[LessEqual[b, 1.75e-255], t$95$1, If[LessEqual[b, 1.35e-227], N[(x * 2.0), $MachinePrecision], If[LessEqual[b, 2.5e-171], t$95$1, If[LessEqual[b, 100000.0], N[(x * 2.0), $MachinePrecision], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := -9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{if}\;b \leq -1.08 \cdot 10^{+18}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\

\mathbf{elif}\;b \leq 9 \cdot 10^{-290}:\\
\;\;\;\;x \cdot 2\\

\mathbf{elif}\;b \leq 1.75 \cdot 10^{-255}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;b \leq 1.35 \cdot 10^{-227}:\\
\;\;\;\;x \cdot 2\\

\mathbf{elif}\;b \leq 2.5 \cdot 10^{-171}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;b \leq 100000:\\
\;\;\;\;x \cdot 2\\

\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b < -1.08e18

    1. Initial program 92.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. associate-+l-92.8%

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

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

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

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

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

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

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

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

        \[\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) \]
      10. associate-*l*86.5%

        \[\leadsto x \cdot 2 - \left(\left(y \cdot 9\right) \cdot \left(z \cdot t\right) - \color{blue}{a \cdot \left(27 \cdot b\right)}\right) \]
    3. Simplified86.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)} \]
    4. Taylor expanded in y around 0 67.9%

      \[\leadsto x \cdot 2 - \color{blue}{-27 \cdot \left(a \cdot b\right)} \]
    5. Step-by-step derivation
      1. *-commutative67.9%

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

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

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

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

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

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

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

    if -1.08e18 < b < 9e-290 or 1.74999999999999989e-255 < b < 1.35e-227 or 2.49999999999999996e-171 < b < 1e5

    1. Initial program 93.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. Taylor expanded in x around inf 55.6%

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

    if 9e-290 < b < 1.74999999999999989e-255 or 1.35e-227 < b < 2.49999999999999996e-171

    1. Initial program 89.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. Taylor expanded in y around inf 59.9%

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

    if 1e5 < b

    1. Initial program 91.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. associate-+l-91.8%

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

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

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

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

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

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

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

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

        \[\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) \]
      10. associate-*l*98.1%

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

      \[\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)} \]
    4. Taylor expanded in y around 0 71.6%

      \[\leadsto x \cdot 2 - \color{blue}{-27 \cdot \left(a \cdot b\right)} \]
    5. Step-by-step derivation
      1. *-commutative71.6%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.08 \cdot 10^{+18}:\\ \;\;\;\;a \cdot \left(27 \cdot b\right)\\ \mathbf{elif}\;b \leq 9 \cdot 10^{-290}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;b \leq 1.75 \cdot 10^{-255}:\\ \;\;\;\;-9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\ \mathbf{elif}\;b \leq 1.35 \cdot 10^{-227}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;b \leq 2.5 \cdot 10^{-171}:\\ \;\;\;\;-9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\ \mathbf{elif}\;b \leq 100000:\\ \;\;\;\;x \cdot 2\\ \mathbf{else}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \end{array} \]

Alternative 7: 79.9% accurate, 1.1× speedup?

\[\begin{array}{l} [y, z, t] = \mathsf{sort}([y, z, t])\\ [a, b] = \mathsf{sort}([a, b])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -3 \cdot 10^{-37} \lor \neg \left(z \leq 6.3 \cdot 10^{-62}\right):\\ \;\;\;\;x \cdot 2 + z \cdot \left(-9 \cdot \left(y \cdot t\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\ \end{array} \end{array} \]
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
 :precision binary64
 (if (or (<= z -3e-37) (not (<= z 6.3e-62)))
   (+ (* x 2.0) (* z (* -9.0 (* y t))))
   (- (* x 2.0) (* a (* b -27.0)))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((z <= -3e-37) || !(z <= 6.3e-62)) {
		tmp = (x * 2.0) + (z * (-9.0 * (y * t)));
	} else {
		tmp = (x * 2.0) - (a * (b * -27.0));
	}
	return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b 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 <= (-3d-37)) .or. (.not. (z <= 6.3d-62))) then
        tmp = (x * 2.0d0) + (z * ((-9.0d0) * (y * t)))
    else
        tmp = (x * 2.0d0) - (a * (b * (-27.0d0)))
    end if
    code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((z <= -3e-37) || !(z <= 6.3e-62)) {
		tmp = (x * 2.0) + (z * (-9.0 * (y * t)));
	} else {
		tmp = (x * 2.0) - (a * (b * -27.0));
	}
	return tmp;
}
[y, z, t] = sort([y, z, t])
[a, b] = sort([a, b])
def code(x, y, z, t, a, b):
	tmp = 0
	if (z <= -3e-37) or not (z <= 6.3e-62):
		tmp = (x * 2.0) + (z * (-9.0 * (y * t)))
	else:
		tmp = (x * 2.0) - (a * (b * -27.0))
	return tmp
y, z, t = sort([y, z, t])
a, b = sort([a, b])
function code(x, y, z, t, a, b)
	tmp = 0.0
	if ((z <= -3e-37) || !(z <= 6.3e-62))
		tmp = Float64(Float64(x * 2.0) + Float64(z * Float64(-9.0 * Float64(y * t))));
	else
		tmp = Float64(Float64(x * 2.0) - Float64(a * Float64(b * -27.0)));
	end
	return tmp
end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if ((z <= -3e-37) || ~((z <= 6.3e-62)))
		tmp = (x * 2.0) + (z * (-9.0 * (y * t)));
	else
		tmp = (x * 2.0) - (a * (b * -27.0));
	end
	tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -3e-37], N[Not[LessEqual[z, 6.3e-62]], $MachinePrecision]], N[(N[(x * 2.0), $MachinePrecision] + N[(z * N[(-9.0 * N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] - N[(a * N[(b * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3 \cdot 10^{-37} \lor \neg \left(z \leq 6.3 \cdot 10^{-62}\right):\\
\;\;\;\;x \cdot 2 + z \cdot \left(-9 \cdot \left(y \cdot t\right)\right)\\

\mathbf{else}:\\
\;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3e-37 or 6.2999999999999997e-62 < z

    1. Initial program 87.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. associate-+l-87.5%

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

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

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

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

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

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

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

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

        \[\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) \]
      10. associate-*l*89.7%

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

      \[\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)} \]
    4. Step-by-step derivation
      1. sub-neg89.7%

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

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

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

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

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

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

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

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

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

      \[\leadsto x \cdot 2 - \color{blue}{9 \cdot \left(y \cdot \left(t \cdot z\right)\right)} \]
    7. Step-by-step derivation
      1. add-sqr-sqrt41.2%

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

        \[\leadsto x \cdot 2 - \color{blue}{\sqrt{\left(9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right) \cdot \left(9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right)}} \]
      3. swap-sqr47.2%

        \[\leadsto x \cdot 2 - \sqrt{\color{blue}{\left(9 \cdot 9\right) \cdot \left(\left(y \cdot \left(t \cdot z\right)\right) \cdot \left(y \cdot \left(t \cdot z\right)\right)\right)}} \]
      4. metadata-eval47.2%

        \[\leadsto x \cdot 2 - \sqrt{\color{blue}{81} \cdot \left(\left(y \cdot \left(t \cdot z\right)\right) \cdot \left(y \cdot \left(t \cdot z\right)\right)\right)} \]
      5. metadata-eval47.2%

        \[\leadsto x \cdot 2 - \sqrt{\color{blue}{\left(-9 \cdot -9\right)} \cdot \left(\left(y \cdot \left(t \cdot z\right)\right) \cdot \left(y \cdot \left(t \cdot z\right)\right)\right)} \]
      6. swap-sqr47.2%

        \[\leadsto x \cdot 2 - \sqrt{\color{blue}{\left(-9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right) \cdot \left(-9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right)}} \]
      7. *-commutative47.2%

        \[\leadsto x \cdot 2 - \sqrt{\color{blue}{\left(\left(y \cdot \left(t \cdot z\right)\right) \cdot -9\right)} \cdot \left(-9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right)} \]
      8. *-commutative47.2%

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

        \[\leadsto x \cdot 2 - \sqrt{\left(\color{blue}{\left(\left(y \cdot t\right) \cdot z\right)} \cdot -9\right) \cdot \left(\left(y \cdot \left(t \cdot z\right)\right) \cdot -9\right)} \]
      10. associate-*r*47.2%

        \[\leadsto x \cdot 2 - \sqrt{\color{blue}{\left(\left(y \cdot t\right) \cdot \left(z \cdot -9\right)\right)} \cdot \left(\left(y \cdot \left(t \cdot z\right)\right) \cdot -9\right)} \]
      11. associate-*r*47.9%

        \[\leadsto x \cdot 2 - \sqrt{\left(\left(y \cdot t\right) \cdot \left(z \cdot -9\right)\right) \cdot \left(\color{blue}{\left(\left(y \cdot t\right) \cdot z\right)} \cdot -9\right)} \]
      12. associate-*r*47.9%

        \[\leadsto x \cdot 2 - \sqrt{\left(\left(y \cdot t\right) \cdot \left(z \cdot -9\right)\right) \cdot \color{blue}{\left(\left(y \cdot t\right) \cdot \left(z \cdot -9\right)\right)}} \]
      13. sqrt-unprod17.0%

        \[\leadsto x \cdot 2 - \color{blue}{\sqrt{\left(y \cdot t\right) \cdot \left(z \cdot -9\right)} \cdot \sqrt{\left(y \cdot t\right) \cdot \left(z \cdot -9\right)}} \]
      14. add-sqr-sqrt29.1%

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

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

        \[\leadsto x \cdot 2 - \color{blue}{\left(y \cdot \left(t \cdot z\right)\right)} \cdot -9 \]
      17. metadata-eval28.4%

        \[\leadsto x \cdot 2 - \left(y \cdot \left(t \cdot z\right)\right) \cdot \color{blue}{\left(-9\right)} \]
      18. distribute-rgt-neg-in28.4%

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

        \[\leadsto x \cdot 2 - \left(-\color{blue}{9 \cdot \left(y \cdot \left(t \cdot z\right)\right)}\right) \]
      20. add-log-exp23.2%

        \[\leadsto x \cdot 2 - \left(-\color{blue}{\log \left(e^{9 \cdot \left(y \cdot \left(t \cdot z\right)\right)}\right)}\right) \]
    8. Applied egg-rr39.6%

      \[\leadsto x \cdot 2 - \color{blue}{\log \left(\frac{1}{{\left({\left(e^{z}\right)}^{-9}\right)}^{\left(y \cdot t\right)}}\right)} \]
    9. Step-by-step derivation
      1. log-rec39.6%

        \[\leadsto x \cdot 2 - \color{blue}{\left(-\log \left({\left({\left(e^{z}\right)}^{-9}\right)}^{\left(y \cdot t\right)}\right)\right)} \]
      2. log-pow32.7%

        \[\leadsto x \cdot 2 - \left(-\color{blue}{\left(y \cdot t\right) \cdot \log \left({\left(e^{z}\right)}^{-9}\right)}\right) \]
      3. distribute-rgt-neg-in32.7%

        \[\leadsto x \cdot 2 - \color{blue}{\left(y \cdot t\right) \cdot \left(-\log \left({\left(e^{z}\right)}^{-9}\right)\right)} \]
      4. log-pow32.7%

        \[\leadsto x \cdot 2 - \left(y \cdot t\right) \cdot \left(-\color{blue}{-9 \cdot \log \left(e^{z}\right)}\right) \]
      5. rem-log-exp76.5%

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

      \[\leadsto x \cdot 2 - \color{blue}{\left(y \cdot t\right) \cdot \left(--9 \cdot z\right)} \]
    11. Step-by-step derivation
      1. sub-neg76.5%

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

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

        \[\leadsto \left(-\color{blue}{\left(-\left(y \cdot t\right) \cdot \left(-9 \cdot z\right)\right)}\right) + x \cdot 2 \]
      4. remove-double-neg76.5%

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

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

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

    if -3e-37 < z < 6.2999999999999997e-62

    1. Initial program 99.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. associate-+l-99.8%

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

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

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

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

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

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

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

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

        \[\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) \]
      10. associate-*l*98.9%

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

      \[\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)} \]
    4. Taylor expanded in y around 0 80.0%

      \[\leadsto x \cdot 2 - \color{blue}{-27 \cdot \left(a \cdot b\right)} \]
    5. Step-by-step derivation
      1. *-commutative80.0%

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

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

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

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

Alternative 8: 79.9% accurate, 1.1× speedup?

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

\mathbf{elif}\;z \leq 3.7 \cdot 10^{-62}:\\
\;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.32e-34

    1. Initial program 84.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. Taylor expanded in a around 0 69.6%

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

    if -1.32e-34 < z < 3.6999999999999998e-62

    1. Initial program 99.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. associate-+l-99.8%

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

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

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

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

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

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

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

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

        \[\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) \]
      10. associate-*l*98.9%

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

      \[\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)} \]
    4. Taylor expanded in y around 0 80.2%

      \[\leadsto x \cdot 2 - \color{blue}{-27 \cdot \left(a \cdot b\right)} \]
    5. Step-by-step derivation
      1. *-commutative80.2%

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

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

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

    if 3.6999999999999998e-62 < z

    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. associate-+l-90.4%

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

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

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

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

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

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

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

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

        \[\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) \]
      10. associate-*l*89.3%

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

      \[\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)} \]
    4. Step-by-step derivation
      1. sub-neg89.3%

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

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

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

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

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

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

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

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

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

      \[\leadsto x \cdot 2 - \color{blue}{9 \cdot \left(y \cdot \left(t \cdot z\right)\right)} \]
    7. Step-by-step derivation
      1. add-sqr-sqrt45.3%

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

        \[\leadsto x \cdot 2 - \color{blue}{\sqrt{\left(9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right) \cdot \left(9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right)}} \]
      3. swap-sqr48.8%

        \[\leadsto x \cdot 2 - \sqrt{\color{blue}{\left(9 \cdot 9\right) \cdot \left(\left(y \cdot \left(t \cdot z\right)\right) \cdot \left(y \cdot \left(t \cdot z\right)\right)\right)}} \]
      4. metadata-eval48.8%

        \[\leadsto x \cdot 2 - \sqrt{\color{blue}{81} \cdot \left(\left(y \cdot \left(t \cdot z\right)\right) \cdot \left(y \cdot \left(t \cdot z\right)\right)\right)} \]
      5. metadata-eval48.8%

        \[\leadsto x \cdot 2 - \sqrt{\color{blue}{\left(-9 \cdot -9\right)} \cdot \left(\left(y \cdot \left(t \cdot z\right)\right) \cdot \left(y \cdot \left(t \cdot z\right)\right)\right)} \]
      6. swap-sqr48.8%

        \[\leadsto x \cdot 2 - \sqrt{\color{blue}{\left(-9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right) \cdot \left(-9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right)}} \]
      7. *-commutative48.8%

        \[\leadsto x \cdot 2 - \sqrt{\color{blue}{\left(\left(y \cdot \left(t \cdot z\right)\right) \cdot -9\right)} \cdot \left(-9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right)} \]
      8. *-commutative48.8%

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

        \[\leadsto x \cdot 2 - \sqrt{\left(\color{blue}{\left(\left(y \cdot t\right) \cdot z\right)} \cdot -9\right) \cdot \left(\left(y \cdot \left(t \cdot z\right)\right) \cdot -9\right)} \]
      10. associate-*r*48.8%

        \[\leadsto x \cdot 2 - \sqrt{\color{blue}{\left(\left(y \cdot t\right) \cdot \left(z \cdot -9\right)\right)} \cdot \left(\left(y \cdot \left(t \cdot z\right)\right) \cdot -9\right)} \]
      11. associate-*r*50.1%

        \[\leadsto x \cdot 2 - \sqrt{\left(\left(y \cdot t\right) \cdot \left(z \cdot -9\right)\right) \cdot \left(\color{blue}{\left(\left(y \cdot t\right) \cdot z\right)} \cdot -9\right)} \]
      12. associate-*r*50.1%

        \[\leadsto x \cdot 2 - \sqrt{\left(\left(y \cdot t\right) \cdot \left(z \cdot -9\right)\right) \cdot \color{blue}{\left(\left(y \cdot t\right) \cdot \left(z \cdot -9\right)\right)}} \]
      13. sqrt-unprod14.6%

        \[\leadsto x \cdot 2 - \color{blue}{\sqrt{\left(y \cdot t\right) \cdot \left(z \cdot -9\right)} \cdot \sqrt{\left(y \cdot t\right) \cdot \left(z \cdot -9\right)}} \]
      14. add-sqr-sqrt26.2%

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

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

        \[\leadsto x \cdot 2 - \color{blue}{\left(y \cdot \left(t \cdot z\right)\right)} \cdot -9 \]
      17. metadata-eval26.0%

        \[\leadsto x \cdot 2 - \left(y \cdot \left(t \cdot z\right)\right) \cdot \color{blue}{\left(-9\right)} \]
      18. distribute-rgt-neg-in26.0%

        \[\leadsto x \cdot 2 - \color{blue}{\left(-\left(y \cdot \left(t \cdot z\right)\right) \cdot 9\right)} \]
      19. *-commutative26.0%

        \[\leadsto x \cdot 2 - \left(-\color{blue}{9 \cdot \left(y \cdot \left(t \cdot z\right)\right)}\right) \]
      20. add-log-exp18.7%

        \[\leadsto x \cdot 2 - \left(-\color{blue}{\log \left(e^{9 \cdot \left(y \cdot \left(t \cdot z\right)\right)}\right)}\right) \]
    8. Applied egg-rr41.4%

      \[\leadsto x \cdot 2 - \color{blue}{\log \left(\frac{1}{{\left({\left(e^{z}\right)}^{-9}\right)}^{\left(y \cdot t\right)}}\right)} \]
    9. Step-by-step derivation
      1. log-rec41.4%

        \[\leadsto x \cdot 2 - \color{blue}{\left(-\log \left({\left({\left(e^{z}\right)}^{-9}\right)}^{\left(y \cdot t\right)}\right)\right)} \]
      2. log-pow35.7%

        \[\leadsto x \cdot 2 - \left(-\color{blue}{\left(y \cdot t\right) \cdot \log \left({\left(e^{z}\right)}^{-9}\right)}\right) \]
      3. distribute-rgt-neg-in35.7%

        \[\leadsto x \cdot 2 - \color{blue}{\left(y \cdot t\right) \cdot \left(-\log \left({\left(e^{z}\right)}^{-9}\right)\right)} \]
      4. log-pow35.7%

        \[\leadsto x \cdot 2 - \left(y \cdot t\right) \cdot \left(-\color{blue}{-9 \cdot \log \left(e^{z}\right)}\right) \]
      5. rem-log-exp77.0%

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

      \[\leadsto x \cdot 2 - \color{blue}{\left(y \cdot t\right) \cdot \left(--9 \cdot z\right)} \]
    11. Step-by-step derivation
      1. sub-neg77.0%

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

        \[\leadsto \color{blue}{\left(-\left(y \cdot t\right) \cdot \left(--9 \cdot z\right)\right) + x \cdot 2} \]
      3. distribute-rgt-neg-out77.0%

        \[\leadsto \left(-\color{blue}{\left(-\left(y \cdot t\right) \cdot \left(-9 \cdot z\right)\right)}\right) + x \cdot 2 \]
      4. remove-double-neg77.0%

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

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

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

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

Alternative 9: 79.9% accurate, 1.1× speedup?

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

\mathbf{elif}\;z \leq 4.5 \cdot 10^{-62}:\\
\;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.35e-35

    1. Initial program 84.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. Taylor expanded in a around 0 69.6%

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

    if -2.35e-35 < z < 4.50000000000000018e-62

    1. Initial program 99.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. associate-+l-99.8%

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

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

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

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

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

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

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

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

        \[\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) \]
      10. associate-*l*98.9%

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

      \[\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)} \]
    4. Taylor expanded in y around 0 80.2%

      \[\leadsto x \cdot 2 - \color{blue}{-27 \cdot \left(a \cdot b\right)} \]
    5. Step-by-step derivation
      1. *-commutative80.2%

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

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

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

    if 4.50000000000000018e-62 < z

    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. associate-+l-90.4%

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

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

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

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

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

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

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

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

        \[\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) \]
      10. associate-*l*89.3%

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

      \[\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)} \]
    4. Step-by-step derivation
      1. sub-neg89.3%

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

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

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

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

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

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

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

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

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

      \[\leadsto x \cdot 2 - \color{blue}{9 \cdot \left(y \cdot \left(t \cdot z\right)\right)} \]
    7. Step-by-step derivation
      1. add-sqr-sqrt45.3%

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

        \[\leadsto x \cdot 2 - \color{blue}{\sqrt{\left(9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right) \cdot \left(9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right)}} \]
      3. swap-sqr48.8%

        \[\leadsto x \cdot 2 - \sqrt{\color{blue}{\left(9 \cdot 9\right) \cdot \left(\left(y \cdot \left(t \cdot z\right)\right) \cdot \left(y \cdot \left(t \cdot z\right)\right)\right)}} \]
      4. metadata-eval48.8%

        \[\leadsto x \cdot 2 - \sqrt{\color{blue}{81} \cdot \left(\left(y \cdot \left(t \cdot z\right)\right) \cdot \left(y \cdot \left(t \cdot z\right)\right)\right)} \]
      5. metadata-eval48.8%

        \[\leadsto x \cdot 2 - \sqrt{\color{blue}{\left(-9 \cdot -9\right)} \cdot \left(\left(y \cdot \left(t \cdot z\right)\right) \cdot \left(y \cdot \left(t \cdot z\right)\right)\right)} \]
      6. swap-sqr48.8%

        \[\leadsto x \cdot 2 - \sqrt{\color{blue}{\left(-9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right) \cdot \left(-9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right)}} \]
      7. *-commutative48.8%

        \[\leadsto x \cdot 2 - \sqrt{\color{blue}{\left(\left(y \cdot \left(t \cdot z\right)\right) \cdot -9\right)} \cdot \left(-9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right)} \]
      8. *-commutative48.8%

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

        \[\leadsto x \cdot 2 - \sqrt{\left(\color{blue}{\left(\left(y \cdot t\right) \cdot z\right)} \cdot -9\right) \cdot \left(\left(y \cdot \left(t \cdot z\right)\right) \cdot -9\right)} \]
      10. associate-*r*48.8%

        \[\leadsto x \cdot 2 - \sqrt{\color{blue}{\left(\left(y \cdot t\right) \cdot \left(z \cdot -9\right)\right)} \cdot \left(\left(y \cdot \left(t \cdot z\right)\right) \cdot -9\right)} \]
      11. associate-*r*50.1%

        \[\leadsto x \cdot 2 - \sqrt{\left(\left(y \cdot t\right) \cdot \left(z \cdot -9\right)\right) \cdot \left(\color{blue}{\left(\left(y \cdot t\right) \cdot z\right)} \cdot -9\right)} \]
      12. associate-*r*50.1%

        \[\leadsto x \cdot 2 - \sqrt{\left(\left(y \cdot t\right) \cdot \left(z \cdot -9\right)\right) \cdot \color{blue}{\left(\left(y \cdot t\right) \cdot \left(z \cdot -9\right)\right)}} \]
      13. sqrt-unprod14.6%

        \[\leadsto x \cdot 2 - \color{blue}{\sqrt{\left(y \cdot t\right) \cdot \left(z \cdot -9\right)} \cdot \sqrt{\left(y \cdot t\right) \cdot \left(z \cdot -9\right)}} \]
      14. add-sqr-sqrt26.2%

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

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

        \[\leadsto x \cdot 2 - \color{blue}{\left(y \cdot \left(t \cdot z\right)\right)} \cdot -9 \]
      17. metadata-eval26.0%

        \[\leadsto x \cdot 2 - \left(y \cdot \left(t \cdot z\right)\right) \cdot \color{blue}{\left(-9\right)} \]
      18. distribute-rgt-neg-in26.0%

        \[\leadsto x \cdot 2 - \color{blue}{\left(-\left(y \cdot \left(t \cdot z\right)\right) \cdot 9\right)} \]
      19. *-commutative26.0%

        \[\leadsto x \cdot 2 - \left(-\color{blue}{9 \cdot \left(y \cdot \left(t \cdot z\right)\right)}\right) \]
      20. add-log-exp18.7%

        \[\leadsto x \cdot 2 - \left(-\color{blue}{\log \left(e^{9 \cdot \left(y \cdot \left(t \cdot z\right)\right)}\right)}\right) \]
    8. Applied egg-rr41.4%

      \[\leadsto x \cdot 2 - \color{blue}{\log \left(\frac{1}{{\left({\left(e^{z}\right)}^{-9}\right)}^{\left(y \cdot t\right)}}\right)} \]
    9. Step-by-step derivation
      1. log-rec41.4%

        \[\leadsto x \cdot 2 - \color{blue}{\left(-\log \left({\left({\left(e^{z}\right)}^{-9}\right)}^{\left(y \cdot t\right)}\right)\right)} \]
      2. log-pow35.7%

        \[\leadsto x \cdot 2 - \left(-\color{blue}{\left(y \cdot t\right) \cdot \log \left({\left(e^{z}\right)}^{-9}\right)}\right) \]
      3. distribute-rgt-neg-in35.7%

        \[\leadsto x \cdot 2 - \color{blue}{\left(y \cdot t\right) \cdot \left(-\log \left({\left(e^{z}\right)}^{-9}\right)\right)} \]
      4. log-pow35.7%

        \[\leadsto x \cdot 2 - \left(y \cdot t\right) \cdot \left(-\color{blue}{-9 \cdot \log \left(e^{z}\right)}\right) \]
      5. rem-log-exp77.0%

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

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

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

Alternative 10: 80.2% accurate, 1.1× speedup?

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

\mathbf{elif}\;z \leq 1.12 \cdot 10^{-61}:\\
\;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.9000000000000001e-74

    1. Initial program 86.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. Taylor expanded in x around 0 60.8%

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

    if -3.9000000000000001e-74 < z < 1.12000000000000001e-61

    1. Initial program 99.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. associate-+l-99.8%

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

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

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

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

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

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

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

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

        \[\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) \]
      10. associate-*l*98.8%

        \[\leadsto x \cdot 2 - \left(\left(y \cdot 9\right) \cdot \left(z \cdot t\right) - \color{blue}{a \cdot \left(27 \cdot b\right)}\right) \]
    3. Simplified98.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)} \]
    4. Taylor expanded in y around 0 79.9%

      \[\leadsto x \cdot 2 - \color{blue}{-27 \cdot \left(a \cdot b\right)} \]
    5. Step-by-step derivation
      1. *-commutative79.9%

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

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

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

    if 1.12000000000000001e-61 < z

    1. Initial program 90.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. associate-+l-90.3%

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

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

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

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

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

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

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

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

        \[\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) \]
      10. associate-*l*89.2%

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

      \[\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)} \]
    4. Step-by-step derivation
      1. sub-neg89.2%

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

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

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

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

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

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

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

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

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

      \[\leadsto x \cdot 2 - \color{blue}{9 \cdot \left(y \cdot \left(t \cdot z\right)\right)} \]
    7. Step-by-step derivation
      1. add-sqr-sqrt45.9%

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

        \[\leadsto x \cdot 2 - \color{blue}{\sqrt{\left(9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right) \cdot \left(9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right)}} \]
      3. swap-sqr48.0%

        \[\leadsto x \cdot 2 - \sqrt{\color{blue}{\left(9 \cdot 9\right) \cdot \left(\left(y \cdot \left(t \cdot z\right)\right) \cdot \left(y \cdot \left(t \cdot z\right)\right)\right)}} \]
      4. metadata-eval48.0%

        \[\leadsto x \cdot 2 - \sqrt{\color{blue}{81} \cdot \left(\left(y \cdot \left(t \cdot z\right)\right) \cdot \left(y \cdot \left(t \cdot z\right)\right)\right)} \]
      5. metadata-eval48.0%

        \[\leadsto x \cdot 2 - \sqrt{\color{blue}{\left(-9 \cdot -9\right)} \cdot \left(\left(y \cdot \left(t \cdot z\right)\right) \cdot \left(y \cdot \left(t \cdot z\right)\right)\right)} \]
      6. swap-sqr48.1%

        \[\leadsto x \cdot 2 - \sqrt{\color{blue}{\left(-9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right) \cdot \left(-9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right)}} \]
      7. *-commutative48.1%

        \[\leadsto x \cdot 2 - \sqrt{\color{blue}{\left(\left(y \cdot \left(t \cdot z\right)\right) \cdot -9\right)} \cdot \left(-9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right)} \]
      8. *-commutative48.1%

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

        \[\leadsto x \cdot 2 - \sqrt{\left(\color{blue}{\left(\left(y \cdot t\right) \cdot z\right)} \cdot -9\right) \cdot \left(\left(y \cdot \left(t \cdot z\right)\right) \cdot -9\right)} \]
      10. associate-*r*48.1%

        \[\leadsto x \cdot 2 - \sqrt{\color{blue}{\left(\left(y \cdot t\right) \cdot \left(z \cdot -9\right)\right)} \cdot \left(\left(y \cdot \left(t \cdot z\right)\right) \cdot -9\right)} \]
      11. associate-*r*49.4%

        \[\leadsto x \cdot 2 - \sqrt{\left(\left(y \cdot t\right) \cdot \left(z \cdot -9\right)\right) \cdot \left(\color{blue}{\left(\left(y \cdot t\right) \cdot z\right)} \cdot -9\right)} \]
      12. associate-*r*49.4%

        \[\leadsto x \cdot 2 - \sqrt{\left(\left(y \cdot t\right) \cdot \left(z \cdot -9\right)\right) \cdot \color{blue}{\left(\left(y \cdot t\right) \cdot \left(z \cdot -9\right)\right)}} \]
      13. sqrt-unprod13.4%

        \[\leadsto x \cdot 2 - \color{blue}{\sqrt{\left(y \cdot t\right) \cdot \left(z \cdot -9\right)} \cdot \sqrt{\left(y \cdot t\right) \cdot \left(z \cdot -9\right)}} \]
      14. add-sqr-sqrt25.2%

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

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

        \[\leadsto x \cdot 2 - \color{blue}{\left(y \cdot \left(t \cdot z\right)\right)} \cdot -9 \]
      17. metadata-eval25.0%

        \[\leadsto x \cdot 2 - \left(y \cdot \left(t \cdot z\right)\right) \cdot \color{blue}{\left(-9\right)} \]
      18. distribute-rgt-neg-in25.0%

        \[\leadsto x \cdot 2 - \color{blue}{\left(-\left(y \cdot \left(t \cdot z\right)\right) \cdot 9\right)} \]
      19. *-commutative25.0%

        \[\leadsto x \cdot 2 - \left(-\color{blue}{9 \cdot \left(y \cdot \left(t \cdot z\right)\right)}\right) \]
      20. add-log-exp17.6%

        \[\leadsto x \cdot 2 - \left(-\color{blue}{\log \left(e^{9 \cdot \left(y \cdot \left(t \cdot z\right)\right)}\right)}\right) \]
    8. Applied egg-rr40.5%

      \[\leadsto x \cdot 2 - \color{blue}{\log \left(\frac{1}{{\left({\left(e^{z}\right)}^{-9}\right)}^{\left(y \cdot t\right)}}\right)} \]
    9. Step-by-step derivation
      1. log-rec40.5%

        \[\leadsto x \cdot 2 - \color{blue}{\left(-\log \left({\left({\left(e^{z}\right)}^{-9}\right)}^{\left(y \cdot t\right)}\right)\right)} \]
      2. log-pow34.8%

        \[\leadsto x \cdot 2 - \left(-\color{blue}{\left(y \cdot t\right) \cdot \log \left({\left(e^{z}\right)}^{-9}\right)}\right) \]
      3. distribute-rgt-neg-in34.8%

        \[\leadsto x \cdot 2 - \color{blue}{\left(y \cdot t\right) \cdot \left(-\log \left({\left(e^{z}\right)}^{-9}\right)\right)} \]
      4. log-pow34.8%

        \[\leadsto x \cdot 2 - \left(y \cdot t\right) \cdot \left(-\color{blue}{-9 \cdot \log \left(e^{z}\right)}\right) \]
      5. rem-log-exp76.7%

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

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

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

Alternative 11: 75.8% accurate, 1.3× speedup?

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

\mathbf{elif}\;z \leq 210000000:\\
\;\;\;\;x \cdot 2 - \left(a \cdot b\right) \cdot -27\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.8999999999999998e64

    1. Initial program 79.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. Taylor expanded in y around inf 43.4%

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

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

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

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

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

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

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

    if -3.8999999999999998e64 < z < 2.1e8

    1. Initial program 99.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. associate-+l-99.8%

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

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

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

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

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

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

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

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

        \[\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) \]
      10. associate-*l*99.1%

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

      \[\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)} \]
    4. Taylor expanded in y around 0 78.2%

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

    if 2.1e8 < z

    1. Initial program 88.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. Taylor expanded in y around inf 50.0%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\color{blue}{\left(-9\right)} \cdot \left(y \cdot z\right)\right) \cdot t \]
      5. distribute-lft-neg-in53.1%

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

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

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

        \[\leadsto t \cdot \left(-\color{blue}{9 \cdot \left(y \cdot z\right)}\right) \]
      9. distribute-lft-neg-in53.1%

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

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

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

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

Alternative 12: 47.0% accurate, 1.9× speedup?

\[\begin{array}{l} [y, z, t] = \mathsf{sort}([y, z, t])\\ [a, b] = \mathsf{sort}([a, b])\\ \\ \begin{array}{l} \mathbf{if}\;b \leq -4.1 \cdot 10^{+17} \lor \neg \left(b \leq 0.0004\right):\\ \;\;\;\;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.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
 :precision binary64
 (if (or (<= b -4.1e+17) (not (<= b 0.0004))) (* a (* 27.0 b)) (* x 2.0)))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((b <= -4.1e+17) || !(b <= 0.0004)) {
		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.
NOTE: a and b 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 ((b <= (-4.1d+17)) .or. (.not. (b <= 0.0004d0))) then
        tmp = a * (27.0d0 * b)
    else
        tmp = x * 2.0d0
    end if
    code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((b <= -4.1e+17) || !(b <= 0.0004)) {
		tmp = a * (27.0 * b);
	} else {
		tmp = x * 2.0;
	}
	return tmp;
}
[y, z, t] = sort([y, z, t])
[a, b] = sort([a, b])
def code(x, y, z, t, a, b):
	tmp = 0
	if (b <= -4.1e+17) or not (b <= 0.0004):
		tmp = a * (27.0 * b)
	else:
		tmp = x * 2.0
	return tmp
y, z, t = sort([y, z, t])
a, b = sort([a, b])
function code(x, y, z, t, a, b)
	tmp = 0.0
	if ((b <= -4.1e+17) || !(b <= 0.0004))
		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])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if ((b <= -4.1e+17) || ~((b <= 0.0004)))
		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.
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -4.1e+17], N[Not[LessEqual[b, 0.0004]], $MachinePrecision]], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision], N[(x * 2.0), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.1 \cdot 10^{+17} \lor \neg \left(b \leq 0.0004\right):\\
\;\;\;\;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 b < -4.1e17 or 4.00000000000000019e-4 < b

    1. Initial program 92.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. associate-+l-92.4%

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

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

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

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

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

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

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

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

        \[\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) \]
      10. associate-*l*91.8%

        \[\leadsto x \cdot 2 - \left(\left(y \cdot 9\right) \cdot \left(z \cdot t\right) - \color{blue}{a \cdot \left(27 \cdot b\right)}\right) \]
    3. Simplified91.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)} \]
    4. Taylor expanded in y around 0 69.6%

      \[\leadsto x \cdot 2 - \color{blue}{-27 \cdot \left(a \cdot b\right)} \]
    5. Step-by-step derivation
      1. *-commutative69.6%

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

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

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

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

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

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

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

    if -4.1e17 < b < 4.00000000000000019e-4

    1. Initial program 93.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. Taylor expanded in x around inf 50.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -4.1 \cdot 10^{+17} \lor \neg \left(b \leq 0.0004\right):\\ \;\;\;\;a \cdot \left(27 \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2\\ \end{array} \]

Alternative 13: 47.1% accurate, 1.9× speedup?

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

\mathbf{elif}\;b \leq 0.00115:\\
\;\;\;\;x \cdot 2\\

\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -4e17

    1. Initial program 92.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. associate-+l-92.8%

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

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

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

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

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

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

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

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

        \[\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) \]
      10. associate-*l*86.5%

        \[\leadsto x \cdot 2 - \left(\left(y \cdot 9\right) \cdot \left(z \cdot t\right) - \color{blue}{a \cdot \left(27 \cdot b\right)}\right) \]
    3. Simplified86.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)} \]
    4. Taylor expanded in y around 0 67.9%

      \[\leadsto x \cdot 2 - \color{blue}{-27 \cdot \left(a \cdot b\right)} \]
    5. Step-by-step derivation
      1. *-commutative67.9%

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

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

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

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

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

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

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

    if -4e17 < b < 0.00115

    1. Initial program 93.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. Taylor expanded in x around inf 50.4%

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

    if 0.00115 < b

    1. Initial program 91.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. associate-+l-91.8%

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

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

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

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

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

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

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

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

        \[\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) \]
      10. associate-*l*98.1%

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

      \[\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)} \]
    4. Taylor expanded in y around 0 71.6%

      \[\leadsto x \cdot 2 - \color{blue}{-27 \cdot \left(a \cdot b\right)} \]
    5. Step-by-step derivation
      1. *-commutative71.6%

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

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

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

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

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

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

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

Alternative 14: 30.7% accurate, 5.7× speedup?

\[\begin{array}{l} [y, z, t] = \mathsf{sort}([y, z, t])\\ [a, b] = \mathsf{sort}([a, b])\\ \\ x \cdot 2 \end{array} \]
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b 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);
assert(a < b);
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.
NOTE: a and b 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;
assert a < b;
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])
[a, b] = sort([a, b])
def code(x, y, z, t, a, b):
	return x * 2.0
y, z, t = sort([y, z, t])
a, b = sort([a, b])
function code(x, y, z, t, a, b)
	return Float64(x * 2.0)
end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
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.
NOTE: a and b 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])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
x \cdot 2
\end{array}
Derivation
  1. Initial program 92.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. Taylor expanded in x around inf 35.0%

    \[\leadsto \color{blue}{2 \cdot x} \]
  3. Final simplification35.0%

    \[\leadsto x \cdot 2 \]

Developer target: 94.9% 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 2023196 
(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)))