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

Percentage Accurate: 95.5% → 98.8%
Time: 14.1s
Alternatives: 15
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 15 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 95.5% accurate, 1.0× speedup?

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

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

Alternative 1: 98.8% accurate, 0.1× speedup?

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

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


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

    1. Initial program 95.9%

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

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

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

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

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

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

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

        \[\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.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. *-commutative97.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*97.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-in97.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. *-commutative97.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-eval97.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. Simplified97.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)} \]

    if 4.99999999999999976e246 < (*.f64 (*.f64 y 9) z)

    1. Initial program 77.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. +-commutative77.1%

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

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

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

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

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

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

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

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

Alternative 2: 98.4% accurate, 0.1× speedup?

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

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


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

    1. Initial program 95.9%

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

    if 4.99999999999999976e246 < (*.f64 (*.f64 y 9) z)

    1. Initial program 77.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. +-commutative77.1%

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

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

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

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

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

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

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

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

Alternative 3: 98.3% accurate, 0.1× speedup?

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

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


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

    1. Initial program 95.9%

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

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

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

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

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

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

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

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

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

        \[\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.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-in96.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. *-commutative96.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-eval96.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. Simplified96.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. Step-by-step derivation
      1. fma-udef95.8%

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

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

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

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

    if 8.50000000000000028e74 < (*.f64 (*.f64 y 9) z)

    1. Initial program 86.0%

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

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

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

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

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

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

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

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

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

Alternative 4: 97.3% accurate, 0.7× speedup?

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

\mathbf{else}:\\
\;\;\;\;x \cdot 2 - 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) < 9.9999999999999994e253

    1. Initial program 95.9%

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

    if 9.9999999999999994e253 < (*.f64 (*.f64 y 9) z)

    1. Initial program 75.4%

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

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

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

Alternative 5: 98.0% accurate, 0.7× speedup?

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

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


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

    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 \]

    if 4.9999999999999998e290 < (*.f64 (*.f64 y 9) z)

    1. Initial program 65.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-65.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-neg65.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-165.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-eval65.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-eval65.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-inv65.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-eval65.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-identity65.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*94.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.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. Simplified99.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)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification96.4%

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

Alternative 6: 48.1% accurate, 0.9× speedup?

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

\mathbf{elif}\;z \leq -1.25 \cdot 10^{-239}:\\
\;\;\;\;x \cdot 2\\

\mathbf{elif}\;z \leq 9 \cdot 10^{-240}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 2.25 \cdot 10^{-132}:\\
\;\;\;\;x \cdot 2\\

\mathbf{elif}\;z \leq 2.05 \cdot 10^{-107}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 3.15 \cdot 10^{-90}:\\
\;\;\;\;x \cdot 2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.05000000000000008e-77 or 3.14999999999999989e-90 < z

    1. Initial program 90.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. +-commutative90.2%

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

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

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

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

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

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

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

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

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

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

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

    if -1.05000000000000008e-77 < z < -1.25e-239 or 9.0000000000000003e-240 < z < 2.25e-132 or 2.05e-107 < z < 3.14999999999999989e-90

    1. Initial program 99.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-99.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. fma-neg99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.25e-239 < z < 9.0000000000000003e-240 or 2.25e-132 < z < 2.05e-107

    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. +-commutative99.8%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.05 \cdot 10^{-77}:\\ \;\;\;\;-9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\ \mathbf{elif}\;z \leq -1.25 \cdot 10^{-239}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;z \leq 9 \cdot 10^{-240}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;z \leq 2.25 \cdot 10^{-132}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;z \leq 2.05 \cdot 10^{-107}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;z \leq 3.15 \cdot 10^{-90}:\\ \;\;\;\;x \cdot 2\\ \mathbf{else}:\\ \;\;\;\;-9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\ \end{array} \]

Alternative 7: 49.3% accurate, 0.9× speedup?

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

\mathbf{elif}\;z \leq -2.4 \cdot 10^{-239}:\\
\;\;\;\;x \cdot 2\\

\mathbf{elif}\;z \leq 6.5 \cdot 10^{-240}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 1.85 \cdot 10^{-131}:\\
\;\;\;\;x \cdot 2\\

\mathbf{elif}\;z \leq 2.2 \cdot 10^{-111}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 9.5 \cdot 10^{-92}:\\
\;\;\;\;x \cdot 2\\

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


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

    1. Initial program 88.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. +-commutative88.1%

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

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

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

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

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

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

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

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

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

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

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

    if -4.7999999999999998e-81 < z < -2.39999999999999993e-239 or 6.50000000000000007e-240 < z < 1.8500000000000001e-131 or 2.2e-111 < z < 9.49999999999999946e-92

    1. Initial program 99.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-99.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. fma-neg99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.39999999999999993e-239 < z < 6.50000000000000007e-240 or 1.8500000000000001e-131 < z < 2.2e-111

    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. +-commutative99.8%

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

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

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

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

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

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

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

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

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

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

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

    if 9.49999999999999946e-92 < z

    1. Initial program 92.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. +-commutative92.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.8 \cdot 10^{-81}:\\ \;\;\;\;-9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\ \mathbf{elif}\;z \leq -2.4 \cdot 10^{-239}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-240}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;z \leq 1.85 \cdot 10^{-131}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-111}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{-92}:\\ \;\;\;\;x \cdot 2\\ \mathbf{else}:\\ \;\;\;\;\left(z \cdot -9\right) \cdot \left(y \cdot t\right)\\ \end{array} \]

