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

Percentage Accurate: 95.5% → 98.3%
Time: 11.8s
Alternatives: 17
Speedup: 0.8×

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 17 alternatives:

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

Initial Program: 95.5% accurate, 1.0× speedup?

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

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

Alternative 1: 98.3% accurate, 0.7× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 y #s(literal 9 binary64)) < -4.99999999999999977e36

    1. Initial program 86.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. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) + \left(\mathsf{neg}\left(9\right)\right) \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
      2. metadata-evalN/A

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

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

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

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

        \[\leadsto t \cdot \color{blue}{\left(-9 \cdot \left(y \cdot z\right)\right)} + \left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) \]
      7. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\left(y \cdot z\right) \cdot -9}, 2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) \]
      10. lower-*.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(t, \left(y \cdot z\right) \cdot -9, \color{blue}{\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)}\right) \]
      13. lower-*.f64N/A

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

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

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

      \[\leadsto \color{blue}{y \cdot \left(-9 \cdot \left(t \cdot z\right) + \left(2 \cdot \frac{x}{y} + 27 \cdot \frac{a \cdot b}{y}\right)\right)} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

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

        \[\leadsto y \cdot \left(\left(2 \cdot \frac{x}{y} + 27 \cdot \frac{a \cdot b}{y}\right) + \color{blue}{\left(\mathsf{neg}\left(9\right)\right)} \cdot \left(t \cdot z\right)\right) \]
      3. cancel-sign-sub-invN/A

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

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

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

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

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

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

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

        \[\leadsto y \cdot \left(27 \cdot \frac{a \cdot b}{y} - 9 \cdot \left(t \cdot z\right)\right) + \color{blue}{\left(2 \cdot x\right) \cdot \frac{y}{y}} \]
      11. *-inversesN/A

        \[\leadsto y \cdot \left(27 \cdot \frac{a \cdot b}{y} - 9 \cdot \left(t \cdot z\right)\right) + \left(2 \cdot x\right) \cdot \color{blue}{1} \]
      12. *-inversesN/A

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

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

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

        \[\leadsto y \cdot \left(27 \cdot \frac{a \cdot b}{y} - 9 \cdot \left(t \cdot z\right)\right) + \color{blue}{\left(2 \cdot \frac{x}{a}\right)} \cdot a \]
      16. lower-fma.f64N/A

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

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

    if -4.99999999999999977e36 < (*.f64 y #s(literal 9 binary64))

    1. Initial program 96.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 86.0% accurate, 0.4× speedup?

\[\begin{array}{l} [x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\ \\ \begin{array}{l} t_1 := t \cdot \left(y \cdot z\right)\\ t_2 := t \cdot \left(\left(y \cdot 9\right) \cdot z\right)\\ \mathbf{if}\;t\_2 \leq -5 \cdot 10^{+21}:\\ \;\;\;\;\mathsf{fma}\left(-9, t\_1, a \cdot \left(27 \cdot b\right)\right)\\ \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-24}:\\ \;\;\;\;\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)\\ \mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+250}:\\ \;\;\;\;\mathsf{fma}\left(-9, t\_1, 27 \cdot \left(a \cdot b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, -9 \cdot \left(z \cdot t\right), 2 \cdot x\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, t, 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 (* t (* y z))) (t_2 (* t (* (* y 9.0) z))))
   (if (<= t_2 -5e+21)
     (fma -9.0 t_1 (* a (* 27.0 b)))
     (if (<= t_2 2e-24)
       (fma 27.0 (* a b) (* 2.0 x))
       (if (<= t_2 4e+250)
         (fma -9.0 t_1 (* 27.0 (* a b)))
         (fma y (* -9.0 (* z t)) (* 2.0 x)))))))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = t * (y * z);
	double t_2 = t * ((y * 9.0) * z);
	double tmp;
	if (t_2 <= -5e+21) {
		tmp = fma(-9.0, t_1, (a * (27.0 * b)));
	} else if (t_2 <= 2e-24) {
		tmp = fma(27.0, (a * b), (2.0 * x));
	} else if (t_2 <= 4e+250) {
		tmp = fma(-9.0, t_1, (27.0 * (a * b)));
	} else {
		tmp = fma(y, (-9.0 * (z * t)), (2.0 * x));
	}
	return tmp;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b])
function code(x, y, z, t, a, b)
	t_1 = Float64(t * Float64(y * z))
	t_2 = Float64(t * Float64(Float64(y * 9.0) * z))
	tmp = 0.0
	if (t_2 <= -5e+21)
		tmp = fma(-9.0, t_1, Float64(a * Float64(27.0 * b)));
	elseif (t_2 <= 2e-24)
		tmp = fma(27.0, Float64(a * b), Float64(2.0 * x));
	elseif (t_2 <= 4e+250)
		tmp = fma(-9.0, t_1, Float64(27.0 * Float64(a * b)));
	else
		tmp = fma(y, Float64(-9.0 * Float64(z * t)), Float64(2.0 * x));
	end
	return tmp
end
NOTE: x, y, z, t, 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[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t * N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+21], N[(-9.0 * t$95$1 + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e-24], N[(27.0 * N[(a * b), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 4e+250], N[(-9.0 * t$95$1 + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(-9.0 * N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := t \cdot \left(y \cdot z\right)\\
t_2 := t \cdot \left(\left(y \cdot 9\right) \cdot z\right)\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+21}:\\
\;\;\;\;\mathsf{fma}\left(-9, t\_1, a \cdot \left(27 \cdot b\right)\right)\\

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-24}:\\
\;\;\;\;\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)\\

\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+250}:\\
\;\;\;\;\mathsf{fma}\left(-9, t\_1, 27 \cdot \left(a \cdot b\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -5e21

    1. Initial program 88.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. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) + \left(\mathsf{neg}\left(9\right)\right) \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
      2. metadata-evalN/A

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

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

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

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

        \[\leadsto t \cdot \color{blue}{\left(-9 \cdot \left(y \cdot z\right)\right)} + \left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) \]
      7. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\left(y \cdot z\right) \cdot -9}, 2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) \]
      10. lower-*.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(t, \left(y \cdot z\right) \cdot -9, \color{blue}{\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)}\right) \]
      13. lower-*.f64N/A

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

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

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

      \[\leadsto \color{blue}{-9 \cdot \left(t \cdot \left(y \cdot z\right)\right) + 27 \cdot \left(a \cdot b\right)} \]
    7. Step-by-step derivation
      1. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), 27 \cdot \left(a \cdot b\right)\right)} \]
      2. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-9, \color{blue}{t \cdot \left(y \cdot z\right)}, 27 \cdot \left(a \cdot b\right)\right) \]
      3. lower-*.f64N/A

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

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), \color{blue}{\left(27 \cdot a\right) \cdot b}\right) \]
      5. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), \color{blue}{\left(a \cdot 27\right)} \cdot b\right) \]
      6. associate-*r*N/A

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), \color{blue}{a \cdot \left(27 \cdot b\right)}\right) \]
      7. lower-*.f64N/A

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

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

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

    if -5e21 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 1.99999999999999985e-24

    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. Add Preprocessing
    3. Taylor expanded in y around 0

      \[\leadsto \color{blue}{2 \cdot x + 27 \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{27 \cdot \left(a \cdot b\right) + 2 \cdot x} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(27, \color{blue}{a \cdot b}, 2 \cdot x\right) \]
      4. lower-*.f6495.7

        \[\leadsto \mathsf{fma}\left(27, a \cdot b, \color{blue}{2 \cdot x}\right) \]
    5. Simplified95.7%

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

    if 1.99999999999999985e-24 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 3.9999999999999997e250

    1. Initial program 99.6%

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

      \[\leadsto \color{blue}{\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) + \left(\mathsf{neg}\left(9\right)\right) \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
      2. metadata-evalN/A

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

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

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

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

        \[\leadsto t \cdot \color{blue}{\left(-9 \cdot \left(y \cdot z\right)\right)} + \left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) \]
      7. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\left(y \cdot z\right) \cdot -9}, 2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) \]
      10. lower-*.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(t, \left(y \cdot z\right) \cdot -9, \color{blue}{\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)}\right) \]
      13. lower-*.f64N/A

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

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

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

      \[\leadsto \color{blue}{-9 \cdot \left(t \cdot \left(y \cdot z\right)\right) + 27 \cdot \left(a \cdot b\right)} \]
    7. Step-by-step derivation
      1. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), 27 \cdot \left(a \cdot b\right)\right)} \]
      2. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-9, \color{blue}{t \cdot \left(y \cdot z\right)}, 27 \cdot \left(a \cdot b\right)\right) \]
      3. lower-*.f64N/A

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

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), \color{blue}{\left(27 \cdot a\right) \cdot b}\right) \]
      5. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), \color{blue}{\left(a \cdot 27\right)} \cdot b\right) \]
      6. associate-*r*N/A

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), \color{blue}{a \cdot \left(27 \cdot b\right)}\right) \]
      7. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), \color{blue}{a \cdot \left(27 \cdot b\right)}\right) \]
      8. lower-*.f6482.0

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

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

      \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), \color{blue}{27 \cdot \left(a \cdot b\right)}\right) \]
    10. Step-by-step derivation
      1. lower-*.f64N/A

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

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

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

    if 3.9999999999999997e250 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t)

    1. Initial program 85.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{2 \cdot x + \left(\mathsf{neg}\left(9\right)\right) \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
      2. metadata-evalN/A

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot \left(-9 \cdot \left(t \cdot z\right)\right)} + 2 \cdot x \]
      8. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, -9 \cdot \left(t \cdot z\right), 2 \cdot x\right)} \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{-9 \cdot \left(t \cdot z\right)}, 2 \cdot x\right) \]
      10. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(y, -9 \cdot \color{blue}{\left(t \cdot z\right)}, 2 \cdot x\right) \]
      11. lower-*.f6488.5

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

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

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

