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

Percentage Accurate: 95.3% → 98.7%
Time: 15.8s
Alternatives: 16
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 16 alternatives:

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

Initial Program: 95.3% accurate, 1.0× speedup?

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

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

Alternative 1: 98.7% accurate, 0.1× speedup?

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

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


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

    1. Initial program 95.4%

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

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

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

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

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

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

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

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

    if -1.21999999999999998e-234 < z

    1. Initial program 97.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-97.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-neg97.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-sub097.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-97.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-sub097.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. *-commutative97.1%

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

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

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

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

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

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

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

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

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

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

Alternative 2: 98.4% accurate, 0.1× speedup?

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

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


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

    1. Initial program 95.4%

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

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

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

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

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

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

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

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

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

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

    if -6.2000000000000003e-234 < z

    1. Initial program 97.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-97.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-neg97.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-sub097.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-97.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-sub097.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. *-commutative97.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 98.7% accurate, 0.1× speedup?

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

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


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

    1. Initial program 95.4%

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

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

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

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

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

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

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

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

    if -4.99999999999999979e-234 < z

    1. Initial program 97.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-97.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-neg97.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-sub097.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-97.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-sub097.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. *-commutative97.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 74.6% accurate, 0.8× speedup?

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

\mathbf{elif}\;z \leq -5.5 \cdot 10^{-140}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -2.4 \cdot 10^{-144}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;z \leq 3.25 \cdot 10^{+31}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 5.8 \cdot 10^{+49}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq 1.85 \cdot 10^{+84}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -6.5000000000000001e72 or 3.2500000000000002e31 < z < 5.8e49

    1. Initial program 90.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 90.6%

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

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

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

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

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

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

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

    if -6.5000000000000001e72 < z < -5.50000000000000026e-140 or -2.39999999999999994e-144 < z < 3.2500000000000002e31 or 5.8e49 < z < 1.85e84

    1. Initial program 98.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-98.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.50000000000000026e-140 < z < -2.39999999999999994e-144 or 1.85e84 < z

    1. Initial program 95.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6.5 \cdot 10^{+72}:\\ \;\;\;\;y \cdot \left(-9 \cdot \left(z \cdot t\right)\right)\\ \mathbf{elif}\;z \leq -5.5 \cdot 10^{-140}:\\ \;\;\;\;x \cdot 2 - b \cdot \left(a \cdot -27\right)\\ \mathbf{elif}\;z \leq -2.4 \cdot 10^{-144}:\\ \;\;\;\;t \cdot \left(\left(z \cdot y\right) \cdot -9\right)\\ \mathbf{elif}\;z \leq 3.25 \cdot 10^{+31}:\\ \;\;\;\;x \cdot 2 - b \cdot \left(a \cdot -27\right)\\ \mathbf{elif}\;z \leq 5.8 \cdot 10^{+49}:\\ \;\;\;\;y \cdot \left(-9 \cdot \left(z \cdot t\right)\right)\\ \mathbf{elif}\;z \leq 1.85 \cdot 10^{+84}:\\ \;\;\;\;x \cdot 2 - b \cdot \left(a \cdot -27\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(\left(z \cdot y\right) \cdot -9\right)\\ \end{array} \]

Alternative 5: 74.6% accurate, 0.8× speedup?

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

\mathbf{elif}\;z \leq -5.5 \cdot 10^{-140}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -2.4 \cdot 10^{-144}:\\
\;\;\;\;t_3\\

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