Alternative 8: 97.0% accurate, 0.9× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.1500000000000001e72

    1. Initial program 81.0%

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

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

    if -2.1500000000000001e72 < z

    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.5%

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

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

Alternative 9: 74.1% accurate, 1.0× speedup?

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

\mathbf{elif}\;z \leq 2.8 \cdot 10^{-86}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 1.8 \cdot 10^{-21}:\\
\;\;\;\;y \cdot \left(z \cdot \left(t \cdot -9\right)\right)\\

\mathbf{elif}\;z \leq 2.9 \cdot 10^{+50}:\\
\;\;\;\;t_1\\

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


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

    1. Initial program 85.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. +-commutative85.8%

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

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

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

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

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

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

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

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

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

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

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

    if -156000 < z < 2.80000000000000009e-86 or 1.79999999999999995e-21 < z < 2.9e50

    1. Initial program 99.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-99.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. sub-neg99.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.80000000000000009e-86 < z < 1.79999999999999995e-21

    1. Initial program 93.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.9e50 < z

    1. Initial program 89.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -156000:\\ \;\;\;\;-9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{-86}:\\ \;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{-21}:\\ \;\;\;\;y \cdot \left(z \cdot \left(t \cdot -9\right)\right)\\ \mathbf{elif}\;z \leq 2.9 \cdot 10^{+50}:\\ \;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\ \mathbf{else}:\\ \;\;\;\;\left(z \cdot -9\right) \cdot \left(y \cdot t\right)\\ \end{array} \]

Alternative 10: 74.2% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;z \leq 9.5 \cdot 10^{-22}:\\
\;\;\;\;y \cdot \left(z \cdot \left(t \cdot -9\right)\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -850

    1. Initial program 86.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if -850 < z < 2.29999999999999996e-86

    1. Initial program 99.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-99.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. sub-neg99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.29999999999999996e-86 < z < 9.4999999999999994e-22

    1. Initial program 93.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.4999999999999994e-22 < z < 2.6000000000000002e50

    1. Initial program 99.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-99.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. sub-neg99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.6000000000000002e50 < z

    1. Initial program 89.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -850:\\ \;\;\;\;-9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\ \mathbf{elif}\;z \leq 2.3 \cdot 10^{-86}:\\ \;\;\;\;x \cdot 2 - b \cdot \left(a \cdot -27\right)\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{-22}:\\ \;\;\;\;y \cdot \left(z \cdot \left(t \cdot -9\right)\right)\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{+50}:\\ \;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\ \mathbf{else}:\\ \;\;\;\;\left(z \cdot -9\right) \cdot \left(y \cdot t\right)\\ \end{array} \]

Alternative 11: 79.0% accurate, 1.1× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.3999999999999999e-109 or 1.14999999999999998e-86 < z

    1. Initial program 90.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.3999999999999999e-109 < z < 1.14999999999999998e-86

    1. Initial program 99.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-99.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. sub-neg99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 79.1% accurate, 1.1× speedup?

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

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

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


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

    1. Initial program 88.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. +-commutative88.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.8000000000000005e-110 < z < 1.1500000000000001e-87

    1. Initial program 99.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-99.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. sub-neg99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.1500000000000001e-87 < z

    1. Initial program 92.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. +-commutative92.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 79.3% accurate, 1.1× speedup?

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

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

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


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

    1. Initial program 88.8%

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

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

    if -1.85000000000000008e-110 < z < 3.8e-87

    1. Initial program 99.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-99.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. sub-neg99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.8e-87 < z

    1. Initial program 92.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. +-commutative92.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 47.5% accurate, 1.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.4999999999999999e106 or 1.8e19 < x

    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. fma-neg94.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-sub094.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-94.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-sub094.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. associate-*l*97.9%

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

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

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

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

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

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

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

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

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

    if -2.4999999999999999e106 < x < 1.8e19

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 30.6% accurate, 5.7× speedup?

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

    \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
  2. Step-by-step derivation
    1. associate-+l-93.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-neg93.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-sub093.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-93.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-sub093.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. associate-*l*96.1%

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

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

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

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

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

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

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

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

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

    \[\leadsto x \cdot 2 \]

Developer target: 95.0% 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 2023224 
(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)))