Alternative 3: 86.0% accurate, 0.4× speedup?

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

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-24}:\\
\;\;\;\;\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)\\

\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+250}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -5e21 or 1.99999999999999985e-24 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 3.9999999999999997e250

    1. Initial program 92.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. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) + \left(\mathsf{neg}\left(9\right)\right) \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
      2. metadata-evalN/A

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

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

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

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

        \[\leadsto t \cdot \color{blue}{\left(-9 \cdot \left(y \cdot z\right)\right)} + \left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) \]
      7. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\left(y \cdot z\right) \cdot -9}, 2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) \]
      10. lower-*.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(t, \left(y \cdot z\right) \cdot -9, \color{blue}{\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)}\right) \]
      13. lower-*.f64N/A

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

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

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

      \[\leadsto \color{blue}{-9 \cdot \left(t \cdot \left(y \cdot z\right)\right) + 27 \cdot \left(a \cdot b\right)} \]
    7. Step-by-step derivation
      1. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), 27 \cdot \left(a \cdot b\right)\right)} \]
      2. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-9, \color{blue}{t \cdot \left(y \cdot z\right)}, 27 \cdot \left(a \cdot b\right)\right) \]
      3. lower-*.f64N/A

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

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), \color{blue}{\left(27 \cdot a\right) \cdot b}\right) \]
      5. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), \color{blue}{\left(a \cdot 27\right)} \cdot b\right) \]
      6. associate-*r*N/A

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), \color{blue}{a \cdot \left(27 \cdot b\right)}\right) \]
      7. lower-*.f64N/A

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

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

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

      \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), \color{blue}{27 \cdot \left(a \cdot b\right)}\right) \]
    10. Step-by-step derivation
      1. lower-*.f64N/A

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

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

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

    if -5e21 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 1.99999999999999985e-24

    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. Add Preprocessing
    3. Taylor expanded in y around 0

      \[\leadsto \color{blue}{2 \cdot x + 27 \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{27 \cdot \left(a \cdot b\right) + 2 \cdot x} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(27, \color{blue}{a \cdot b}, 2 \cdot x\right) \]
      4. lower-*.f6495.7

        \[\leadsto \mathsf{fma}\left(27, a \cdot b, \color{blue}{2 \cdot x}\right) \]
    5. Simplified95.7%

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

    if 3.9999999999999997e250 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t)

    1. Initial program 85.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{2 \cdot x + \left(\mathsf{neg}\left(9\right)\right) \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
      2. metadata-evalN/A

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot \left(-9 \cdot \left(t \cdot z\right)\right)} + 2 \cdot x \]
      8. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, -9 \cdot \left(t \cdot z\right), 2 \cdot x\right)} \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{-9 \cdot \left(t \cdot z\right)}, 2 \cdot x\right) \]
      10. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(y, -9 \cdot \color{blue}{\left(t \cdot z\right)}, 2 \cdot x\right) \]
      11. lower-*.f6488.5

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

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

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

Alternative 4: 53.5% accurate, 0.5× speedup?

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

\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{-268}:\\
\;\;\;\;2 \cdot x\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -5e21

    1. Initial program 88.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. Add Preprocessing
    3. Taylor expanded in y around inf

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

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

        \[\leadsto \color{blue}{t \cdot \left(\left(y \cdot z\right) \cdot -9\right)} \]
      3. *-commutativeN/A

        \[\leadsto t \cdot \color{blue}{\left(-9 \cdot \left(y \cdot z\right)\right)} \]
      4. lower-*.f64N/A

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

        \[\leadsto t \cdot \color{blue}{\left(\left(y \cdot z\right) \cdot -9\right)} \]
      6. lower-*.f64N/A

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

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

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

    if -5e21 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -9.99999999999999958e-269

    1. Initial program 100.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. Add Preprocessing
    3. Taylor expanded in x around inf

      \[\leadsto \color{blue}{2 \cdot x} \]
    4. Step-by-step derivation
      1. lower-*.f6474.2

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

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

    if -9.99999999999999958e-269 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 1.99999999999999985e-24

    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. Add Preprocessing
    3. Taylor expanded in a around inf

      \[\leadsto \color{blue}{27 \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \color{blue}{a \cdot \left(b \cdot 27\right)} \]
      3. *-commutativeN/A

        \[\leadsto a \cdot \color{blue}{\left(27 \cdot b\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{a \cdot \left(27 \cdot b\right)} \]
      5. lower-*.f6457.3

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

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

    if 1.99999999999999985e-24 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t)

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-9 \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
    13. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

        \[\leadsto \color{blue}{y \cdot \left(-9 \cdot \left(t \cdot z\right)\right)} \]
      5. lower-*.f64N/A

        \[\leadsto \color{blue}{y \cdot \left(-9 \cdot \left(t \cdot z\right)\right)} \]
      6. lower-*.f64N/A

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

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

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

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

Alternative 5: 53.4% accurate, 0.5× speedup?

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

\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{-268}:\\
\;\;\;\;2 \cdot x\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -5e21

    1. Initial program 88.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. Add Preprocessing
    3. Taylor expanded in y around inf

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

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

        \[\leadsto \color{blue}{t \cdot \left(\left(y \cdot z\right) \cdot -9\right)} \]
      3. *-commutativeN/A

        \[\leadsto t \cdot \color{blue}{\left(-9 \cdot \left(y \cdot z\right)\right)} \]
      4. lower-*.f64N/A

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

        \[\leadsto t \cdot \color{blue}{\left(\left(y \cdot z\right) \cdot -9\right)} \]
      6. lower-*.f64N/A

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

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

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

    if -5e21 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -9.99999999999999958e-269

    1. Initial program 100.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. Add Preprocessing
    3. Taylor expanded in x around inf

      \[\leadsto \color{blue}{2 \cdot x} \]
    4. Step-by-step derivation
      1. lower-*.f6474.2

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

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

    if -9.99999999999999958e-269 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 1.99999999999999985e-24

    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. Add Preprocessing
    3. Taylor expanded in a around inf

      \[\leadsto \color{blue}{27 \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \color{blue}{a \cdot \left(b \cdot 27\right)} \]
      3. *-commutativeN/A

        \[\leadsto a \cdot \color{blue}{\left(27 \cdot b\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{a \cdot \left(27 \cdot b\right)} \]
      5. lower-*.f6457.3

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

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

    if 1.99999999999999985e-24 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t)

    1. Initial program 92.3%

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

      \[\leadsto \color{blue}{\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) + \left(\mathsf{neg}\left(9\right)\right) \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
      2. metadata-evalN/A

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

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

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

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

        \[\leadsto t \cdot \color{blue}{\left(-9 \cdot \left(y \cdot z\right)\right)} + \left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) \]
      7. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\left(y \cdot z\right) \cdot -9}, 2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) \]
      10. lower-*.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(t, \left(y \cdot z\right) \cdot -9, \color{blue}{\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)}\right) \]
      13. lower-*.f64N/A

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

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

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

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

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

        \[\leadsto \color{blue}{t \cdot \left(\left(y \cdot z\right) \cdot -9\right)} \]
      3. *-commutativeN/A

        \[\leadsto t \cdot \color{blue}{\left(-9 \cdot \left(y \cdot z\right)\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{t \cdot \left(-9 \cdot \left(y \cdot z\right)\right)} \]
      5. associate-*r*N/A

        \[\leadsto t \cdot \color{blue}{\left(\left(-9 \cdot y\right) \cdot z\right)} \]
      6. *-commutativeN/A

        \[\leadsto t \cdot \color{blue}{\left(z \cdot \left(-9 \cdot y\right)\right)} \]
      7. lower-*.f64N/A

        \[\leadsto t \cdot \color{blue}{\left(z \cdot \left(-9 \cdot y\right)\right)} \]
      8. lower-*.f6470.6

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

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

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

Alternative 6: 53.4% accurate, 0.5× speedup?

\[\begin{array}{l} [x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\ \\ \begin{array}{l} t_1 := t \cdot \left(z \cdot \left(y \cdot -9\right)\right)\\ t_2 := t \cdot \left(\left(y \cdot 9\right) \cdot z\right)\\ \mathbf{if}\;t\_2 \leq -5 \cdot 10^{+21}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-268}:\\ \;\;\;\;2 \cdot x\\ \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-24}:\\ \;\;\;\;a \cdot \left(27 \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
NOTE: x, y, z, t, 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 (* t (* z (* y -9.0)))) (t_2 (* t (* (* y 9.0) z))))
   (if (<= t_2 -5e+21)
     t_1
     (if (<= t_2 -1e-268)
       (* 2.0 x)
       (if (<= t_2 2e-24) (* a (* 27.0 b)) t_1)))))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = t * (z * (y * -9.0));
	double t_2 = t * ((y * 9.0) * z);
	double tmp;
	if (t_2 <= -5e+21) {
		tmp = t_1;
	} else if (t_2 <= -1e-268) {
		tmp = 2.0 * x;
	} else if (t_2 <= 2e-24) {
		tmp = a * (27.0 * b);
	} else {
		tmp = t_1;
	}
	return tmp;
}
NOTE: x, y, z, t, 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 = t * (z * (y * (-9.0d0)))
    t_2 = t * ((y * 9.0d0) * z)
    if (t_2 <= (-5d+21)) then
        tmp = t_1
    else if (t_2 <= (-1d-268)) then
        tmp = 2.0d0 * x
    else if (t_2 <= 2d-24) then
        tmp = a * (27.0d0 * b)
    else
        tmp = t_1
    end if
    code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = t * (z * (y * -9.0));
	double t_2 = t * ((y * 9.0) * z);
	double tmp;
	if (t_2 <= -5e+21) {
		tmp = t_1;
	} else if (t_2 <= -1e-268) {
		tmp = 2.0 * x;
	} else if (t_2 <= 2e-24) {
		tmp = a * (27.0 * b);
	} else {
		tmp = t_1;
	}
	return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b])