\mathbf{elif}\;z \leq 1.65 \cdot 10^{+50}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq 9.5 \cdot 10^{+83}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -7.39999999999999996e68 or 6.4000000000000001e31 < z < 1.65e50

    1. Initial program 90.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 90.6%

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

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

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

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

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

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

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

    if -7.39999999999999996e68 < z < -5.50000000000000026e-140 or 1.65e50 < z < 9.5000000000000002e83

    1. Initial program 95.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-95.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-neg95.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-195.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-eval95.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-eval95.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-inv95.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-eval95.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-identity95.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*97.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. Simplified97.8%

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

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

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

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

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

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

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

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

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

    if -5.50000000000000026e-140 < z < -2.39999999999999994e-144 or 9.5000000000000002e83 < z

    1. Initial program 95.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.39999999999999994e-144 < z < 6.4000000000000001e31

    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*97.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*97.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. Simplified97.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 84.6%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -7.4 \cdot 10^{+68}:\\ \;\;\;\;y \cdot \left(-9 \cdot \left(z \cdot t\right)\right)\\ \mathbf{elif}\;z \leq -5.5 \cdot 10^{-140}:\\ \;\;\;\;x \cdot 2 - b \cdot \left(a \cdot -27\right)\\ \mathbf{elif}\;z \leq -2.4 \cdot 10^{-144}:\\ \;\;\;\;t \cdot \left(\left(z \cdot y\right) \cdot -9\right)\\ \mathbf{elif}\;z \leq 6.4 \cdot 10^{+31}:\\ \;\;\;\;x \cdot 2 - -27 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;z \leq 1.65 \cdot 10^{+50}:\\ \;\;\;\;y \cdot \left(-9 \cdot \left(z \cdot t\right)\right)\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{+83}:\\ \;\;\;\;x \cdot 2 - b \cdot \left(a \cdot -27\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(\left(z \cdot y\right) \cdot -9\right)\\ \end{array} \]

Alternative 6: 47.6% accurate, 0.9× speedup?

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

\mathbf{elif}\;a \leq -2.6 \cdot 10^{+49}:\\
\;\;\;\;x \cdot 2\\

\mathbf{elif}\;a \leq -4.8 \cdot 10^{+22}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;a \leq -1.52 \cdot 10^{-24}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;a \leq -3.2 \cdot 10^{-131}:\\
\;\;\;\;x \cdot 2\\

\mathbf{elif}\;a \leq -2.75 \cdot 10^{-249}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;a \leq 1.45 \cdot 10^{-109}:\\
\;\;\;\;x \cdot 2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -1.85e97 or -2.59999999999999989e49 < a < -4.8e22 or 1.45e-109 < a

    1. Initial program 95.6%

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

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

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

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

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

    if -1.85e97 < a < -2.59999999999999989e49 or -1.51999999999999992e-24 < a < -3.2e-131 or -2.74999999999999999e-249 < a < 1.45e-109

    1. Initial program 97.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-97.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-neg97.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-sub097.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-97.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-sub097.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. *-commutative97.5%

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

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

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

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

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

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

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

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

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

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

    if -4.8e22 < a < -1.51999999999999992e-24 or -3.2e-131 < a < -2.74999999999999999e-249

    1. Initial program 96.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1.85 \cdot 10^{+97}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;a \leq -2.6 \cdot 10^{+49}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;a \leq -4.8 \cdot 10^{+22}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;a \leq -1.52 \cdot 10^{-24}:\\ \;\;\;\;t \cdot \left(\left(z \cdot y\right) \cdot -9\right)\\ \mathbf{elif}\;a \leq -3.2 \cdot 10^{-131}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;a \leq -2.75 \cdot 10^{-249}:\\ \;\;\;\;t \cdot \left(\left(z \cdot y\right) \cdot -9\right)\\ \mathbf{elif}\;a \leq 1.45 \cdot 10^{-109}:\\ \;\;\;\;x \cdot 2\\ \mathbf{else}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \end{array} \]

Alternative 7: 47.4% accurate, 0.9× speedup?

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

\mathbf{elif}\;a \leq -2.8 \cdot 10^{+49}:\\
\;\;\;\;x \cdot 2\\

\mathbf{elif}\;a \leq -4.5 \cdot 10^{+23}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;a \leq -2.05 \cdot 10^{-131}:\\
\;\;\;\;x \cdot 2\\

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

\mathbf{elif}\;a \leq 2.5 \cdot 10^{-109}:\\
\;\;\;\;x \cdot 2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if a < -1.1500000000000001e99 or -2.7999999999999998e49 < a < -4.49999999999999979e23 or 2.5000000000000001e-109 < a

    1. Initial program 95.6%

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

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

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

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

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

    if -1.1500000000000001e99 < a < -2.7999999999999998e49 or -1.6000000000000001e-25 < a < -2.0500000000000001e-131 or -1.9999999999999999e-245 < a < 2.5000000000000001e-109

    1. Initial program 97.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-97.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-neg97.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-sub097.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-97.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-sub097.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. *-commutative97.5%

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

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

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

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

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

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

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

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

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

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

    if -4.49999999999999979e23 < a < -1.6000000000000001e-25

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.0500000000000001e-131 < a < -1.9999999999999999e-245

    1. Initial program 95.0%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1.15 \cdot 10^{+99}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;a \leq -2.8 \cdot 10^{+49}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;a \leq -4.5 \cdot 10^{+23}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;a \leq -1.6 \cdot 10^{-25}:\\ \;\;\;\;t \cdot \left(\left(z \cdot y\right) \cdot -9\right)\\ \mathbf{elif}\;a \leq -2.05 \cdot 10^{-131}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;a \leq -2 \cdot 10^{-245}:\\ \;\;\;\;y \cdot \left(-9 \cdot \left(z \cdot t\right)\right)\\ \mathbf{elif}\;a \leq 2.5 \cdot 10^{-109}:\\ \;\;\;\;x \cdot 2\\ \mathbf{else}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \end{array} \]

