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

Percentage Accurate: 95.6% → 98.4%
Time: 10.4s
Alternatives: 12
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 12 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.6% 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.4% accurate, 0.1× speedup?

\[\begin{array}{l} [y, z, t] = \mathsf{sort}([y, z, t])\\ [a, b] = \mathsf{sort}([a, b])\\ \\ \begin{array}{l} t_1 := \left(a \cdot 27\right) \cdot b\\ \mathbf{if}\;\left(y \cdot 9\right) \cdot z \leq 5 \cdot 10^{+34}:\\ \;\;\;\;\left(x \cdot 2 - \left(9 \cdot \left(y \cdot z\right)\right) \cdot t\right) + t_1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, 2, \mathsf{fma}\left(y, -9 \cdot \left(z \cdot t\right), t_1\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
 (let* ((t_1 (* (* a 27.0) b)))
   (if (<= (* (* y 9.0) z) 5e+34)
     (+ (- (* x 2.0) (* (* 9.0 (* y z)) t)) t_1)
     (fma x 2.0 (fma y (* -9.0 (* z t)) t_1)))))
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 = (a * 27.0) * b;
	double tmp;
	if (((y * 9.0) * z) <= 5e+34) {
		tmp = ((x * 2.0) - ((9.0 * (y * z)) * t)) + t_1;
	} else {
		tmp = fma(x, 2.0, fma(y, (-9.0 * (z * t)), t_1));
	}
	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(Float64(a * 27.0) * b)
	tmp = 0.0
	if (Float64(Float64(y * 9.0) * z) <= 5e+34)
		tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(9.0 * Float64(y * z)) * t)) + t_1);
	else
		tmp = fma(x, 2.0, fma(y, Float64(-9.0 * Float64(z * t)), t_1));
	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_] := Block[{t$95$1 = N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision], 5e+34], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(9.0 * N[(y * z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[(x * 2.0 + N[(y * N[(-9.0 * N[(z * t), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := \left(a \cdot 27\right) \cdot b\\
\mathbf{if}\;\left(y \cdot 9\right) \cdot z \leq 5 \cdot 10^{+34}:\\
\;\;\;\;\left(x \cdot 2 - \left(9 \cdot \left(y \cdot z\right)\right) \cdot t\right) + t_1\\

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


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

    1. Initial program 97.9%

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

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

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

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

    if 4.9999999999999998e34 < (*.f64 (*.f64 y 9) 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. fma-neg90.3%

        \[\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-sub090.3%

        \[\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-90.3%

        \[\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-sub090.3%

        \[\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. associate-*l*98.3%

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

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

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

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

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

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

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

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

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

Alternative 2: 97.3% 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}\;\left(y \cdot 9\right) \cdot z \leq 5 \cdot 10^{+226}:\\ \;\;\;\;\left(x \cdot 2 - \left(9 \cdot \left(y \cdot z\right)\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right) - 9 \cdot \left(y \cdot \left(z \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 (<= (* (* y 9.0) z) 5e+226)
   (+ (- (* x 2.0) (* (* 9.0 (* y z)) t)) (* (* a 27.0) b))
   (- (* 27.0 (* a b)) (* 9.0 (* y (* z 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 (((y * 9.0) * z) <= 5e+226) {
		tmp = ((x * 2.0) - ((9.0 * (y * z)) * t)) + ((a * 27.0) * b);
	} else {
		tmp = (27.0 * (a * b)) - (9.0 * (y * (z * 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 (((y * 9.0d0) * z) <= 5d+226) then
        tmp = ((x * 2.0d0) - ((9.0d0 * (y * z)) * t)) + ((a * 27.0d0) * b)
    else
        tmp = (27.0d0 * (a * b)) - (9.0d0 * (y * (z * 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 (((y * 9.0) * z) <= 5e+226) {
		tmp = ((x * 2.0) - ((9.0 * (y * z)) * t)) + ((a * 27.0) * b);
	} else {
		tmp = (27.0 * (a * b)) - (9.0 * (y * (z * 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 ((y * 9.0) * z) <= 5e+226:
		tmp = ((x * 2.0) - ((9.0 * (y * z)) * t)) + ((a * 27.0) * b)
	else:
		tmp = (27.0 * (a * b)) - (9.0 * (y * (z * 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 (Float64(Float64(y * 9.0) * z) <= 5e+226)
		tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(9.0 * Float64(y * z)) * t)) + Float64(Float64(a * 27.0) * b));
	else
		tmp = Float64(Float64(27.0 * Float64(a * b)) - Float64(9.0 * Float64(y * Float64(z * 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 (((y * 9.0) * z) <= 5e+226)
		tmp = ((x * 2.0) - ((9.0 * (y * z)) * t)) + ((a * 27.0) * b);
	else
		tmp = (27.0 * (a * b)) - (9.0 * (y * (z * 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[N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision], 5e+226], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(9.0 * N[(y * z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], N[(N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision] - N[(9.0 * N[(y * N[(z * 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}\;\left(y \cdot 9\right) \cdot z \leq 5 \cdot 10^{+226}:\\
\;\;\;\;\left(x \cdot 2 - \left(9 \cdot \left(y \cdot z\right)\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b\\

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


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

    1. Initial program 98.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. Taylor expanded in y around 0 98.2%

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

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

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

    if 5.0000000000000005e226 < (*.f64 (*.f64 y 9) z)

    1. Initial program 79.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-79.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-neg79.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-179.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-eval79.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-eval79.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-inv79.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-eval79.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-identity79.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.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*99.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. Simplified99.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 x around 0 96.5%

      \[\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 simplification98.0%

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

Alternative 3: 96.9% 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 8.2 \cdot 10^{+27}:\\ \;\;\;\;y \cdot \left(t \cdot \left(z \cdot -9\right)\right) + \left(x \cdot 2 + 27 \cdot \left(a \cdot b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2 + t \cdot \left(\left(y \cdot z\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 8.2e+27)
   (+ (* y (* t (* z -9.0))) (+ (* x 2.0) (* 27.0 (* a b))))
   (+ (* x 2.0) (* t (* (* y 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 <= 8.2e+27) {
		tmp = (y * (t * (z * -9.0))) + ((x * 2.0) + (27.0 * (a * b)));
	} else {
		tmp = (x * 2.0) + (t * ((y * 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 <= 8.2d+27) then
        tmp = (y * (t * (z * (-9.0d0)))) + ((x * 2.0d0) + (27.0d0 * (a * b)))
    else
        tmp = (x * 2.0d0) + (t * ((y * 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 <= 8.2e+27) {
		tmp = (y * (t * (z * -9.0))) + ((x * 2.0) + (27.0 * (a * b)));
	} else {
		tmp = (x * 2.0) + (t * ((y * 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 <= 8.2e+27:
		tmp = (y * (t * (z * -9.0))) + ((x * 2.0) + (27.0 * (a * b)))
	else:
		tmp = (x * 2.0) + (t * ((y * 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 <= 8.2e+27)
		tmp = Float64(Float64(y * Float64(t * Float64(z * -9.0))) + Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))));
	else
		tmp = Float64(Float64(x * 2.0) + Float64(t * Float64(Float64(y * 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 <= 8.2e+27)
		tmp = (y * (t * (z * -9.0))) + ((x * 2.0) + (27.0 * (a * b)));
	else
		tmp = (x * 2.0) + (t * ((y * 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, 8.2e+27], N[(N[(y * N[(t * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] + N[(t * N[(N[(y * z), $MachinePrecision] * -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 8.2 \cdot 10^{+27}:\\
\;\;\;\;y \cdot \left(t \cdot \left(z \cdot -9\right)\right) + \left(x \cdot 2 + 27 \cdot \left(a \cdot b\right)\right)\\

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


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

    1. Initial program 97.6%

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

        \[\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-neg97.6%

        \[\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-sub097.6%

        \[\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-97.6%

        \[\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-sub097.6%

        \[\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. *-commutative97.6%

        \[\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-in97.6%

        \[\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-def97.6%

        \[\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. *-commutative97.6%

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

        \[\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-in97.6%

        \[\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. *-commutative97.6%

        \[\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-eval97.6%

        \[\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. Simplified97.6%

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

      \[\leadsto \mathsf{fma}\left(x, 2, \color{blue}{-9 \cdot \left(y \cdot \left(t \cdot z\right)\right) + 27 \cdot \left(a \cdot b\right)}\right) \]
    5. Step-by-step derivation
      1. +-commutative96.7%

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(27, a \cdot b, \left(y \cdot z\right) \cdot \left(-9 \cdot t\right)\right)}\right) \]
    7. Step-by-step derivation
      1. fma-udef97.7%

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

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

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

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

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

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

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

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

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

    if 8.2000000000000005e27 < z

    1. Initial program 92.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-92.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-neg92.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-192.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-eval92.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-eval92.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-inv92.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-eval92.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-identity92.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*90.4%

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

        \[\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. Simplified90.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 98.4% accurate, 0.9× speedup?

\[\begin{array}{l} [y, z, t] = \mathsf{sort}([y, z, t])\\ [a, b] = \mathsf{sort}([a, b])\\ \\ \begin{array}{l} t_1 := x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\ \mathbf{if}\;y \leq -5 \cdot 10^{+31}:\\ \;\;\;\;y \cdot \left(t \cdot \left(z \cdot -9\right)\right) + t_1\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + t_1\\ \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 (+ (* x 2.0) (* 27.0 (* a b)))))
   (if (<= y -5e+31)
     (+ (* y (* t (* z -9.0))) t_1)
     (+ (* z (* y (* t -9.0))) t_1))))
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 = (x * 2.0) + (27.0 * (a * b));
	double tmp;
	if (y <= -5e+31) {
		tmp = (y * (t * (z * -9.0))) + t_1;
	} else {
		tmp = (z * (y * (t * -9.0))) + t_1;
	}
	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 = (x * 2.0d0) + (27.0d0 * (a * b))
    if (y <= (-5d+31)) then
        tmp = (y * (t * (z * (-9.0d0)))) + t_1
    else
        tmp = (z * (y * (t * (-9.0d0)))) + t_1
    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 = (x * 2.0) + (27.0 * (a * b));
	double tmp;
	if (y <= -5e+31) {
		tmp = (y * (t * (z * -9.0))) + t_1;
	} else {
		tmp = (z * (y * (t * -9.0))) + t_1;
	}
	return tmp;
}
[y, z, t] = sort([y, z, t])
[a, b] = sort([a, b])
def code(x, y, z, t, a, b):
	t_1 = (x * 2.0) + (27.0 * (a * b))
	tmp = 0
	if y <= -5e+31:
		tmp = (y * (t * (z * -9.0))) + t_1
	else:
		tmp = (z * (y * (t * -9.0))) + t_1
	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(Float64(x * 2.0) + Float64(27.0 * Float64(a * b)))
	tmp = 0.0
	if (y <= -5e+31)
		tmp = Float64(Float64(y * Float64(t * Float64(z * -9.0))) + t_1);
	else
		tmp = Float64(Float64(z * Float64(y * Float64(t * -9.0))) + t_1);
	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 = (x * 2.0) + (27.0 * (a * b));
	tmp = 0.0;
	if (y <= -5e+31)
		tmp = (y * (t * (z * -9.0))) + t_1;
	else
		tmp = (z * (y * (t * -9.0))) + t_1;
	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[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5e+31], N[(N[(y * N[(t * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[(z * N[(y * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;y \leq -5 \cdot 10^{+31}:\\
\;\;\;\;y \cdot \left(t \cdot \left(z \cdot -9\right)\right) + t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.00000000000000027e31

    1. Initial program 91.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-91.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. fma-neg91.4%

        \[\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-sub091.4%

        \[\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-91.4%

        \[\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-sub091.4%

        \[\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. *-commutative91.4%

        \[\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-in91.4%

        \[\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-def91.4%

        \[\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. *-commutative91.4%

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

        \[\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-in91.4%

        \[\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. *-commutative91.4%

        \[\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-eval91.4%

        \[\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. Simplified91.4%

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(27, a \cdot b, \left(y \cdot z\right) \cdot \left(-9 \cdot t\right)\right)}\right) \]
    7. Step-by-step derivation
      1. fma-udef91.4%

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

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

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

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

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

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

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

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

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

    if -5.00000000000000027e31 < y

    1. Initial program 97.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. Step-by-step derivation
      1. associate-+l-97.7%

        \[\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-neg97.7%

        \[\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-sub097.7%

        \[\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-97.7%

        \[\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-sub097.7%

        \[\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. *-commutative97.7%

        \[\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-in97.7%

        \[\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-def97.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. *-commutative97.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*97.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-in97.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. *-commutative97.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-eval97.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. Simplified97.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)} \]
    4. Taylor expanded in t around 0 92.9%

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(27, a \cdot b, \left(y \cdot z\right) \cdot \left(-9 \cdot t\right)\right)}\right) \]
    7. Step-by-step derivation
      1. fma-udef97.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 98.1% 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}\;t \leq 10^{+64}:\\ \;\;\;\;y \cdot \left(t \cdot \left(z \cdot -9\right)\right) + \left(x \cdot 2 + 27 \cdot \left(a \cdot b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\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 (<= t 1e+64)
   (+ (* y (* t (* z -9.0))) (+ (* x 2.0) (* 27.0 (* a b))))
   (+ (* (* a 27.0) b) (- (* x 2.0) (* (* (* y 9.0) z) 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 (t <= 1e+64) {
		tmp = (y * (t * (z * -9.0))) + ((x * 2.0) + (27.0 * (a * b)));
	} else {
		tmp = ((a * 27.0) * b) + ((x * 2.0) - (((y * 9.0) * z) * 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 (t <= 1d+64) then
        tmp = (y * (t * (z * (-9.0d0)))) + ((x * 2.0d0) + (27.0d0 * (a * b)))
    else
        tmp = ((a * 27.0d0) * b) + ((x * 2.0d0) - (((y * 9.0d0) * z) * 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 (t <= 1e+64) {
		tmp = (y * (t * (z * -9.0))) + ((x * 2.0) + (27.0 * (a * b)));
	} else {
		tmp = ((a * 27.0) * b) + ((x * 2.0) - (((y * 9.0) * z) * 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 t <= 1e+64:
		tmp = (y * (t * (z * -9.0))) + ((x * 2.0) + (27.0 * (a * b)))
	else:
		tmp = ((a * 27.0) * b) + ((x * 2.0) - (((y * 9.0) * z) * 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 (t <= 1e+64)
		tmp = Float64(Float64(y * Float64(t * Float64(z * -9.0))) + Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))));
	else
		tmp = Float64(Float64(Float64(a * 27.0) * b) + Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * 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 (t <= 1e+64)
		tmp = (y * (t * (z * -9.0))) + ((x * 2.0) + (27.0 * (a * b)));
	else
		tmp = ((a * 27.0) * b) + ((x * 2.0) - (((y * 9.0) * z) * 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[t, 1e+64], N[(N[(y * N[(t * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $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}\;t \leq 10^{+64}:\\
\;\;\;\;y \cdot \left(t \cdot \left(z \cdot -9\right)\right) + \left(x \cdot 2 + 27 \cdot \left(a \cdot b\right)\right)\\

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


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

    1. Initial program 95.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-95.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-neg95.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-sub095.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-95.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-sub095.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. *-commutative95.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-in95.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-def95.1%

        \[\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. *-commutative95.1%

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

        \[\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-in95.1%

        \[\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. *-commutative95.1%

        \[\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-eval95.1%

        \[\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. Simplified95.1%

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

      \[\leadsto \mathsf{fma}\left(x, 2, \color{blue}{-9 \cdot \left(y \cdot \left(t \cdot z\right)\right) + 27 \cdot \left(a \cdot b\right)}\right) \]
    5. Step-by-step derivation
      1. +-commutative97.6%

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(27, a \cdot b, \left(y \cdot z\right) \cdot \left(-9 \cdot t\right)\right)}\right) \]
    7. Step-by-step derivation
      1. fma-udef95.1%

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

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

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

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

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

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

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

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

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

    if 1.00000000000000002e64 < t

    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 \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.0%

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

Alternative 6: 46.4% 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}\;t \leq -1.15 \cdot 10^{-95}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 5.8 \cdot 10^{-199}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;t \leq 2.2 \cdot 10^{+38} \lor \neg \left(t \leq 1.06 \cdot 10^{+67}\right) \land t \leq 1.2 \cdot 10^{+119}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \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 (<= t -1.15e-95)
     t_1
     (if (<= t 5.8e-199)
       (* x 2.0)
       (if (or (<= t 2.2e+38) (and (not (<= t 1.06e+67)) (<= t 1.2e+119)))
         (* 27.0 (* a b))
         t_1)))))
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 (t <= -1.15e-95) {
		tmp = t_1;
	} else if (t <= 5.8e-199) {
		tmp = x * 2.0;
	} else if ((t <= 2.2e+38) || (!(t <= 1.06e+67) && (t <= 1.2e+119))) {
		tmp = 27.0 * (a * b);
	} else {
		tmp = t_1;
	}
	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 (t <= (-1.15d-95)) then
        tmp = t_1
    else if (t <= 5.8d-199) then
        tmp = x * 2.0d0
    else if ((t <= 2.2d+38) .or. (.not. (t <= 1.06d+67)) .and. (t <= 1.2d+119)) then
        tmp = 27.0d0 * (a * b)
    else
        tmp = t_1
    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 (t <= -1.15e-95) {
		tmp = t_1;
	} else if (t <= 5.8e-199) {
		tmp = x * 2.0;
	} else if ((t <= 2.2e+38) || (!(t <= 1.06e+67) && (t <= 1.2e+119))) {
		tmp = 27.0 * (a * b);
	} else {
		tmp = t_1;
	}
	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 t <= -1.15e-95:
		tmp = t_1
	elif t <= 5.8e-199:
		tmp = x * 2.0
	elif (t <= 2.2e+38) or (not (t <= 1.06e+67) and (t <= 1.2e+119)):
		tmp = 27.0 * (a * b)
	else:
		tmp = t_1
	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 (t <= -1.15e-95)
		tmp = t_1;
	elseif (t <= 5.8e-199)
		tmp = Float64(x * 2.0);
	elseif ((t <= 2.2e+38) || (!(t <= 1.06e+67) && (t <= 1.2e+119)))
		tmp = Float64(27.0 * Float64(a * b));
	else
		tmp = t_1;
	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 (t <= -1.15e-95)
		tmp = t_1;
	elseif (t <= 5.8e-199)
		tmp = x * 2.0;
	elseif ((t <= 2.2e+38) || (~((t <= 1.06e+67)) && (t <= 1.2e+119)))
		tmp = 27.0 * (a * b);
	else
		tmp = t_1;
	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[t, -1.15e-95], t$95$1, If[LessEqual[t, 5.8e-199], N[(x * 2.0), $MachinePrecision], If[Or[LessEqual[t, 2.2e+38], And[N[Not[LessEqual[t, 1.06e+67]], $MachinePrecision], LessEqual[t, 1.2e+119]]], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\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}\;t \leq -1.15 \cdot 10^{-95}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq 5.8 \cdot 10^{-199}:\\
\;\;\;\;x \cdot 2\\

\mathbf{elif}\;t \leq 2.2 \cdot 10^{+38} \lor \neg \left(t \leq 1.06 \cdot 10^{+67}\right) \land t \leq 1.2 \cdot 10^{+119}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -1.15e-95 or 2.20000000000000006e38 < t < 1.0599999999999999e67 or 1.2e119 < t

    1. Initial program 99.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. Taylor expanded in y around 0 99.1%

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

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

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

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

    if -1.15e-95 < t < 5.8e-199

    1. Initial program 89.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-89.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. fma-neg89.8%

        \[\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.8%

        \[\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.8%

        \[\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.8%

        \[\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.8%

        \[\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.8%

        \[\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-def89.8%

        \[\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. *-commutative89.8%

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

        \[\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-in89.9%

        \[\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. *-commutative89.9%

        \[\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-eval89.9%

        \[\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. Simplified89.9%

      \[\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)} \]
    4. Taylor expanded in x around inf 55.7%

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

    if 5.8e-199 < t < 2.20000000000000006e38 or 1.0599999999999999e67 < t < 1.2e119

    1. Initial program 96.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 0 96.7%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.15 \cdot 10^{-95}:\\ \;\;\;\;-9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\ \mathbf{elif}\;t \leq 5.8 \cdot 10^{-199}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;t \leq 2.2 \cdot 10^{+38} \lor \neg \left(t \leq 1.06 \cdot 10^{+67}\right) \land t \leq 1.2 \cdot 10^{+119}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;-9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\ \end{array} \]

Alternative 7: 46.5% 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 := 27 \cdot \left(a \cdot b\right)\\ t_2 := -9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\ \mathbf{if}\;t \leq -2.6 \cdot 10^{-91}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 3.45 \cdot 10^{-205}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;t \leq 2.8 \cdot 10^{+38}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 3.6 \cdot 10^{+65}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 2 \cdot 10^{+116}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\left(z \cdot t\right) \cdot \left(y \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
 (let* ((t_1 (* 27.0 (* a b))) (t_2 (* -9.0 (* y (* z t)))))
   (if (<= t -2.6e-91)
     t_2
     (if (<= t 3.45e-205)
       (* x 2.0)
       (if (<= t 2.8e+38)
         t_1
         (if (<= t 3.6e+65)
           t_2
           (if (<= t 2e+116) t_1 (* (* z t) (* 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 t_1 = 27.0 * (a * b);
	double t_2 = -9.0 * (y * (z * t));
	double tmp;
	if (t <= -2.6e-91) {
		tmp = t_2;
	} else if (t <= 3.45e-205) {
		tmp = x * 2.0;
	} else if (t <= 2.8e+38) {
		tmp = t_1;
	} else if (t <= 3.6e+65) {
		tmp = t_2;
	} else if (t <= 2e+116) {
		tmp = t_1;
	} else {
		tmp = (z * t) * (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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = 27.0d0 * (a * b)
    t_2 = (-9.0d0) * (y * (z * t))
    if (t <= (-2.6d-91)) then
        tmp = t_2
    else if (t <= 3.45d-205) then
        tmp = x * 2.0d0
    else if (t <= 2.8d+38) then
        tmp = t_1
    else if (t <= 3.6d+65) then
        tmp = t_2
    else if (t <= 2d+116) then
        tmp = t_1
    else
        tmp = (z * t) * (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 t_1 = 27.0 * (a * b);
	double t_2 = -9.0 * (y * (z * t));
	double tmp;
	if (t <= -2.6e-91) {
		tmp = t_2;
	} else if (t <= 3.45e-205) {
		tmp = x * 2.0;
	} else if (t <= 2.8e+38) {
		tmp = t_1;
	} else if (t <= 3.6e+65) {
		tmp = t_2;
	} else if (t <= 2e+116) {
		tmp = t_1;
	} else {
		tmp = (z * t) * (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):
	t_1 = 27.0 * (a * b)
	t_2 = -9.0 * (y * (z * t))
	tmp = 0
	if t <= -2.6e-91:
		tmp = t_2
	elif t <= 3.45e-205:
		tmp = x * 2.0
	elif t <= 2.8e+38:
		tmp = t_1
	elif t <= 3.6e+65:
		tmp = t_2
	elif t <= 2e+116:
		tmp = t_1
	else:
		tmp = (z * t) * (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)
	t_1 = Float64(27.0 * Float64(a * b))
	t_2 = Float64(-9.0 * Float64(y * Float64(z * t)))
	tmp = 0.0
	if (t <= -2.6e-91)
		tmp = t_2;
	elseif (t <= 3.45e-205)
		tmp = Float64(x * 2.0);
	elseif (t <= 2.8e+38)
		tmp = t_1;
	elseif (t <= 3.6e+65)
		tmp = t_2;
	elseif (t <= 2e+116)
		tmp = t_1;
	else
		tmp = Float64(Float64(z * t) * Float64(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)
	t_1 = 27.0 * (a * b);
	t_2 = -9.0 * (y * (z * t));
	tmp = 0.0;
	if (t <= -2.6e-91)
		tmp = t_2;
	elseif (t <= 3.45e-205)
		tmp = x * 2.0;
	elseif (t <= 2.8e+38)
		tmp = t_1;
	elseif (t <= 3.6e+65)
		tmp = t_2;
	elseif (t <= 2e+116)
		tmp = t_1;
	else
		tmp = (z * t) * (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_] := Block[{t$95$1 = N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.6e-91], t$95$2, If[LessEqual[t, 3.45e-205], N[(x * 2.0), $MachinePrecision], If[LessEqual[t, 2.8e+38], t$95$1, If[LessEqual[t, 3.6e+65], t$95$2, If[LessEqual[t, 2e+116], t$95$1, N[(N[(z * t), $MachinePrecision] * N[(y * -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 := 27 \cdot \left(a \cdot b\right)\\
t_2 := -9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{if}\;t \leq -2.6 \cdot 10^{-91}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;t \leq 3.45 \cdot 10^{-205}:\\
\;\;\;\;x \cdot 2\\

\mathbf{elif}\;t \leq 2.8 \cdot 10^{+38}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq 3.6 \cdot 10^{+65}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;t \leq 2 \cdot 10^{+116}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -2.60000000000000014e-91 or 2.8e38 < t < 3.59999999999999978e65

    1. Initial program 98.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 y around 0 98.7%

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

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

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

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

    if -2.60000000000000014e-91 < t < 3.4499999999999999e-205

    1. Initial program 91.2%

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

        \[\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-neg91.2%

        \[\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-sub091.2%

        \[\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-91.2%

        \[\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-sub091.2%

        \[\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. *-commutative91.2%

        \[\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-in91.2%

        \[\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-def91.2%

        \[\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. *-commutative91.2%

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

        \[\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-in91.2%

        \[\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. *-commutative91.2%

        \[\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-eval91.2%

        \[\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. Simplified91.2%

      \[\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)} \]
    4. Taylor expanded in x around inf 53.6%

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

    if 3.4499999999999999e-205 < t < 2.8e38 or 3.59999999999999978e65 < t < 2.00000000000000003e116

    1. Initial program 95.2%

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

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

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

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

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

    if 2.00000000000000003e116 < t

    1. Initial program 99.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. Taylor expanded in y around 0 99.9%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.6 \cdot 10^{-91}:\\ \;\;\;\;-9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\ \mathbf{elif}\;t \leq 3.45 \cdot 10^{-205}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;t \leq 2.8 \cdot 10^{+38}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;t \leq 3.6 \cdot 10^{+65}:\\ \;\;\;\;-9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\ \mathbf{elif}\;t \leq 2 \cdot 10^{+116}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(z \cdot t\right) \cdot \left(y \cdot -9\right)\\ \end{array} \]

Alternative 8: 77.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 -5.2 \cdot 10^{-97} \lor \neg \left(z \leq 1.5 \cdot 10^{-78}\right):\\ \;\;\;\;x \cdot 2 + t \cdot \left(\left(y \cdot z\right) \cdot -9\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2 + 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 (or (<= z -5.2e-97) (not (<= z 1.5e-78)))
   (+ (* x 2.0) (* t (* (* y z) -9.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 tmp;
	if ((z <= -5.2e-97) || !(z <= 1.5e-78)) {
		tmp = (x * 2.0) + (t * ((y * z) * -9.0));
	} else {
		tmp = (x * 2.0) + (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 ((z <= (-5.2d-97)) .or. (.not. (z <= 1.5d-78))) then
        tmp = (x * 2.0d0) + (t * ((y * z) * (-9.0d0)))
    else
        tmp = (x * 2.0d0) + (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 ((z <= -5.2e-97) || !(z <= 1.5e-78)) {
		tmp = (x * 2.0) + (t * ((y * z) * -9.0));
	} else {
		tmp = (x * 2.0) + (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 (z <= -5.2e-97) or not (z <= 1.5e-78):
		tmp = (x * 2.0) + (t * ((y * z) * -9.0))
	else:
		tmp = (x * 2.0) + (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 ((z <= -5.2e-97) || !(z <= 1.5e-78))
		tmp = Float64(Float64(x * 2.0) + Float64(t * Float64(Float64(y * z) * -9.0)));
	else
		tmp = Float64(Float64(x * 2.0) + 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 ((z <= -5.2e-97) || ~((z <= 1.5e-78)))
		tmp = (x * 2.0) + (t * ((y * z) * -9.0));
	else
		tmp = (x * 2.0) + (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[Or[LessEqual[z, -5.2e-97], N[Not[LessEqual[z, 1.5e-78]], $MachinePrecision]], N[(N[(x * 2.0), $MachinePrecision] + N[(t * N[(N[(y * z), $MachinePrecision] * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $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 -5.2 \cdot 10^{-97} \lor \neg \left(z \leq 1.5 \cdot 10^{-78}\right):\\
\;\;\;\;x \cdot 2 + t \cdot \left(\left(y \cdot z\right) \cdot -9\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.20000000000000014e-97 or 1.49999999999999994e-78 < z

    1. Initial program 94.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-94.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-neg94.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-194.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-eval94.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-eval94.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-inv94.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-eval94.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-identity94.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*92.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*92.0%

        \[\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. Simplified92.0%

      \[\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 a around 0 71.2%

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.20000000000000014e-97 < z < 1.49999999999999994e-78

    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. fma-neg99.8%

        \[\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-sub099.8%

        \[\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-99.8%

        \[\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-sub099.8%

        \[\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. *-commutative99.8%

        \[\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-in99.8%

        \[\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-def99.8%

        \[\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. *-commutative99.8%

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

        \[\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-in99.8%

        \[\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. *-commutative99.8%

        \[\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-eval99.8%

        \[\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. Simplified99.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.2 \cdot 10^{-97} \lor \neg \left(z \leq 1.5 \cdot 10^{-78}\right):\\ \;\;\;\;x \cdot 2 + t \cdot \left(\left(y \cdot z\right) \cdot -9\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\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 -5 \cdot 10^{-97}:\\ \;\;\;\;x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\ \mathbf{elif}\;z \leq 8 \cdot 10^{-82}:\\ \;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2 + t \cdot \left(\left(y \cdot z\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 -5e-97)
   (- (* x 2.0) (* 9.0 (* y (* z t))))
   (if (<= z 8e-82)
     (+ (* x 2.0) (* 27.0 (* a b)))
     (+ (* x 2.0) (* t (* (* y 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 <= -5e-97) {
		tmp = (x * 2.0) - (9.0 * (y * (z * t)));
	} else if (z <= 8e-82) {
		tmp = (x * 2.0) + (27.0 * (a * b));
	} else {
		tmp = (x * 2.0) + (t * ((y * 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 <= (-5d-97)) then
        tmp = (x * 2.0d0) - (9.0d0 * (y * (z * t)))
    else if (z <= 8d-82) then
        tmp = (x * 2.0d0) + (27.0d0 * (a * b))
    else
        tmp = (x * 2.0d0) + (t * ((y * 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 <= -5e-97) {
		tmp = (x * 2.0) - (9.0 * (y * (z * t)));
	} else if (z <= 8e-82) {
		tmp = (x * 2.0) + (27.0 * (a * b));
	} else {
		tmp = (x * 2.0) + (t * ((y * 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 <= -5e-97:
		tmp = (x * 2.0) - (9.0 * (y * (z * t)))
	elif z <= 8e-82:
		tmp = (x * 2.0) + (27.0 * (a * b))
	else:
		tmp = (x * 2.0) + (t * ((y * 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 <= -5e-97)
		tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(z * t))));
	elseif (z <= 8e-82)
		tmp = Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b)));
	else
		tmp = Float64(Float64(x * 2.0) + Float64(t * Float64(Float64(y * 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 <= -5e-97)
		tmp = (x * 2.0) - (9.0 * (y * (z * t)));
	elseif (z <= 8e-82)
		tmp = (x * 2.0) + (27.0 * (a * b));
	else
		tmp = (x * 2.0) + (t * ((y * 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, -5e-97], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8e-82], N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] + N[(t * N[(N[(y * z), $MachinePrecision] * -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 -5 \cdot 10^{-97}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\

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

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


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

    1. Initial program 94.8%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l-94.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-neg94.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-194.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-eval94.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-eval94.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-inv94.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-eval94.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-identity94.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*92.4%

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

        \[\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. Simplified92.4%

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

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

    if -4.9999999999999995e-97 < z < 8e-82

    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. fma-neg99.8%

        \[\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-sub099.8%

        \[\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-99.8%

        \[\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-sub099.8%

        \[\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. *-commutative99.8%

        \[\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-in99.8%

        \[\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-def99.8%

        \[\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. *-commutative99.8%

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

        \[\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-in99.8%

        \[\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. *-commutative99.8%

        \[\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-eval99.8%

        \[\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. Simplified99.8%

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

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

    if 8e-82 < z

    1. Initial program 93.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-93.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-neg93.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-193.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-eval93.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-eval93.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-inv93.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-eval93.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-identity93.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*91.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*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 a around 0 70.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 47.7% 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}\;a \leq -6 \cdot 10^{+162} \lor \neg \left(a \leq -7.6 \cdot 10^{+142} \lor \neg \left(a \leq -3 \cdot 10^{+44}\right) \land a \leq 1.5 \cdot 10^{-127}\right):\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2\\ \end{array} \end{array} \]
NOTE: y, z, and t should be sorted in increasing order before calling this function.
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 (<= a -6e+162)
         (not (or (<= a -7.6e+142) (and (not (<= a -3e+44)) (<= a 1.5e-127)))))
   (* 27.0 (* a 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 ((a <= -6e+162) || !((a <= -7.6e+142) || (!(a <= -3e+44) && (a <= 1.5e-127)))) {
		tmp = 27.0 * (a * b);
	} else {
		tmp = x * 2.0;
	}
	return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
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 ((a <= (-6d+162)) .or. (.not. (a <= (-7.6d+142)) .or. (.not. (a <= (-3d+44))) .and. (a <= 1.5d-127))) then
        tmp = 27.0d0 * (a * 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 ((a <= -6e+162) || !((a <= -7.6e+142) || (!(a <= -3e+44) && (a <= 1.5e-127)))) {
		tmp = 27.0 * (a * 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 (a <= -6e+162) or not ((a <= -7.6e+142) or (not (a <= -3e+44) and (a <= 1.5e-127))):
		tmp = 27.0 * (a * 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 ((a <= -6e+162) || !((a <= -7.6e+142) || (!(a <= -3e+44) && (a <= 1.5e-127))))
		tmp = Float64(27.0 * Float64(a * b));
	else
		tmp = Float64(x * 2.0);
	end
	return tmp
end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if ((a <= -6e+162) || ~(((a <= -7.6e+142) || (~((a <= -3e+44)) && (a <= 1.5e-127)))))
		tmp = 27.0 * (a * b);
	else
		tmp = x * 2.0;
	end
	tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -6e+162], N[Not[Or[LessEqual[a, -7.6e+142], And[N[Not[LessEqual[a, -3e+44]], $MachinePrecision], LessEqual[a, 1.5e-127]]]], $MachinePrecision]], N[(27.0 * N[(a * 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}\;a \leq -6 \cdot 10^{+162} \lor \neg \left(a \leq -7.6 \cdot 10^{+142} \lor \neg \left(a \leq -3 \cdot 10^{+44}\right) \land a \leq 1.5 \cdot 10^{-127}\right):\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -5.9999999999999996e162 or -7.59999999999999979e142 < a < -2.99999999999999987e44 or 1.50000000000000004e-127 < a

    1. Initial program 94.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 y around 0 94.1%

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

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

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

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

    if -5.9999999999999996e162 < a < -7.59999999999999979e142 or -2.99999999999999987e44 < a < 1.50000000000000004e-127

    1. Initial program 98.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-98.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. fma-neg98.3%

        \[\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-sub098.3%

        \[\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-98.3%

        \[\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-sub098.3%

        \[\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. *-commutative98.3%

        \[\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-in98.3%

        \[\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-def98.3%

        \[\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. *-commutative98.3%

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

        \[\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-in98.3%

        \[\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. *-commutative98.3%

        \[\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-eval98.3%

        \[\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. Simplified98.3%

      \[\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)} \]
    4. Taylor expanded in x around inf 44.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -6 \cdot 10^{+162} \lor \neg \left(a \leq -7.6 \cdot 10^{+142} \lor \neg \left(a \leq -3 \cdot 10^{+44}\right) \land a \leq 1.5 \cdot 10^{-127}\right):\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2\\ \end{array} \]

Alternative 11: 71.9% 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}\;y \leq -3.4 \cdot 10^{+196} \lor \neg \left(y \leq 2.4 \cdot 10^{-111}\right):\\ \;\;\;\;-9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2 + 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 (or (<= y -3.4e+196) (not (<= y 2.4e-111)))
   (* -9.0 (* y (* z t)))
   (+ (* 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 ((y <= -3.4e+196) || !(y <= 2.4e-111)) {
		tmp = -9.0 * (y * (z * t));
	} else {
		tmp = (x * 2.0) + (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 ((y <= (-3.4d+196)) .or. (.not. (y <= 2.4d-111))) then
        tmp = (-9.0d0) * (y * (z * t))
    else
        tmp = (x * 2.0d0) + (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 ((y <= -3.4e+196) || !(y <= 2.4e-111)) {
		tmp = -9.0 * (y * (z * t));
	} else {
		tmp = (x * 2.0) + (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 (y <= -3.4e+196) or not (y <= 2.4e-111):
		tmp = -9.0 * (y * (z * t))
	else:
		tmp = (x * 2.0) + (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 ((y <= -3.4e+196) || !(y <= 2.4e-111))
		tmp = Float64(-9.0 * Float64(y * Float64(z * t)));
	else
		tmp = Float64(Float64(x * 2.0) + 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 ((y <= -3.4e+196) || ~((y <= 2.4e-111)))
		tmp = -9.0 * (y * (z * t));
	else
		tmp = (x * 2.0) + (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[Or[LessEqual[y, -3.4e+196], N[Not[LessEqual[y, 2.4e-111]], $MachinePrecision]], N[(-9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $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}\;y \leq -3.4 \cdot 10^{+196} \lor \neg \left(y \leq 2.4 \cdot 10^{-111}\right):\\
\;\;\;\;-9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.4e196 or 2.4000000000000001e-111 < y

    1. Initial program 95.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. Taylor expanded in y around 0 95.2%

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

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

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

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

    if -3.4e196 < y < 2.4000000000000001e-111

    1. Initial program 96.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. Step-by-step derivation
      1. associate-+l-96.7%

        \[\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-neg96.7%

        \[\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-sub096.7%

        \[\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-96.7%

        \[\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-sub096.7%

        \[\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. *-commutative96.7%

        \[\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-in96.7%

        \[\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-def96.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. *-commutative96.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*96.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-in96.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. *-commutative96.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-eval96.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. Simplified96.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)} \]
    4. Taylor expanded in t around 0 72.8%

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

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

Alternative 12: 31.5% 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 96.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-96.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-neg96.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-sub096.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-96.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-sub096.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. *-commutative96.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-in96.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-def96.1%

      \[\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. *-commutative96.1%

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

      \[\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-in96.1%

      \[\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. *-commutative96.1%

      \[\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-eval96.1%

      \[\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. Simplified96.1%

    \[\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)} \]
  4. Taylor expanded in x around inf 33.5%

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

    \[\leadsto x \cdot 2 \]

Developer target: 95.1% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}

Reproduce

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