def code(x, y, z, t, a, b):
	t_1 = t * (z * (y * -9.0))
	t_2 = t * ((y * 9.0) * z)
	tmp = 0
	if t_2 <= -5e+21:
		tmp = t_1
	elif t_2 <= -1e-268:
		tmp = 2.0 * x
	elif t_2 <= 2e-24:
		tmp = a * (27.0 * b)
	else:
		tmp = t_1
	return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b])
function code(x, y, z, t, a, b)
	t_1 = Float64(t * Float64(z * Float64(y * -9.0)))
	t_2 = Float64(t * Float64(Float64(y * 9.0) * z))
	tmp = 0.0
	if (t_2 <= -5e+21)
		tmp = t_1;
	elseif (t_2 <= -1e-268)
		tmp = Float64(2.0 * x);
	elseif (t_2 <= 2e-24)
		tmp = Float64(a * Float64(27.0 * b));
	else
		tmp = t_1;
	end
	return tmp
end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = t * (z * (y * -9.0));
	t_2 = t * ((y * 9.0) * z);
	tmp = 0.0;
	if (t_2 <= -5e+21)
		tmp = t_1;
	elseif (t_2 <= -1e-268)
		tmp = 2.0 * x;
	elseif (t_2 <= 2e-24)
		tmp = a * (27.0 * b);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, t, 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[(t * N[(z * N[(y * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t * N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+21], t$95$1, If[LessEqual[t$95$2, -1e-268], N[(2.0 * x), $MachinePrecision], If[LessEqual[t$95$2, 2e-24], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := t \cdot \left(z \cdot \left(y \cdot -9\right)\right)\\
t_2 := t \cdot \left(\left(y \cdot 9\right) \cdot z\right)\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+21}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-268}:\\
\;\;\;\;2 \cdot x\\

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

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -5e21 or 1.99999999999999985e-24 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t)

    1. Initial program 90.3%

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

      \[\leadsto \color{blue}{\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) + \left(\mathsf{neg}\left(9\right)\right) \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
      2. metadata-evalN/A

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

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

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

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

        \[\leadsto t \cdot \color{blue}{\left(-9 \cdot \left(y \cdot z\right)\right)} + \left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) \]
      7. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\left(y \cdot z\right) \cdot -9}, 2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) \]
      10. lower-*.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(t, \left(y \cdot z\right) \cdot -9, \color{blue}{\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)}\right) \]
      13. lower-*.f64N/A

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

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

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

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

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

        \[\leadsto \color{blue}{t \cdot \left(\left(y \cdot z\right) \cdot -9\right)} \]
      3. *-commutativeN/A

        \[\leadsto t \cdot \color{blue}{\left(-9 \cdot \left(y \cdot z\right)\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{t \cdot \left(-9 \cdot \left(y \cdot z\right)\right)} \]
      5. associate-*r*N/A

        \[\leadsto t \cdot \color{blue}{\left(\left(-9 \cdot y\right) \cdot z\right)} \]
      6. *-commutativeN/A

        \[\leadsto t \cdot \color{blue}{\left(z \cdot \left(-9 \cdot y\right)\right)} \]
      7. lower-*.f64N/A

        \[\leadsto t \cdot \color{blue}{\left(z \cdot \left(-9 \cdot y\right)\right)} \]
      8. lower-*.f6466.9

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

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

    if -5e21 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -9.99999999999999958e-269

    1. Initial program 100.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. Add Preprocessing
    3. Taylor expanded in x around inf

      \[\leadsto \color{blue}{2 \cdot x} \]
    4. Step-by-step derivation
      1. lower-*.f6474.2

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

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

    if -9.99999999999999958e-269 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 1.99999999999999985e-24

    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. Add Preprocessing
    3. Taylor expanded in a around inf

      \[\leadsto \color{blue}{27 \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \color{blue}{a \cdot \left(b \cdot 27\right)} \]
      3. *-commutativeN/A

        \[\leadsto a \cdot \color{blue}{\left(27 \cdot b\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{a \cdot \left(27 \cdot b\right)} \]
      5. lower-*.f6457.3

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

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

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

Alternative 7: 85.5% accurate, 0.5× speedup?

\[\begin{array}{l} [x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\ \\ \begin{array}{l} t_1 := t \cdot \left(\left(y \cdot 9\right) \cdot z\right)\\ \mathbf{if}\;t\_1 \leq -5 \cdot 10^{+21}:\\ \;\;\;\;\mathsf{fma}\left(t, -9 \cdot \left(y \cdot z\right), a \cdot \left(27 \cdot b\right)\right)\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-24}:\\ \;\;\;\;\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y \cdot \left(-9 \cdot \left(z \cdot t\right)\right), 1, 27 \cdot \left(a \cdot b\right)\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, t, 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 (* t (* (* y 9.0) z))))
   (if (<= t_1 -5e+21)
     (fma t (* -9.0 (* y z)) (* a (* 27.0 b)))
     (if (<= t_1 2e-24)
       (fma 27.0 (* a b) (* 2.0 x))
       (fma (* y (* -9.0 (* z t))) 1.0 (* 27.0 (* a b)))))))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = t * ((y * 9.0) * z);
	double tmp;
	if (t_1 <= -5e+21) {
		tmp = fma(t, (-9.0 * (y * z)), (a * (27.0 * b)));
	} else if (t_1 <= 2e-24) {
		tmp = fma(27.0, (a * b), (2.0 * x));
	} else {
		tmp = fma((y * (-9.0 * (z * t))), 1.0, (27.0 * (a * b)));
	}
	return tmp;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b])