Alternative 8: 77.9% accurate, 0.9× speedup?

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

\mathbf{elif}\;b \leq 1.3 \cdot 10^{-21}:\\
\;\;\;\;x \cdot 2 + -9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b < -2.5999999999999999e-52

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.5999999999999999e-52 < b < 1.30000000000000009e-21

    1. Initial program 96.2%

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt{x \cdot 2}, \sqrt{x \cdot 2}, \left(-9\right) \cdot \left(y \cdot \left(t \cdot z\right)\right)\right)} \]
      5. metadata-eval39.0%

        \[\leadsto \mathsf{fma}\left(\sqrt{x \cdot 2}, \sqrt{x \cdot 2}, \color{blue}{-9} \cdot \left(y \cdot \left(t \cdot z\right)\right)\right) \]
    4. Applied egg-rr39.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.30000000000000009e-21 < b < 6.4999999999999994e132

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

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

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

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

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

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

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

    if 6.4999999999999994e132 < b

    1. Initial program 89.7%

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

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

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

Alternative 9: 98.4% accurate, 0.9× speedup?

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

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


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

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

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

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

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

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

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

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

    if 3e-37 < t

    1. Initial program 98.4%

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

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

Alternative 10: 98.4% accurate, 0.9× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 1.00000000000000007e-37

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

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

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

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

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

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

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

    if 1.00000000000000007e-37 < t

    1. Initial program 98.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. Taylor expanded in y around 0 98.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. Step-by-step derivation
      1. *-commutative98.5%

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

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

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

Alternative 11: 98.2% accurate, 0.9× speedup?

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

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


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

    1. Initial program 95.4%

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

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

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

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

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

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

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

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

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

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

    if -1.1e-234 < z

    1. Initial program 97.1%

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

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

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

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

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

Alternative 12: 93.5% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

Alternative 13: 77.4% accurate, 1.1× speedup?

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

\mathbf{elif}\;a \leq 2.5 \cdot 10^{-109}:\\
\;\;\;\;x \cdot 2 + y \cdot \left(z \cdot \left(t \cdot -9\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -1.90000000000000008e24

    1. Initial program 98.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.90000000000000008e24 < a < 2.5000000000000001e-109

    1. Initial program 97.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-97.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-neg97.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-sub097.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-97.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-sub097.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. *-commutative97.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.5000000000000001e-109 < a

    1. Initial program 94.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 77.4% accurate, 1.1× speedup?

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

\mathbf{elif}\;a \leq 4.1 \cdot 10^{-109}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -2.1000000000000001e24

    1. Initial program 98.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.1000000000000001e24 < a < 4.1000000000000002e-109

    1. Initial program 97.1%

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

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

    if 4.1000000000000002e-109 < a

    1. Initial program 94.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 47.2% accurate, 1.9× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.85e97 or 2.5000000000000001e-109 < a

    1. Initial program 95.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. Taylor expanded in y around 0 95.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. Step-by-step derivation
      1. *-commutative95.5%

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

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

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

    if -1.85e97 < a < 2.5000000000000001e-109

    1. Initial program 97.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 16: 30.1% accurate, 5.7× speedup?

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(x, 2, \mathsf{fma}\left(t, -\color{blue}{z \cdot \left(y \cdot 9\right)}, \left(a \cdot 27\right) \cdot b\right)\right) \]
    10. associate-*r*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. Taylor expanded in x around inf 32.5%

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

    \[\leadsto x \cdot 2 \]

Developer target: 94.8% 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 2023207 
(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)))