function code(x, y, z, t, a, b)
	t_1 = Float64(t * Float64(Float64(y * 9.0) * z))
	tmp = 0.0
	if (t_1 <= -5e+21)
		tmp = fma(t, Float64(-9.0 * Float64(y * z)), Float64(a * Float64(27.0 * b)));
	elseif (t_1 <= 2e-24)
		tmp = fma(27.0, Float64(a * b), Float64(2.0 * x));
	else
		tmp = fma(Float64(y * Float64(-9.0 * Float64(z * t))), 1.0, Float64(27.0 * Float64(a * b)));
	end
	return tmp
end
NOTE: x, y, z, t, 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[(t * N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+21], N[(t * N[(-9.0 * N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-24], N[(27.0 * N[(a * b), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(-9.0 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0 + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := t \cdot \left(\left(y \cdot 9\right) \cdot z\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+21}:\\
\;\;\;\;\mathsf{fma}\left(t, -9 \cdot \left(y \cdot z\right), a \cdot \left(27 \cdot b\right)\right)\\

\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-24}:\\
\;\;\;\;\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -5e21

    1. Initial program 88.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. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{27 \cdot \left(a \cdot b\right) - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{27 \cdot \left(a \cdot b\right) + \left(\mathsf{neg}\left(9\right)\right) \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
      2. metadata-evalN/A

        \[\leadsto 27 \cdot \left(a \cdot b\right) + \color{blue}{-9} \cdot \left(t \cdot \left(y \cdot z\right)\right) \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{-9 \cdot \left(t \cdot \left(y \cdot z\right)\right) + 27 \cdot \left(a \cdot b\right)} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\left(t \cdot \left(y \cdot z\right)\right) \cdot -9} + 27 \cdot \left(a \cdot b\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{t \cdot \left(\left(y \cdot z\right) \cdot -9\right)} + 27 \cdot \left(a \cdot b\right) \]
      6. *-commutativeN/A

        \[\leadsto t \cdot \color{blue}{\left(-9 \cdot \left(y \cdot z\right)\right)} + 27 \cdot \left(a \cdot b\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(t, -9 \cdot \left(y \cdot z\right), 27 \cdot \left(a \cdot b\right)\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\left(y \cdot z\right) \cdot -9}, 27 \cdot \left(a \cdot b\right)\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\left(y \cdot z\right) \cdot -9}, 27 \cdot \left(a \cdot b\right)\right) \]
      10. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\left(y \cdot z\right)} \cdot -9, 27 \cdot \left(a \cdot b\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(t, \left(y \cdot z\right) \cdot -9, \color{blue}{\left(a \cdot b\right) \cdot 27}\right) \]
      12. associate-*l*N/A

        \[\leadsto \mathsf{fma}\left(t, \left(y \cdot z\right) \cdot -9, \color{blue}{a \cdot \left(b \cdot 27\right)}\right) \]
      13. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(t, \left(y \cdot z\right) \cdot -9, a \cdot \color{blue}{\left(27 \cdot b\right)}\right) \]
      14. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(t, \left(y \cdot z\right) \cdot -9, \color{blue}{a \cdot \left(27 \cdot b\right)}\right) \]
      15. lower-*.f6479.7

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

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

    if -5e21 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 1.99999999999999985e-24

    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. Add Preprocessing
    3. Taylor expanded in y around 0

      \[\leadsto \color{blue}{2 \cdot x + 27 \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{27 \cdot \left(a \cdot b\right) + 2 \cdot x} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(27, \color{blue}{a \cdot b}, 2 \cdot x\right) \]
      4. lower-*.f6495.7

        \[\leadsto \mathsf{fma}\left(27, a \cdot b, \color{blue}{2 \cdot x}\right) \]
    5. Simplified95.7%

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

    if 1.99999999999999985e-24 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t)

    1. Initial program 92.3%

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

      \[\leadsto \color{blue}{\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) + \left(\mathsf{neg}\left(9\right)\right) \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
      2. metadata-evalN/A

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

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

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

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

        \[\leadsto t \cdot \color{blue}{\left(-9 \cdot \left(y \cdot z\right)\right)} + \left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) \]
      7. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\left(y \cdot z\right) \cdot -9}, 2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) \]
      10. lower-*.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(t, \left(y \cdot z\right) \cdot -9, \color{blue}{\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)}\right) \]
      13. lower-*.f64N/A

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

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

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

      \[\leadsto \color{blue}{-9 \cdot \left(t \cdot \left(y \cdot z\right)\right) + 27 \cdot \left(a \cdot b\right)} \]
    7. Step-by-step derivation
      1. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), 27 \cdot \left(a \cdot b\right)\right)} \]
      2. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-9, \color{blue}{t \cdot \left(y \cdot z\right)}, 27 \cdot \left(a \cdot b\right)\right) \]
      3. lower-*.f64N/A

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

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), \color{blue}{\left(27 \cdot a\right) \cdot b}\right) \]
      5. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), \color{blue}{\left(a \cdot 27\right)} \cdot b\right) \]
      6. associate-*r*N/A

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), \color{blue}{a \cdot \left(27 \cdot b\right)}\right) \]
      7. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), \color{blue}{a \cdot \left(27 \cdot b\right)}\right) \]
      8. lower-*.f6482.3

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

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

      \[\leadsto \mathsf{fma}\left(-9, \color{blue}{t \cdot \left(y \cdot z\right)}, a \cdot \left(27 \cdot b\right)\right) \]
    10. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \mathsf{fma}\left(-9, \color{blue}{y \cdot \left(z \cdot t\right)}, a \cdot \left(27 \cdot b\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-9, y \cdot \color{blue}{\left(t \cdot z\right)}, a \cdot \left(27 \cdot b\right)\right) \]
      4. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-9, \color{blue}{y \cdot \left(t \cdot z\right)}, a \cdot \left(27 \cdot b\right)\right) \]
      5. lower-*.f6485.3

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

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

      \[\leadsto \color{blue}{a \cdot \left(-9 \cdot \frac{t \cdot \left(y \cdot z\right)}{a} + 27 \cdot b\right)} \]
    13. Step-by-step derivation
      1. distribute-lft-inN/A

        \[\leadsto \color{blue}{a \cdot \left(-9 \cdot \frac{t \cdot \left(y \cdot z\right)}{a}\right) + a \cdot \left(27 \cdot b\right)} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\left(-9 \cdot \frac{t \cdot \left(y \cdot z\right)}{a}\right) \cdot a} + a \cdot \left(27 \cdot b\right) \]
      3. associate-*r*N/A

        \[\leadsto \left(-9 \cdot \frac{t \cdot \left(y \cdot z\right)}{a}\right) \cdot a + \color{blue}{\left(a \cdot 27\right) \cdot b} \]
      4. *-commutativeN/A

        \[\leadsto \left(-9 \cdot \frac{t \cdot \left(y \cdot z\right)}{a}\right) \cdot a + \color{blue}{\left(27 \cdot a\right)} \cdot b \]
      5. associate-*r*N/A

        \[\leadsto \left(-9 \cdot \frac{t \cdot \left(y \cdot z\right)}{a}\right) \cdot a + \color{blue}{27 \cdot \left(a \cdot b\right)} \]
      6. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{-9 \cdot \left(t \cdot \left(y \cdot z\right)\right)}{a}} \cdot a + 27 \cdot \left(a \cdot b\right) \]
      7. associate-*l/N/A

        \[\leadsto \color{blue}{\frac{\left(-9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\right) \cdot a}{a}} + 27 \cdot \left(a \cdot b\right) \]
      8. associate-/l*N/A

        \[\leadsto \color{blue}{\left(-9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\right) \cdot \frac{a}{a}} + 27 \cdot \left(a \cdot b\right) \]
      9. *-inversesN/A

        \[\leadsto \left(-9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\right) \cdot \color{blue}{1} + 27 \cdot \left(a \cdot b\right) \]
      10. metadata-evalN/A

        \[\leadsto \left(-9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\right) \cdot \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} + 27 \cdot \left(a \cdot b\right) \]
      11. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(-9 \cdot \left(t \cdot \left(y \cdot z\right)\right), \mathsf{neg}\left(-1\right), 27 \cdot \left(a \cdot b\right)\right)} \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-9 \cdot \left(t \cdot \color{blue}{\left(z \cdot y\right)}\right), \mathsf{neg}\left(-1\right), 27 \cdot \left(a \cdot b\right)\right) \]
      13. associate-*r*N/A

        \[\leadsto \mathsf{fma}\left(-9 \cdot \color{blue}{\left(\left(t \cdot z\right) \cdot y\right)}, \mathsf{neg}\left(-1\right), 27 \cdot \left(a \cdot b\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(-9 \cdot \left(t \cdot z\right)\right) \cdot y}, \mathsf{neg}\left(-1\right), 27 \cdot \left(a \cdot b\right)\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{y \cdot \left(-9 \cdot \left(t \cdot z\right)\right)}, \mathsf{neg}\left(-1\right), 27 \cdot \left(a \cdot b\right)\right) \]
      16. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{y \cdot \left(-9 \cdot \left(t \cdot z\right)\right)}, \mathsf{neg}\left(-1\right), 27 \cdot \left(a \cdot b\right)\right) \]
      17. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(y \cdot \color{blue}{\left(-9 \cdot \left(t \cdot z\right)\right)}, \mathsf{neg}\left(-1\right), 27 \cdot \left(a \cdot b\right)\right) \]
      18. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(y \cdot \left(-9 \cdot \color{blue}{\left(t \cdot z\right)}\right), \mathsf{neg}\left(-1\right), 27 \cdot \left(a \cdot b\right)\right) \]
      19. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(y \cdot \left(-9 \cdot \left(t \cdot z\right)\right), \color{blue}{1}, 27 \cdot \left(a \cdot b\right)\right) \]
      20. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(y \cdot \left(-9 \cdot \left(t \cdot z\right)\right), 1, \color{blue}{27 \cdot \left(a \cdot b\right)}\right) \]
      21. lower-*.f6485.3

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

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

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

Alternative 8: 85.5% accurate, 0.5× speedup?

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

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-24}:\\
\;\;\;\;\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -5e21

    1. Initial program 88.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. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{27 \cdot \left(a \cdot b\right) - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{27 \cdot \left(a \cdot b\right) + \left(\mathsf{neg}\left(9\right)\right) \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
      2. metadata-evalN/A

        \[\leadsto 27 \cdot \left(a \cdot b\right) + \color{blue}{-9} \cdot \left(t \cdot \left(y \cdot z\right)\right) \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{-9 \cdot \left(t \cdot \left(y \cdot z\right)\right) + 27 \cdot \left(a \cdot b\right)} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\left(t \cdot \left(y \cdot z\right)\right) \cdot -9} + 27 \cdot \left(a \cdot b\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{t \cdot \left(\left(y \cdot z\right) \cdot -9\right)} + 27 \cdot \left(a \cdot b\right) \]
      6. *-commutativeN/A

        \[\leadsto t \cdot \color{blue}{\left(-9 \cdot \left(y \cdot z\right)\right)} + 27 \cdot \left(a \cdot b\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(t, -9 \cdot \left(y \cdot z\right), 27 \cdot \left(a \cdot b\right)\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\left(y \cdot z\right) \cdot -9}, 27 \cdot \left(a \cdot b\right)\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\left(y \cdot z\right) \cdot -9}, 27 \cdot \left(a \cdot b\right)\right) \]
      10. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\left(y \cdot z\right)} \cdot -9, 27 \cdot \left(a \cdot b\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(t, \left(y \cdot z\right) \cdot -9, \color{blue}{\left(a \cdot b\right) \cdot 27}\right) \]
      12. associate-*l*N/A

        \[\leadsto \mathsf{fma}\left(t, \left(y \cdot z\right) \cdot -9, \color{blue}{a \cdot \left(b \cdot 27\right)}\right) \]
      13. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(t, \left(y \cdot z\right) \cdot -9, a \cdot \color{blue}{\left(27 \cdot b\right)}\right) \]
      14. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(t, \left(y \cdot z\right) \cdot -9, \color{blue}{a \cdot \left(27 \cdot b\right)}\right) \]
      15. lower-*.f6479.7

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

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

    if -5e21 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 1.99999999999999985e-24

    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. Add Preprocessing
    3. Taylor expanded in y around 0

      \[\leadsto \color{blue}{2 \cdot x + 27 \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{27 \cdot \left(a \cdot b\right) + 2 \cdot x} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(27, \color{blue}{a \cdot b}, 2 \cdot x\right) \]
      4. lower-*.f6495.7

        \[\leadsto \mathsf{fma}\left(27, a \cdot b, \color{blue}{2 \cdot x}\right) \]
    5. Simplified95.7%

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

    if 1.99999999999999985e-24 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t)

    1. Initial program 92.3%

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

      \[\leadsto \color{blue}{\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) + \left(\mathsf{neg}\left(9\right)\right) \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
      2. metadata-evalN/A

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

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

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

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

        \[\leadsto t \cdot \color{blue}{\left(-9 \cdot \left(y \cdot z\right)\right)} + \left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) \]
      7. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\left(y \cdot z\right) \cdot -9}, 2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) \]
      10. lower-*.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(t, \left(y \cdot z\right) \cdot -9, \color{blue}{\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)}\right) \]
      13. lower-*.f64N/A

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

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

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

      \[\leadsto \color{blue}{-9 \cdot \left(t \cdot \left(y \cdot z\right)\right) + 27 \cdot \left(a \cdot b\right)} \]
    7. Step-by-step derivation
      1. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), 27 \cdot \left(a \cdot b\right)\right)} \]
      2. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-9, \color{blue}{t \cdot \left(y \cdot z\right)}, 27 \cdot \left(a \cdot b\right)\right) \]
      3. lower-*.f64N/A

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

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), \color{blue}{\left(27 \cdot a\right) \cdot b}\right) \]
      5. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), \color{blue}{\left(a \cdot 27\right)} \cdot b\right) \]
      6. associate-*r*N/A

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), \color{blue}{a \cdot \left(27 \cdot b\right)}\right) \]
      7. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), \color{blue}{a \cdot \left(27 \cdot b\right)}\right) \]
      8. lower-*.f6482.3

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

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

      \[\leadsto \mathsf{fma}\left(-9, \color{blue}{t \cdot \left(y \cdot z\right)}, a \cdot \left(27 \cdot b\right)\right) \]
    10. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \mathsf{fma}\left(-9, \color{blue}{y \cdot \left(z \cdot t\right)}, a \cdot \left(27 \cdot b\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-9, y \cdot \color{blue}{\left(t \cdot z\right)}, a \cdot \left(27 \cdot b\right)\right) \]
      4. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-9, \color{blue}{y \cdot \left(t \cdot z\right)}, a \cdot \left(27 \cdot b\right)\right) \]
      5. lower-*.f6485.3

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

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

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

Alternative 9: 85.3% accurate, 0.5× speedup?

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

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-24}:\\
\;\;\;\;\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -5e21

    1. Initial program 88.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. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) + \left(\mathsf{neg}\left(9\right)\right) \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
      2. metadata-evalN/A

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

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

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

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

        \[\leadsto t \cdot \color{blue}{\left(-9 \cdot \left(y \cdot z\right)\right)} + \left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) \]
      7. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\left(y \cdot z\right) \cdot -9}, 2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) \]
      10. lower-*.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(t, \left(y \cdot z\right) \cdot -9, \color{blue}{\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)}\right) \]
      13. lower-*.f64N/A

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

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

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

      \[\leadsto \color{blue}{-9 \cdot \left(t \cdot \left(y \cdot z\right)\right) + 27 \cdot \left(a \cdot b\right)} \]
    7. Step-by-step derivation
      1. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), 27 \cdot \left(a \cdot b\right)\right)} \]
      2. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-9, \color{blue}{t \cdot \left(y \cdot z\right)}, 27 \cdot \left(a \cdot b\right)\right) \]
      3. lower-*.f64N/A

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

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), \color{blue}{\left(27 \cdot a\right) \cdot b}\right) \]
      5. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), \color{blue}{\left(a \cdot 27\right)} \cdot b\right) \]
      6. associate-*r*N/A

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), \color{blue}{a \cdot \left(27 \cdot b\right)}\right) \]
      7. lower-*.f64N/A

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

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

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

    if -5e21 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 1.99999999999999985e-24

    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. Add Preprocessing
    3. Taylor expanded in y around 0

      \[\leadsto \color{blue}{2 \cdot x + 27 \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{27 \cdot \left(a \cdot b\right) + 2 \cdot x} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(27, \color{blue}{a \cdot b}, 2 \cdot x\right) \]
      4. lower-*.f6495.7

        \[\leadsto \mathsf{fma}\left(27, a \cdot b, \color{blue}{2 \cdot x}\right) \]
    5. Simplified95.7%

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

    if 1.99999999999999985e-24 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t)

    1. Initial program 92.3%

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

      \[\leadsto \color{blue}{\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) + \left(\mathsf{neg}\left(9\right)\right) \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
      2. metadata-evalN/A

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

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

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

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

        \[\leadsto t \cdot \color{blue}{\left(-9 \cdot \left(y \cdot z\right)\right)} + \left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) \]
      7. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\left(y \cdot z\right) \cdot -9}, 2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) \]
      10. lower-*.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(t, \left(y \cdot z\right) \cdot -9, \color{blue}{\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)}\right) \]
      13. lower-*.f64N/A

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

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

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

      \[\leadsto \color{blue}{-9 \cdot \left(t \cdot \left(y \cdot z\right)\right) + 27 \cdot \left(a \cdot b\right)} \]
    7. Step-by-step derivation
      1. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), 27 \cdot \left(a \cdot b\right)\right)} \]
      2. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-9, \color{blue}{t \cdot \left(y \cdot z\right)}, 27 \cdot \left(a \cdot b\right)\right) \]
      3. lower-*.f64N/A

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

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), \color{blue}{\left(27 \cdot a\right) \cdot b}\right) \]
      5. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), \color{blue}{\left(a \cdot 27\right)} \cdot b\right) \]
      6. associate-*r*N/A

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), \color{blue}{a \cdot \left(27 \cdot b\right)}\right) \]
      7. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), \color{blue}{a \cdot \left(27 \cdot b\right)}\right) \]
      8. lower-*.f6482.3

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

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

      \[\leadsto \mathsf{fma}\left(-9, \color{blue}{t \cdot \left(y \cdot z\right)}, a \cdot \left(27 \cdot b\right)\right) \]
    10. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \mathsf{fma}\left(-9, \color{blue}{y \cdot \left(z \cdot t\right)}, a \cdot \left(27 \cdot b\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-9, y \cdot \color{blue}{\left(t \cdot z\right)}, a \cdot \left(27 \cdot b\right)\right) \]
      4. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-9, \color{blue}{y \cdot \left(t \cdot z\right)}, a \cdot \left(27 \cdot b\right)\right) \]
      5. lower-*.f6485.3

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

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

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

Alternative 10: 84.3% accurate, 0.6× speedup?

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

\mathbf{elif}\;t\_1 \leq 10^{-26}:\\
\;\;\;\;\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -9.99999999999999946e33

    1. Initial program 87.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. Add Preprocessing
    3. Taylor expanded in a around 0

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

        \[\leadsto \color{blue}{2 \cdot x + \left(\mathsf{neg}\left(9\right)\right) \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
      2. metadata-evalN/A

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\left(y \cdot z\right) \cdot -9}, 2 \cdot x\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\left(y \cdot z\right) \cdot -9}, 2 \cdot x\right) \]
      10. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\left(y \cdot z\right)} \cdot -9, 2 \cdot x\right) \]
      11. lower-*.f6474.3

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

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

    if -9.99999999999999946e33 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 1e-26

    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. Add Preprocessing
    3. Taylor expanded in y around 0

      \[\leadsto \color{blue}{2 \cdot x + 27 \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{27 \cdot \left(a \cdot b\right) + 2 \cdot x} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(27, \color{blue}{a \cdot b}, 2 \cdot x\right) \]
      4. lower-*.f6495.1

        \[\leadsto \mathsf{fma}\left(27, a \cdot b, \color{blue}{2 \cdot x}\right) \]
    5. Simplified95.1%

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

    if 1e-26 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t)

    1. Initial program 92.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{2 \cdot x + \left(\mathsf{neg}\left(9\right)\right) \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
      2. metadata-evalN/A

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot \left(-9 \cdot \left(t \cdot z\right)\right)} + 2 \cdot x \]
      8. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, -9 \cdot \left(t \cdot z\right), 2 \cdot x\right)} \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{-9 \cdot \left(t \cdot z\right)}, 2 \cdot x\right) \]
      10. lower-*.f64N/A

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

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

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

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

Alternative 11: 84.3% accurate, 0.6× speedup?

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

\mathbf{elif}\;t\_1 \leq 10^{-26}:\\
\;\;\;\;\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -9.99999999999999946e33

    1. Initial program 87.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. Add Preprocessing
    3. Taylor expanded in a around 0

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

        \[\leadsto \color{blue}{2 \cdot x + \left(\mathsf{neg}\left(9\right)\right) \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
      2. metadata-evalN/A

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\left(y \cdot z\right) \cdot -9}, 2 \cdot x\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\left(y \cdot z\right) \cdot -9}, 2 \cdot x\right) \]
      10. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\left(y \cdot z\right)} \cdot -9, 2 \cdot x\right) \]
      11. lower-*.f6474.3

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

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

    if -9.99999999999999946e33 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 1e-26

    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. Add Preprocessing
    3. Taylor expanded in y around 0

      \[\leadsto \color{blue}{2 \cdot x + 27 \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{27 \cdot \left(a \cdot b\right) + 2 \cdot x} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(27, \color{blue}{a \cdot b}, 2 \cdot x\right) \]
      4. lower-*.f6495.1

        \[\leadsto \mathsf{fma}\left(27, a \cdot b, \color{blue}{2 \cdot x}\right) \]
    5. Simplified95.1%

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

    if 1e-26 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t)

    1. Initial program 92.4%

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

      \[\leadsto \color{blue}{\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) + \left(\mathsf{neg}\left(9\right)\right) \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
      2. metadata-evalN/A

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

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

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

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

        \[\leadsto t \cdot \color{blue}{\left(-9 \cdot \left(y \cdot z\right)\right)} + \left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) \]
      7. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\left(y \cdot z\right) \cdot -9}, 2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) \]
      10. lower-*.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(t, \left(y \cdot z\right) \cdot -9, \color{blue}{\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)}\right) \]
      13. lower-*.f64N/A

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

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

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

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

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

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

        \[\leadsto t \cdot \color{blue}{\left(-9 \cdot \left(y \cdot z\right)\right)} + 2 \cdot x \]
      4. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(t, -9 \cdot \left(y \cdot z\right), 2 \cdot x\right)} \]
      5. associate-*r*N/A

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

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{z \cdot \left(-9 \cdot y\right)}, 2 \cdot x\right) \]
      7. lower-*.f64N/A

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

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

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

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

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

Alternative 12: 84.3% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\ \\ \begin{array}{l} t_1 := \mathsf{fma}\left(t, z \cdot \left(y \cdot -9\right), 2 \cdot x\right)\\ t_2 := t \cdot \left(\left(y \cdot 9\right) \cdot z\right)\\ \mathbf{if}\;t\_2 \leq -1 \cdot 10^{+34}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 10^{-26}:\\ \;\;\;\;\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
NOTE: x, y, z, t, 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 (fma t (* z (* y -9.0)) (* 2.0 x))) (t_2 (* t (* (* y 9.0) z))))
   (if (<= t_2 -1e+34)
     t_1
     (if (<= t_2 1e-26) (fma 27.0 (* a b) (* 2.0 x)) t_1))))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = fma(t, (z * (y * -9.0)), (2.0 * x));
	double t_2 = t * ((y * 9.0) * z);
	double tmp;
	if (t_2 <= -1e+34) {
		tmp = t_1;
	} else if (t_2 <= 1e-26) {
		tmp = fma(27.0, (a * b), (2.0 * x));
	} else {
		tmp = t_1;
	}
	return tmp;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b])
function code(x, y, z, t, a, b)
	t_1 = fma(t, Float64(z * Float64(y * -9.0)), Float64(2.0 * x))
	t_2 = Float64(t * Float64(Float64(y * 9.0) * z))
	tmp = 0.0
	if (t_2 <= -1e+34)
		tmp = t_1;
	elseif (t_2 <= 1e-26)
		tmp = fma(27.0, Float64(a * b), Float64(2.0 * x));
	else
		tmp = t_1;
	end
	return tmp
end
NOTE: x, y, z, t, 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[(t * N[(z * N[(y * -9.0), $MachinePrecision]), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t * N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+34], t$95$1, If[LessEqual[t$95$2, 1e-26], N[(27.0 * N[(a * b), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t, z \cdot \left(y \cdot -9\right), 2 \cdot x\right)\\
t_2 := t \cdot \left(\left(y \cdot 9\right) \cdot z\right)\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+34}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 10^{-26}:\\
\;\;\;\;\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -9.99999999999999946e33 or 1e-26 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t)

    1. Initial program 90.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. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) + \left(\mathsf{neg}\left(9\right)\right) \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
      2. metadata-evalN/A

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

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

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

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

        \[\leadsto t \cdot \color{blue}{\left(-9 \cdot \left(y \cdot z\right)\right)} + \left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) \]
      7. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\left(y \cdot z\right) \cdot -9}, 2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) \]
      10. lower-*.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(t, \left(y \cdot z\right) \cdot -9, \color{blue}{\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)}\right) \]
      13. lower-*.f64N/A

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

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

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

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

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

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

        \[\leadsto t \cdot \color{blue}{\left(-9 \cdot \left(y \cdot z\right)\right)} + 2 \cdot x \]
      4. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(t, -9 \cdot \left(y \cdot z\right), 2 \cdot x\right)} \]
      5. associate-*r*N/A

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

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{z \cdot \left(-9 \cdot y\right)}, 2 \cdot x\right) \]
      7. lower-*.f64N/A

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

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

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

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

    if -9.99999999999999946e33 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 1e-26

    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. Add Preprocessing
    3. Taylor expanded in y around 0

      \[\leadsto \color{blue}{2 \cdot x + 27 \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{27 \cdot \left(a \cdot b\right) + 2 \cdot x} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(27, \color{blue}{a \cdot b}, 2 \cdot x\right) \]
      4. lower-*.f6495.1

        \[\leadsto \mathsf{fma}\left(27, a \cdot b, \color{blue}{2 \cdot x}\right) \]
    5. Simplified95.1%

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

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

Alternative 13: 82.6% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\ \\ \begin{array}{l} t_1 := t \cdot \left(\left(y \cdot 9\right) \cdot z\right)\\ \mathbf{if}\;t\_1 \leq -1 \cdot 10^{+125}:\\ \;\;\;\;t \cdot \left(z \cdot \left(y \cdot -9\right)\right)\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+210}:\\ \;\;\;\;\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(-9 \cdot \left(z \cdot t\right)\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, t, 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 (* t (* (* y 9.0) z))))
   (if (<= t_1 -1e+125)
     (* t (* z (* y -9.0)))
     (if (<= t_1 5e+210)
       (fma 27.0 (* a b) (* 2.0 x))
       (* y (* -9.0 (* z t)))))))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = t * ((y * 9.0) * z);
	double tmp;
	if (t_1 <= -1e+125) {
		tmp = t * (z * (y * -9.0));
	} else if (t_1 <= 5e+210) {
		tmp = fma(27.0, (a * b), (2.0 * x));
	} else {
		tmp = y * (-9.0 * (z * t));
	}
	return tmp;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b])
function code(x, y, z, t, a, b)
	t_1 = Float64(t * Float64(Float64(y * 9.0) * z))
	tmp = 0.0
	if (t_1 <= -1e+125)
		tmp = Float64(t * Float64(z * Float64(y * -9.0)));
	elseif (t_1 <= 5e+210)
		tmp = fma(27.0, Float64(a * b), Float64(2.0 * x));
	else
		tmp = Float64(y * Float64(-9.0 * Float64(z * t)));
	end
	return tmp
end
NOTE: x, y, z, t, 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[(t * N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+125], N[(t * N[(z * N[(y * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+210], N[(27.0 * N[(a * b), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], N[(y * N[(-9.0 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := t \cdot \left(\left(y \cdot 9\right) \cdot z\right)\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+125}:\\
\;\;\;\;t \cdot \left(z \cdot \left(y \cdot -9\right)\right)\\

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+210}:\\
\;\;\;\;\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -9.9999999999999992e124

    1. Initial program 83.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. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) + \left(\mathsf{neg}\left(9\right)\right) \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
      2. metadata-evalN/A

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

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

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

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

        \[\leadsto t \cdot \color{blue}{\left(-9 \cdot \left(y \cdot z\right)\right)} + \left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) \]
      7. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\left(y \cdot z\right) \cdot -9}, 2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) \]
      10. lower-*.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(t, \left(y \cdot z\right) \cdot -9, \color{blue}{\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)}\right) \]
      13. lower-*.f64N/A

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

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

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

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

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

        \[\leadsto \color{blue}{t \cdot \left(\left(y \cdot z\right) \cdot -9\right)} \]
      3. *-commutativeN/A

        \[\leadsto t \cdot \color{blue}{\left(-9 \cdot \left(y \cdot z\right)\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{t \cdot \left(-9 \cdot \left(y \cdot z\right)\right)} \]
      5. associate-*r*N/A

        \[\leadsto t \cdot \color{blue}{\left(\left(-9 \cdot y\right) \cdot z\right)} \]
      6. *-commutativeN/A

        \[\leadsto t \cdot \color{blue}{\left(z \cdot \left(-9 \cdot y\right)\right)} \]
      7. lower-*.f64N/A

        \[\leadsto t \cdot \color{blue}{\left(z \cdot \left(-9 \cdot y\right)\right)} \]
      8. lower-*.f6469.6

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

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

    if -9.9999999999999992e124 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 4.9999999999999998e210

    1. Initial program 98.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. Add Preprocessing
    3. Taylor expanded in y around 0

      \[\leadsto \color{blue}{2 \cdot x + 27 \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{27 \cdot \left(a \cdot b\right) + 2 \cdot x} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(27, \color{blue}{a \cdot b}, 2 \cdot x\right) \]
      4. lower-*.f6485.8

        \[\leadsto \mathsf{fma}\left(27, a \cdot b, \color{blue}{2 \cdot x}\right) \]
    5. Simplified85.8%

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

    if 4.9999999999999998e210 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t)

    1. Initial program 87.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. Add Preprocessing
    3. Taylor expanded in y around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-9 \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
    13. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

        \[\leadsto \color{blue}{y \cdot \left(-9 \cdot \left(t \cdot z\right)\right)} \]
      5. lower-*.f64N/A

        \[\leadsto \color{blue}{y \cdot \left(-9 \cdot \left(t \cdot z\right)\right)} \]
      6. lower-*.f64N/A

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

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

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

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

Alternative 14: 97.8% accurate, 0.8× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 y #s(literal 9 binary64)) z) < 1.10000000000000005e262

    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. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) + \left(\mathsf{neg}\left(9\right)\right) \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
      2. metadata-evalN/A

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

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

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

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

        \[\leadsto t \cdot \color{blue}{\left(-9 \cdot \left(y \cdot z\right)\right)} + \left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) \]
      7. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\left(y \cdot z\right) \cdot -9}, 2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) \]
      10. lower-*.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(t, \left(y \cdot z\right) \cdot -9, \color{blue}{\mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)}\right) \]
      13. lower-*.f64N/A

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

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

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

    if 1.10000000000000005e262 < (*.f64 (*.f64 y #s(literal 9 binary64)) z)

    1. Initial program 83.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. Add Preprocessing
    3. Taylor expanded in y around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{2 \cdot x + \left(\mathsf{neg}\left(9\right)\right) \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
      2. metadata-evalN/A

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot \left(-9 \cdot \left(t \cdot z\right)\right)} + 2 \cdot x \]
      8. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, -9 \cdot \left(t \cdot z\right), 2 \cdot x\right)} \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{-9 \cdot \left(t \cdot z\right)}, 2 \cdot x\right) \]
      10. lower-*.f64N/A

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

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

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

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

Alternative 15: 53.7% accurate, 0.9× speedup?

\[\begin{array}{l} [x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\ \\ \begin{array}{l} t_1 := b \cdot \left(27 \cdot a\right)\\ \mathbf{if}\;t\_1 \leq -5 \cdot 10^{+25}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;t\_1 \leq 10^{+97}:\\ \;\;\;\;2 \cdot x\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(27 \cdot b\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, t, 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 (* 27.0 a))))
   (if (<= t_1 -5e+25)
     (* 27.0 (* a b))
     (if (<= t_1 1e+97) (* 2.0 x) (* a (* 27.0 b))))))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = b * (27.0 * a);
	double tmp;
	if (t_1 <= -5e+25) {
		tmp = 27.0 * (a * b);
	} else if (t_1 <= 1e+97) {
		tmp = 2.0 * x;
	} else {
		tmp = a * (27.0 * b);
	}
	return tmp;
}
NOTE: x, y, z, t, 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 * (27.0d0 * a)
    if (t_1 <= (-5d+25)) then
        tmp = 27.0d0 * (a * b)
    else if (t_1 <= 1d+97) then
        tmp = 2.0d0 * x
    else
        tmp = a * (27.0d0 * b)
    end if
    code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = b * (27.0 * a);
	double tmp;
	if (t_1 <= -5e+25) {
		tmp = 27.0 * (a * b);
	} else if (t_1 <= 1e+97) {
		tmp = 2.0 * x;
	} else {
		tmp = a * (27.0 * b);
	}
	return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b])
def code(x, y, z, t, a, b):
	t_1 = b * (27.0 * a)
	tmp = 0
	if t_1 <= -5e+25:
		tmp = 27.0 * (a * b)
	elif t_1 <= 1e+97:
		tmp = 2.0 * x
	else:
		tmp = a * (27.0 * b)
	return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b])
function code(x, y, z, t, a, b)
	t_1 = Float64(b * Float64(27.0 * a))
	tmp = 0.0
	if (t_1 <= -5e+25)
		tmp = Float64(27.0 * Float64(a * b));
	elseif (t_1 <= 1e+97)
		tmp = Float64(2.0 * x);
	else
		tmp = Float64(a * Float64(27.0 * b));
	end
	return tmp
end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = b * (27.0 * a);
	tmp = 0.0;
	if (t_1 <= -5e+25)
		tmp = 27.0 * (a * b);
	elseif (t_1 <= 1e+97)
		tmp = 2.0 * x;
	else
		tmp = a * (27.0 * b);
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, t, 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[(27.0 * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+25], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+97], N[(2.0 * x), $MachinePrecision], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := b \cdot \left(27 \cdot a\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+25}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\

\mathbf{elif}\;t\_1 \leq 10^{+97}:\\
\;\;\;\;2 \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 a #s(literal 27 binary64)) b) < -5.00000000000000024e25

    1. Initial program 92.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. Add Preprocessing
    3. Taylor expanded in y around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{27 \cdot \left(a \cdot b\right)} \]
    10. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{27 \cdot \left(a \cdot b\right)} \]
      2. lower-*.f6468.5

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

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

    if -5.00000000000000024e25 < (*.f64 (*.f64 a #s(literal 27 binary64)) b) < 1.0000000000000001e97

    1. Initial program 96.7%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf

      \[\leadsto \color{blue}{2 \cdot x} \]
    4. Step-by-step derivation
      1. lower-*.f6448.1

        \[\leadsto \color{blue}{2 \cdot x} \]
    5. Simplified48.1%

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

    if 1.0000000000000001e97 < (*.f64 (*.f64 a #s(literal 27 binary64)) b)

    1. Initial program 90.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. Add Preprocessing
    3. Taylor expanded in a around inf

      \[\leadsto \color{blue}{27 \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \color{blue}{a \cdot \left(b \cdot 27\right)} \]
      3. *-commutativeN/A

        \[\leadsto a \cdot \color{blue}{\left(27 \cdot b\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{a \cdot \left(27 \cdot b\right)} \]
      5. lower-*.f6477.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \cdot \left(27 \cdot a\right) \leq -5 \cdot 10^{+25}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;b \cdot \left(27 \cdot a\right) \leq 10^{+97}:\\ \;\;\;\;2 \cdot x\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(27 \cdot b\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 53.7% accurate, 0.9× speedup?

\[\begin{array}{l} [x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\ \\ \begin{array}{l} t_1 := b \cdot \left(27 \cdot a\right)\\ t_2 := 27 \cdot \left(a \cdot b\right)\\ \mathbf{if}\;t\_1 \leq -5 \cdot 10^{+25}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 10^{+97}:\\ \;\;\;\;2 \cdot x\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
NOTE: x, y, z, t, 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 (* 27.0 a))) (t_2 (* 27.0 (* a b))))
   (if (<= t_1 -5e+25) t_2 (if (<= t_1 1e+97) (* 2.0 x) t_2))))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = b * (27.0 * a);
	double t_2 = 27.0 * (a * b);
	double tmp;
	if (t_1 <= -5e+25) {
		tmp = t_2;
	} else if (t_1 <= 1e+97) {
		tmp = 2.0 * x;
	} else {
		tmp = t_2;
	}
	return tmp;
}
NOTE: x, y, z, t, 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 = b * (27.0d0 * a)
    t_2 = 27.0d0 * (a * b)
    if (t_1 <= (-5d+25)) then
        tmp = t_2
    else if (t_1 <= 1d+97) then
        tmp = 2.0d0 * x
    else
        tmp = t_2
    end if
    code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = b * (27.0 * a);
	double t_2 = 27.0 * (a * b);
	double tmp;
	if (t_1 <= -5e+25) {
		tmp = t_2;
	} else if (t_1 <= 1e+97) {
		tmp = 2.0 * x;
	} else {
		tmp = t_2;
	}
	return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b])
def code(x, y, z, t, a, b):
	t_1 = b * (27.0 * a)
	t_2 = 27.0 * (a * b)
	tmp = 0
	if t_1 <= -5e+25:
		tmp = t_2
	elif t_1 <= 1e+97:
		tmp = 2.0 * x
	else:
		tmp = t_2
	return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b])
function code(x, y, z, t, a, b)
	t_1 = Float64(b * Float64(27.0 * a))
	t_2 = Float64(27.0 * Float64(a * b))
	tmp = 0.0
	if (t_1 <= -5e+25)
		tmp = t_2;
	elseif (t_1 <= 1e+97)
		tmp = Float64(2.0 * x);
	else
		tmp = t_2;
	end
	return tmp
end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = b * (27.0 * a);
	t_2 = 27.0 * (a * b);
	tmp = 0.0;
	if (t_1 <= -5e+25)
		tmp = t_2;
	elseif (t_1 <= 1e+97)
		tmp = 2.0 * x;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, t, 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[(27.0 * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+25], t$95$2, If[LessEqual[t$95$1, 1e+97], N[(2.0 * x), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := b \cdot \left(27 \cdot a\right)\\
t_2 := 27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+25}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_1 \leq 10^{+97}:\\
\;\;\;\;2 \cdot x\\

\mathbf{else}:\\
\;\;\;\;t\_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 a #s(literal 27 binary64)) b) < -5.00000000000000024e25 or 1.0000000000000001e97 < (*.f64 (*.f64 a #s(literal 27 binary64)) b)

    1. Initial program 91.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{27 \cdot \left(a \cdot b\right)} \]
    10. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{27 \cdot \left(a \cdot b\right)} \]
      2. lower-*.f6472.9

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

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

    if -5.00000000000000024e25 < (*.f64 (*.f64 a #s(literal 27 binary64)) b) < 1.0000000000000001e97

    1. Initial program 96.7%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf

      \[\leadsto \color{blue}{2 \cdot x} \]
    4. Step-by-step derivation
      1. lower-*.f6448.1

        \[\leadsto \color{blue}{2 \cdot x} \]
    5. Simplified48.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \cdot \left(27 \cdot a\right) \leq -5 \cdot 10^{+25}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;b \cdot \left(27 \cdot a\right) \leq 10^{+97}:\\ \;\;\;\;2 \cdot x\\ \mathbf{else}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 31.8% accurate, 6.2× speedup?

\[\begin{array}{l} [x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\ \\ 2 \cdot x \end{array} \]
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b) :precision binary64 (* 2.0 x))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
	return 2.0 * x;
}
NOTE: x, y, z, t, 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 = 2.0d0 * x
end function
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
	return 2.0 * x;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b])
def code(x, y, z, t, a, b):
	return 2.0 * x
x, y, z, t, a, b = sort([x, y, z, t, a, b])
function code(x, y, z, t, a, b)
	return Float64(2.0 * x)
end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp = code(x, y, z, t, a, b)
	tmp = 2.0 * x;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := N[(2.0 * x), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
2 \cdot x
\end{array}
Derivation
  1. Initial program 94.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. Add Preprocessing
  3. Taylor expanded in x around inf

    \[\leadsto \color{blue}{2 \cdot x} \]
  4. Step-by-step derivation
    1. lower-*.f6431.4

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

    \[\leadsto \color{blue}{2 \cdot x} \]
  6. Add Preprocessing

Developer Target 1: 95.1% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}

Reproduce

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

  :alt
  (! :herbie-platform default (if (< y 7590524218811189/100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (- (* x 2) (* (* (* y 9) z) t)) (* a (* 27 b))) (+ (- (* x 2) (* 9 (* y (* t z)))) (* (* a 27) b))))

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