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

Percentage Accurate: 85.6% → 90.1%
Time: 26.2s
Alternatives: 4
Speedup: N/A×

Specification

?
\[\begin{array}{l} \\ \left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \end{array} \]
(FPCore (x y z t a b c i j k)
 :precision binary64
 (-
  (-
   (+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c))
   (* (* x 4.0) i))
  (* (* j 27.0) k)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
	return (((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - ((j * 27.0) * k);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a, b, c, i, j, k)
use fmin_fmax_functions
    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), intent (in) :: c
    real(8), intent (in) :: i
    real(8), intent (in) :: j
    real(8), intent (in) :: k
    code = (((((((x * 18.0d0) * y) * z) * t) - ((a * 4.0d0) * t)) + (b * c)) - ((x * 4.0d0) * i)) - ((j * 27.0d0) * k)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
	return (((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - ((j * 27.0) * k);
}
def code(x, y, z, t, a, b, c, i, j, k):
	return (((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - ((j * 27.0) * k)
function code(x, y, z, t, a, b, c, i, j, k)
	return Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(x * 18.0) * y) * z) * t) - Float64(Float64(a * 4.0) * t)) + Float64(b * c)) - Float64(Float64(x * 4.0) * i)) - Float64(Float64(j * 27.0) * k))
end
function tmp = code(x, y, z, t, a, b, c, i, j, k)
	tmp = (((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - ((j * 27.0) * k);
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := N[(N[(N[(N[(N[(N[(N[(N[(x * 18.0), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision] - N[(N[(a * 4.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(b * c), $MachinePrecision]), $MachinePrecision] - N[(N[(x * 4.0), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] - N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k
\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 4 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: 85.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \end{array} \]
(FPCore (x y z t a b c i j k)
 :precision binary64
 (-
  (-
   (+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c))
   (* (* x 4.0) i))
  (* (* j 27.0) k)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
	return (((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - ((j * 27.0) * k);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a, b, c, i, j, k)
use fmin_fmax_functions
    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), intent (in) :: c
    real(8), intent (in) :: i
    real(8), intent (in) :: j
    real(8), intent (in) :: k
    code = (((((((x * 18.0d0) * y) * z) * t) - ((a * 4.0d0) * t)) + (b * c)) - ((x * 4.0d0) * i)) - ((j * 27.0d0) * k)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
	return (((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - ((j * 27.0) * k);
}
def code(x, y, z, t, a, b, c, i, j, k):
	return (((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - ((j * 27.0) * k)
function code(x, y, z, t, a, b, c, i, j, k)
	return Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(x * 18.0) * y) * z) * t) - Float64(Float64(a * 4.0) * t)) + Float64(b * c)) - Float64(Float64(x * 4.0) * i)) - Float64(Float64(j * 27.0) * k))
end
function tmp = code(x, y, z, t, a, b, c, i, j, k)
	tmp = (((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - ((j * 27.0) * k);
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := N[(N[(N[(N[(N[(N[(N[(N[(x * 18.0), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision] - N[(N[(a * 4.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(b * c), $MachinePrecision]), $MachinePrecision] - N[(N[(x * 4.0), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] - N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k
\end{array}

Alternative 1: 90.1% accurate, N/A× speedup?

\[\begin{array}{l} [x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\\\ [x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\ \\ \begin{array}{l} t_1 := \left(x \cdot 4\right) \cdot i\\ t_2 := \left(j \cdot 27\right) \cdot k\\ t_3 := \left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - t\_1\right) - t\_2\\ \mathbf{if}\;t\_3 \leq -5 \cdot 10^{+183}:\\ \;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(18 \cdot t, z \cdot y, -4 \cdot i\right), x, c \cdot b\right) - \left(a \cdot t\right) \cdot 4\right) - t\_2\\ \mathbf{elif}\;t\_3 \leq \infty:\\ \;\;\;\;\left(\left(\mathsf{fma}\left(\left(18 \cdot x\right) \cdot y, z \cdot t, \left(\left(-4\right) \cdot a\right) \cdot t\right) + b \cdot c\right) - t\_1\right) - t\_2\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-18, \left(z \cdot y\right) \cdot t, i \cdot 4\right) \cdot \left(-x\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i j k)
 :precision binary64
 (let* ((t_1 (* (* x 4.0) i))
        (t_2 (* (* j 27.0) k))
        (t_3
         (-
          (- (+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c)) t_1)
          t_2)))
   (if (<= t_3 -5e+183)
     (-
      (- (fma (fma (* 18.0 t) (* z y) (* -4.0 i)) x (* c b)) (* (* a t) 4.0))
      t_2)
     (if (<= t_3 INFINITY)
       (-
        (- (+ (fma (* (* 18.0 x) y) (* z t) (* (* (- 4.0) a) t)) (* b c)) t_1)
        t_2)
       (* (fma -18.0 (* (* z y) t) (* i 4.0)) (- x))))))
assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k);
assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k);
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
	double t_1 = (x * 4.0) * i;
	double t_2 = (j * 27.0) * k;
	double t_3 = (((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - t_1) - t_2;
	double tmp;
	if (t_3 <= -5e+183) {
		tmp = (fma(fma((18.0 * t), (z * y), (-4.0 * i)), x, (c * b)) - ((a * t) * 4.0)) - t_2;
	} else if (t_3 <= ((double) INFINITY)) {
		tmp = ((fma(((18.0 * x) * y), (z * t), ((-4.0 * a) * t)) + (b * c)) - t_1) - t_2;
	} else {
		tmp = fma(-18.0, ((z * y) * t), (i * 4.0)) * -x;
	}
	return tmp;
}
x, y, z, t, a, b, c, i, j, k = sort([x, y, z, t, a, b, c, i, j, k])
x, y, z, t, a, b, c, i, j, k = sort([x, y, z, t, a, b, c, i, j, k])
function code(x, y, z, t, a, b, c, i, j, k)
	t_1 = Float64(Float64(x * 4.0) * i)
	t_2 = Float64(Float64(j * 27.0) * k)
	t_3 = Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(x * 18.0) * y) * z) * t) - Float64(Float64(a * 4.0) * t)) + Float64(b * c)) - t_1) - t_2)
	tmp = 0.0
	if (t_3 <= -5e+183)
		tmp = Float64(Float64(fma(fma(Float64(18.0 * t), Float64(z * y), Float64(-4.0 * i)), x, Float64(c * b)) - Float64(Float64(a * t) * 4.0)) - t_2);
	elseif (t_3 <= Inf)
		tmp = Float64(Float64(Float64(fma(Float64(Float64(18.0 * x) * y), Float64(z * t), Float64(Float64(Float64(-4.0) * a) * t)) + Float64(b * c)) - t_1) - t_2);
	else
		tmp = Float64(fma(-18.0, Float64(Float64(z * y) * t), Float64(i * 4.0)) * Float64(-x));
	end
	return tmp
end
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(N[(x * 4.0), $MachinePrecision] * i), $MachinePrecision]}, Block[{t$95$2 = N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(N[(N[(N[(N[(N[(x * 18.0), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision] - N[(N[(a * 4.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(b * c), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision] - t$95$2), $MachinePrecision]}, If[LessEqual[t$95$3, -5e+183], N[(N[(N[(N[(N[(18.0 * t), $MachinePrecision] * N[(z * y), $MachinePrecision] + N[(-4.0 * i), $MachinePrecision]), $MachinePrecision] * x + N[(c * b), $MachinePrecision]), $MachinePrecision] - N[(N[(a * t), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision], If[LessEqual[t$95$3, Infinity], N[(N[(N[(N[(N[(N[(18.0 * x), $MachinePrecision] * y), $MachinePrecision] * N[(z * t), $MachinePrecision] + N[(N[((-4.0) * a), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(b * c), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision] - t$95$2), $MachinePrecision], N[(N[(-18.0 * N[(N[(z * y), $MachinePrecision] * t), $MachinePrecision] + N[(i * 4.0), $MachinePrecision]), $MachinePrecision] * (-x)), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\\\
[x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\
\\
\begin{array}{l}
t_1 := \left(x \cdot 4\right) \cdot i\\
t_2 := \left(j \cdot 27\right) \cdot k\\
t_3 := \left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - t\_1\right) - t\_2\\
\mathbf{if}\;t\_3 \leq -5 \cdot 10^{+183}:\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(18 \cdot t, z \cdot y, -4 \cdot i\right), x, c \cdot b\right) - \left(a \cdot t\right) \cdot 4\right) - t\_2\\

\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(\left(18 \cdot x\right) \cdot y, z \cdot t, \left(\left(-4\right) \cdot a\right) \cdot t\right) + b \cdot c\right) - t\_1\right) - t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 (-.f64 (+.f64 (-.f64 (*.f64 (*.f64 (*.f64 (*.f64 x #s(literal 18 binary64)) y) z) t) (*.f64 (*.f64 a #s(literal 4 binary64)) t)) (*.f64 b c)) (*.f64 (*.f64 x #s(literal 4 binary64)) i)) (*.f64 (*.f64 j #s(literal 27 binary64)) k)) < -5.00000000000000009e183

    1. Initial program 91.1%

      \[\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\left(\left(b \cdot c + x \cdot \left(18 \cdot \left(t \cdot \left(y \cdot z\right)\right) - 4 \cdot i\right)\right) - 4 \cdot \left(a \cdot t\right)\right)} - \left(j \cdot 27\right) \cdot k \]
    4. Step-by-step derivation
      1. lower--.f64N/A

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

        \[\leadsto \left(\left(x \cdot \left(18 \cdot \left(t \cdot \left(y \cdot z\right)\right) - 4 \cdot i\right) + b \cdot c\right) - \color{blue}{4} \cdot \left(a \cdot t\right)\right) - \left(j \cdot 27\right) \cdot k \]
      3. *-commutativeN/A

        \[\leadsto \left(\left(\left(18 \cdot \left(t \cdot \left(y \cdot z\right)\right) - 4 \cdot i\right) \cdot x + b \cdot c\right) - 4 \cdot \left(a \cdot t\right)\right) - \left(j \cdot 27\right) \cdot k \]
      4. lower-fma.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(18 \cdot \left(t \cdot \left(y \cdot z\right)\right) - 4 \cdot i, x, b \cdot c\right) - \color{blue}{4} \cdot \left(a \cdot t\right)\right) - \left(j \cdot 27\right) \cdot k \]
      5. fp-cancel-sub-sign-invN/A

        \[\leadsto \left(\mathsf{fma}\left(18 \cdot \left(t \cdot \left(y \cdot z\right)\right) + \left(\mathsf{neg}\left(4\right)\right) \cdot i, x, b \cdot c\right) - 4 \cdot \left(a \cdot t\right)\right) - \left(j \cdot 27\right) \cdot k \]
      6. associate-*r*N/A

        \[\leadsto \left(\mathsf{fma}\left(\left(18 \cdot t\right) \cdot \left(y \cdot z\right) + \left(\mathsf{neg}\left(4\right)\right) \cdot i, x, b \cdot c\right) - 4 \cdot \left(a \cdot t\right)\right) - \left(j \cdot 27\right) \cdot k \]
      7. metadata-evalN/A

        \[\leadsto \left(\mathsf{fma}\left(\left(18 \cdot t\right) \cdot \left(y \cdot z\right) + -4 \cdot i, x, b \cdot c\right) - 4 \cdot \left(a \cdot t\right)\right) - \left(j \cdot 27\right) \cdot k \]
      8. lower-fma.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(18 \cdot t, y \cdot z, -4 \cdot i\right), x, b \cdot c\right) - 4 \cdot \left(a \cdot t\right)\right) - \left(j \cdot 27\right) \cdot k \]
      9. lower-*.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(18 \cdot t, y \cdot z, -4 \cdot i\right), x, b \cdot c\right) - 4 \cdot \left(a \cdot t\right)\right) - \left(j \cdot 27\right) \cdot k \]
      10. *-commutativeN/A

        \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(18 \cdot t, z \cdot y, -4 \cdot i\right), x, b \cdot c\right) - 4 \cdot \left(a \cdot t\right)\right) - \left(j \cdot 27\right) \cdot k \]
      11. lower-*.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(18 \cdot t, z \cdot y, -4 \cdot i\right), x, b \cdot c\right) - 4 \cdot \left(a \cdot t\right)\right) - \left(j \cdot 27\right) \cdot k \]
      12. lower-*.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(18 \cdot t, z \cdot y, -4 \cdot i\right), x, b \cdot c\right) - 4 \cdot \left(a \cdot t\right)\right) - \left(j \cdot 27\right) \cdot k \]
      13. *-commutativeN/A

        \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(18 \cdot t, z \cdot y, -4 \cdot i\right), x, c \cdot b\right) - 4 \cdot \left(a \cdot t\right)\right) - \left(j \cdot 27\right) \cdot k \]
      14. lower-*.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(18 \cdot t, z \cdot y, -4 \cdot i\right), x, c \cdot b\right) - 4 \cdot \left(a \cdot t\right)\right) - \left(j \cdot 27\right) \cdot k \]
      15. *-commutativeN/A

        \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(18 \cdot t, z \cdot y, -4 \cdot i\right), x, c \cdot b\right) - \left(a \cdot t\right) \cdot \color{blue}{4}\right) - \left(j \cdot 27\right) \cdot k \]
      16. lower-*.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(18 \cdot t, z \cdot y, -4 \cdot i\right), x, c \cdot b\right) - \left(a \cdot t\right) \cdot \color{blue}{4}\right) - \left(j \cdot 27\right) \cdot k \]
    5. Applied rewrites98.6%

      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(\mathsf{fma}\left(18 \cdot t, z \cdot y, -4 \cdot i\right), x, c \cdot b\right) - \left(a \cdot t\right) \cdot 4\right)} - \left(j \cdot 27\right) \cdot k \]

    if -5.00000000000000009e183 < (-.f64 (-.f64 (+.f64 (-.f64 (*.f64 (*.f64 (*.f64 (*.f64 x #s(literal 18 binary64)) y) z) t) (*.f64 (*.f64 a #s(literal 4 binary64)) t)) (*.f64 b c)) (*.f64 (*.f64 x #s(literal 4 binary64)) i)) (*.f64 (*.f64 j #s(literal 27 binary64)) k)) < +inf.0

    1. Initial program 94.7%

      \[\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \left(\left(\color{blue}{\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right)} + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \]
      2. lift-*.f64N/A

        \[\leadsto \left(\left(\left(\color{blue}{\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t} - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \]
      3. lift-*.f64N/A

        \[\leadsto \left(\left(\left(\color{blue}{\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right)} \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \]
      4. lift-*.f64N/A

        \[\leadsto \left(\left(\left(\left(\left(\color{blue}{\left(x \cdot 18\right)} \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \]
      5. lift-*.f64N/A

        \[\leadsto \left(\left(\left(\left(\color{blue}{\left(\left(x \cdot 18\right) \cdot y\right)} \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \]
      6. lift-*.f64N/A

        \[\leadsto \left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \color{blue}{\left(a \cdot 4\right)} \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \]
      7. lift-*.f64N/A

        \[\leadsto \left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \color{blue}{\left(a \cdot 4\right) \cdot t}\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \]
      8. fp-cancel-sub-sign-invN/A

        \[\leadsto \left(\left(\color{blue}{\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t + \left(\mathsf{neg}\left(a \cdot 4\right)\right) \cdot t\right)} + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \]
      9. associate-*l*N/A

        \[\leadsto \left(\left(\left(\color{blue}{\left(\left(x \cdot 18\right) \cdot y\right) \cdot \left(z \cdot t\right)} + \left(\mathsf{neg}\left(a \cdot 4\right)\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \]
      10. lower-fma.f64N/A

        \[\leadsto \left(\left(\color{blue}{\mathsf{fma}\left(\left(x \cdot 18\right) \cdot y, z \cdot t, \left(\mathsf{neg}\left(a \cdot 4\right)\right) \cdot t\right)} + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \]
      11. lift-*.f64N/A

        \[\leadsto \left(\left(\mathsf{fma}\left(\color{blue}{\left(x \cdot 18\right) \cdot y}, z \cdot t, \left(\mathsf{neg}\left(a \cdot 4\right)\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \]
      12. *-commutativeN/A

        \[\leadsto \left(\left(\mathsf{fma}\left(\color{blue}{\left(18 \cdot x\right)} \cdot y, z \cdot t, \left(\mathsf{neg}\left(a \cdot 4\right)\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \]
      13. lower-*.f64N/A

        \[\leadsto \left(\left(\mathsf{fma}\left(\color{blue}{\left(18 \cdot x\right)} \cdot y, z \cdot t, \left(\mathsf{neg}\left(a \cdot 4\right)\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \]
      14. lower-*.f64N/A

        \[\leadsto \left(\left(\mathsf{fma}\left(\left(18 \cdot x\right) \cdot y, \color{blue}{z \cdot t}, \left(\mathsf{neg}\left(a \cdot 4\right)\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \]
      15. lower-*.f64N/A

        \[\leadsto \left(\left(\mathsf{fma}\left(\left(18 \cdot x\right) \cdot y, z \cdot t, \color{blue}{\left(\mathsf{neg}\left(a \cdot 4\right)\right) \cdot t}\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \]
      16. *-commutativeN/A

        \[\leadsto \left(\left(\mathsf{fma}\left(\left(18 \cdot x\right) \cdot y, z \cdot t, \left(\mathsf{neg}\left(\color{blue}{4 \cdot a}\right)\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \]
      17. lower-neg.f64N/A

        \[\leadsto \left(\left(\mathsf{fma}\left(\left(18 \cdot x\right) \cdot y, z \cdot t, \color{blue}{\left(-4 \cdot a\right)} \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \]
      18. lower-*.f6495.4

        \[\leadsto \left(\left(\mathsf{fma}\left(\left(18 \cdot x\right) \cdot y, z \cdot t, \left(-\color{blue}{4 \cdot a}\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \]
    4. Applied rewrites95.4%

      \[\leadsto \left(\left(\color{blue}{\mathsf{fma}\left(\left(18 \cdot x\right) \cdot y, z \cdot t, \left(-4 \cdot a\right) \cdot t\right)} + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \]

    if +inf.0 < (-.f64 (-.f64 (+.f64 (-.f64 (*.f64 (*.f64 (*.f64 (*.f64 x #s(literal 18 binary64)) y) z) t) (*.f64 (*.f64 a #s(literal 4 binary64)) t)) (*.f64 b c)) (*.f64 (*.f64 x #s(literal 4 binary64)) i)) (*.f64 (*.f64 j #s(literal 27 binary64)) k))

    1. Initial program 0.0%

      \[\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \]
    2. Add Preprocessing
    3. Taylor expanded in x around -inf

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(-18 \cdot \left(t \cdot \left(y \cdot z\right)\right) - -4 \cdot i\right)\right)} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(x \cdot \left(-18 \cdot \left(t \cdot \left(y \cdot z\right)\right) - -4 \cdot i\right)\right) \]
      2. lower-neg.f64N/A

        \[\leadsto -x \cdot \left(-18 \cdot \left(t \cdot \left(y \cdot z\right)\right) - -4 \cdot i\right) \]
      3. *-commutativeN/A

        \[\leadsto -\left(-18 \cdot \left(t \cdot \left(y \cdot z\right)\right) - -4 \cdot i\right) \cdot x \]
      4. lower-*.f64N/A

        \[\leadsto -\left(-18 \cdot \left(t \cdot \left(y \cdot z\right)\right) - -4 \cdot i\right) \cdot x \]
      5. fp-cancel-sub-sign-invN/A

        \[\leadsto -\left(-18 \cdot \left(t \cdot \left(y \cdot z\right)\right) + \left(\mathsf{neg}\left(-4\right)\right) \cdot i\right) \cdot x \]
      6. metadata-evalN/A

        \[\leadsto -\left(-18 \cdot \left(t \cdot \left(y \cdot z\right)\right) + 4 \cdot i\right) \cdot x \]
      7. lower-fma.f64N/A

        \[\leadsto -\mathsf{fma}\left(-18, t \cdot \left(y \cdot z\right), 4 \cdot i\right) \cdot x \]
      8. *-commutativeN/A

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

        \[\leadsto -\mathsf{fma}\left(-18, \left(y \cdot z\right) \cdot t, 4 \cdot i\right) \cdot x \]
      10. *-commutativeN/A

        \[\leadsto -\mathsf{fma}\left(-18, \left(z \cdot y\right) \cdot t, 4 \cdot i\right) \cdot x \]
      11. lower-*.f64N/A

        \[\leadsto -\mathsf{fma}\left(-18, \left(z \cdot y\right) \cdot t, 4 \cdot i\right) \cdot x \]
      12. *-commutativeN/A

        \[\leadsto -\mathsf{fma}\left(-18, \left(z \cdot y\right) \cdot t, i \cdot 4\right) \cdot x \]
      13. lower-*.f6462.1

        \[\leadsto -\mathsf{fma}\left(-18, \left(z \cdot y\right) \cdot t, i \cdot 4\right) \cdot x \]
    5. Applied rewrites62.1%

      \[\leadsto \color{blue}{-\mathsf{fma}\left(-18, \left(z \cdot y\right) \cdot t, i \cdot 4\right) \cdot x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification92.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \leq -5 \cdot 10^{+183}:\\ \;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(18 \cdot t, z \cdot y, -4 \cdot i\right), x, c \cdot b\right) - \left(a \cdot t\right) \cdot 4\right) - \left(j \cdot 27\right) \cdot k\\ \mathbf{elif}\;\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \leq \infty:\\ \;\;\;\;\left(\left(\mathsf{fma}\left(\left(18 \cdot x\right) \cdot y, z \cdot t, \left(\left(-4\right) \cdot a\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-18, \left(z \cdot y\right) \cdot t, i \cdot 4\right) \cdot \left(-x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 90.4% accurate, N/A× speedup?

\[\begin{array}{l} [x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\\\ [x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq 7 \cdot 10^{+108}:\\ \;\;\;\;\mathsf{fma}\left(-4 \cdot i, x, \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, \mathsf{fma}\left(-27 \cdot j, k, \mathsf{fma}\left(a \cdot t, -4, c \cdot b\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\mathsf{fma}\left(\frac{a \cdot t}{z}, -4, \left(\left(y \cdot x\right) \cdot t\right) \cdot 18\right) \cdot z + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - j \cdot \left(k \cdot 27\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i j k)
 :precision binary64
 (if (<= z 7e+108)
   (fma
    (* -4.0 i)
    x
    (fma
     (* 18.0 t)
     (* (* z y) x)
     (fma (* -27.0 j) k (fma (* a t) -4.0 (* c b)))))
   (-
    (-
     (+ (* (fma (/ (* a t) z) -4.0 (* (* (* y x) t) 18.0)) z) (* b c))
     (* (* x 4.0) i))
    (* j (* k 27.0)))))
assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k);
assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k);
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
	double tmp;
	if (z <= 7e+108) {
		tmp = fma((-4.0 * i), x, fma((18.0 * t), ((z * y) * x), fma((-27.0 * j), k, fma((a * t), -4.0, (c * b)))));
	} else {
		tmp = (((fma(((a * t) / z), -4.0, (((y * x) * t) * 18.0)) * z) + (b * c)) - ((x * 4.0) * i)) - (j * (k * 27.0));
	}
	return tmp;
}
x, y, z, t, a, b, c, i, j, k = sort([x, y, z, t, a, b, c, i, j, k])
x, y, z, t, a, b, c, i, j, k = sort([x, y, z, t, a, b, c, i, j, k])
function code(x, y, z, t, a, b, c, i, j, k)
	tmp = 0.0
	if (z <= 7e+108)
		tmp = fma(Float64(-4.0 * i), x, fma(Float64(18.0 * t), Float64(Float64(z * y) * x), fma(Float64(-27.0 * j), k, fma(Float64(a * t), -4.0, Float64(c * b)))));
	else
		tmp = Float64(Float64(Float64(Float64(fma(Float64(Float64(a * t) / z), -4.0, Float64(Float64(Float64(y * x) * t) * 18.0)) * z) + Float64(b * c)) - Float64(Float64(x * 4.0) * i)) - Float64(j * Float64(k * 27.0)));
	end
	return tmp
end
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := If[LessEqual[z, 7e+108], N[(N[(-4.0 * i), $MachinePrecision] * x + N[(N[(18.0 * t), $MachinePrecision] * N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision] + N[(N[(-27.0 * j), $MachinePrecision] * k + N[(N[(a * t), $MachinePrecision] * -4.0 + N[(c * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(N[(N[(a * t), $MachinePrecision] / z), $MachinePrecision] * -4.0 + N[(N[(N[(y * x), $MachinePrecision] * t), $MachinePrecision] * 18.0), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision] + N[(b * c), $MachinePrecision]), $MachinePrecision] - N[(N[(x * 4.0), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] - N[(j * N[(k * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\\\
[x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 7 \cdot 10^{+108}:\\
\;\;\;\;\mathsf{fma}\left(-4 \cdot i, x, \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, \mathsf{fma}\left(-27 \cdot j, k, \mathsf{fma}\left(a \cdot t, -4, c \cdot b\right)\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(\frac{a \cdot t}{z}, -4, \left(\left(y \cdot x\right) \cdot t\right) \cdot 18\right) \cdot z + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - j \cdot \left(k \cdot 27\right)\\


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

    1. Initial program 81.3%

      \[\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \]
    2. Add Preprocessing
    3. Taylor expanded in i around 0

      \[\leadsto \color{blue}{\left(-4 \cdot \left(i \cdot x\right) + \left(18 \cdot \left(t \cdot \left(x \cdot \left(y \cdot z\right)\right)\right) + b \cdot c\right)\right) - \left(4 \cdot \left(a \cdot t\right) + 27 \cdot \left(j \cdot k\right)\right)} \]
    4. Step-by-step derivation
      1. associate--l+N/A

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

        \[\leadsto \left(-4 \cdot i\right) \cdot x + \left(\color{blue}{\left(18 \cdot \left(t \cdot \left(x \cdot \left(y \cdot z\right)\right)\right) + b \cdot c\right)} - \left(4 \cdot \left(a \cdot t\right) + 27 \cdot \left(j \cdot k\right)\right)\right) \]
      3. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(-4 \cdot i, \color{blue}{x}, \left(18 \cdot \left(t \cdot \left(x \cdot \left(y \cdot z\right)\right)\right) + b \cdot c\right) - \left(4 \cdot \left(a \cdot t\right) + 27 \cdot \left(j \cdot k\right)\right)\right) \]
      4. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-4 \cdot i, x, \left(18 \cdot \left(t \cdot \left(x \cdot \left(y \cdot z\right)\right)\right) + b \cdot c\right) - \left(4 \cdot \left(a \cdot t\right) + 27 \cdot \left(j \cdot k\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{fma}\left(-4 \cdot i, x, 18 \cdot \left(t \cdot \left(x \cdot \left(y \cdot z\right)\right)\right) + \left(b \cdot c - \left(4 \cdot \left(a \cdot t\right) + 27 \cdot \left(j \cdot k\right)\right)\right)\right) \]
      6. associate-*r*N/A

        \[\leadsto \mathsf{fma}\left(-4 \cdot i, x, \left(18 \cdot t\right) \cdot \left(x \cdot \left(y \cdot z\right)\right) + \left(b \cdot c - \left(4 \cdot \left(a \cdot t\right) + 27 \cdot \left(j \cdot k\right)\right)\right)\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(-4 \cdot i, x, \mathsf{fma}\left(18 \cdot t, x \cdot \left(y \cdot z\right), b \cdot c - \left(4 \cdot \left(a \cdot t\right) + 27 \cdot \left(j \cdot k\right)\right)\right)\right) \]
    5. Applied rewrites86.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-4 \cdot i, x, \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, c \cdot b - \mathsf{fma}\left(k \cdot j, 27, \left(a \cdot t\right) \cdot 4\right)\right)\right)} \]
    6. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(-4 \cdot i, x, \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, c \cdot b - \mathsf{fma}\left(k \cdot j, 27, \left(a \cdot t\right) \cdot 4\right)\right)\right) \]
      2. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-4 \cdot i, x, \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, c \cdot b - \mathsf{fma}\left(k \cdot j, 27, \left(a \cdot t\right) \cdot 4\right)\right)\right) \]
      3. lift-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(-4 \cdot i, x, \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, c \cdot b - \left(\left(k \cdot j\right) \cdot 27 + \left(a \cdot t\right) \cdot 4\right)\right)\right) \]
      4. associate--r+N/A

        \[\leadsto \mathsf{fma}\left(-4 \cdot i, x, \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, \left(c \cdot b - \left(k \cdot j\right) \cdot 27\right) - \left(a \cdot t\right) \cdot 4\right)\right) \]
      5. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-4 \cdot i, x, \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, \left(c \cdot b - \left(k \cdot j\right) \cdot 27\right) - \left(a \cdot t\right) \cdot 4\right)\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-4 \cdot i, x, \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, \left(b \cdot c - \left(k \cdot j\right) \cdot 27\right) - \left(a \cdot t\right) \cdot 4\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-4 \cdot i, x, \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, \left(b \cdot c - 27 \cdot \left(k \cdot j\right)\right) - \left(a \cdot t\right) \cdot 4\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-4 \cdot i, x, \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, \left(b \cdot c - 27 \cdot \left(j \cdot k\right)\right) - \left(a \cdot t\right) \cdot 4\right)\right) \]
      9. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(-4 \cdot i, x, \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, \left(b \cdot c + \left(\mathsf{neg}\left(27\right)\right) \cdot \left(j \cdot k\right)\right) - \left(a \cdot t\right) \cdot 4\right)\right) \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(-4 \cdot i, x, \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, \left(b \cdot c + -27 \cdot \left(j \cdot k\right)\right) - \left(a \cdot t\right) \cdot 4\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-4 \cdot i, x, \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, \left(-27 \cdot \left(j \cdot k\right) + b \cdot c\right) - \left(a \cdot t\right) \cdot 4\right)\right) \]
      12. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-4 \cdot i, x, \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, \left(-27 \cdot \left(j \cdot k\right) + b \cdot c\right) - \left(a \cdot t\right) \cdot 4\right)\right) \]
      13. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-4 \cdot i, x, \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, \left(-27 \cdot \left(j \cdot k\right) + b \cdot c\right) - \left(a \cdot t\right) \cdot 4\right)\right) \]
      14. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-4 \cdot i, x, \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, \left(-27 \cdot \left(j \cdot k\right) + b \cdot c\right) - 4 \cdot \left(a \cdot t\right)\right)\right) \]
      15. associate--l+N/A

        \[\leadsto \mathsf{fma}\left(-4 \cdot i, x, \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, -27 \cdot \left(j \cdot k\right) + \left(b \cdot c - 4 \cdot \left(a \cdot t\right)\right)\right)\right) \]
      16. associate-*r*N/A

        \[\leadsto \mathsf{fma}\left(-4 \cdot i, x, \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, \left(-27 \cdot j\right) \cdot k + \left(b \cdot c - 4 \cdot \left(a \cdot t\right)\right)\right)\right) \]
      17. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(-4 \cdot i, x, \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, \mathsf{fma}\left(-27 \cdot j, k, b \cdot c - 4 \cdot \left(a \cdot t\right)\right)\right)\right) \]
      18. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-4 \cdot i, x, \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, \mathsf{fma}\left(-27 \cdot j, k, b \cdot c - 4 \cdot \left(a \cdot t\right)\right)\right)\right) \]
      19. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(-4 \cdot i, x, \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, \mathsf{fma}\left(-27 \cdot j, k, b \cdot c + \left(\mathsf{neg}\left(4\right)\right) \cdot \left(a \cdot t\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(-4 \cdot i, x, \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, \mathsf{fma}\left(-27 \cdot j, k, b \cdot c + -4 \cdot \left(a \cdot t\right)\right)\right)\right) \]
    7. Applied rewrites88.2%

      \[\leadsto \mathsf{fma}\left(-4 \cdot i, x, \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, \mathsf{fma}\left(-27 \cdot j, k, \mathsf{fma}\left(a \cdot t, -4, c \cdot b\right)\right)\right)\right) \]

    if 7.0000000000000005e108 < z

    1. Initial program 79.7%

      \[\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \color{blue}{\left(j \cdot 27\right) \cdot k} \]
      2. lift-*.f64N/A

        \[\leadsto \left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \color{blue}{\left(j \cdot 27\right)} \cdot k \]
      3. associate-*l*N/A

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

        \[\leadsto \left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \color{blue}{j \cdot \left(27 \cdot k\right)} \]
      5. *-commutativeN/A

        \[\leadsto \left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - j \cdot \color{blue}{\left(k \cdot 27\right)} \]
      6. lower-*.f6479.7

        \[\leadsto \left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - j \cdot \color{blue}{\left(k \cdot 27\right)} \]
    4. Applied rewrites79.7%

      \[\leadsto \left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \color{blue}{j \cdot \left(k \cdot 27\right)} \]
    5. Taylor expanded in z around inf

      \[\leadsto \left(\left(\color{blue}{z \cdot \left(-4 \cdot \frac{a \cdot t}{z} + 18 \cdot \left(t \cdot \left(x \cdot y\right)\right)\right)} + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - j \cdot \left(k \cdot 27\right) \]
    6. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \left(\left(\left(-4 \cdot \frac{a \cdot t}{z} + 18 \cdot \left(t \cdot \left(x \cdot y\right)\right)\right) \cdot \color{blue}{z} + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - j \cdot \left(k \cdot 27\right) \]
      3. *-commutativeN/A

        \[\leadsto \left(\left(\left(\frac{a \cdot t}{z} \cdot -4 + 18 \cdot \left(t \cdot \left(x \cdot y\right)\right)\right) \cdot z + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - j \cdot \left(k \cdot 27\right) \]
      4. lower-fma.f64N/A

        \[\leadsto \left(\left(\mathsf{fma}\left(\frac{a \cdot t}{z}, -4, 18 \cdot \left(t \cdot \left(x \cdot y\right)\right)\right) \cdot z + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - j \cdot \left(k \cdot 27\right) \]
      5. lower-/.f64N/A

        \[\leadsto \left(\left(\mathsf{fma}\left(\frac{a \cdot t}{z}, -4, 18 \cdot \left(t \cdot \left(x \cdot y\right)\right)\right) \cdot z + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - j \cdot \left(k \cdot 27\right) \]
      6. lift-*.f64N/A

        \[\leadsto \left(\left(\mathsf{fma}\left(\frac{a \cdot t}{z}, -4, 18 \cdot \left(t \cdot \left(x \cdot y\right)\right)\right) \cdot z + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - j \cdot \left(k \cdot 27\right) \]
      7. *-commutativeN/A

        \[\leadsto \left(\left(\mathsf{fma}\left(\frac{a \cdot t}{z}, -4, \left(t \cdot \left(x \cdot y\right)\right) \cdot 18\right) \cdot z + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - j \cdot \left(k \cdot 27\right) \]
      8. lower-*.f64N/A

        \[\leadsto \left(\left(\mathsf{fma}\left(\frac{a \cdot t}{z}, -4, \left(t \cdot \left(x \cdot y\right)\right) \cdot 18\right) \cdot z + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - j \cdot \left(k \cdot 27\right) \]
      9. *-commutativeN/A

        \[\leadsto \left(\left(\mathsf{fma}\left(\frac{a \cdot t}{z}, -4, \left(\left(x \cdot y\right) \cdot t\right) \cdot 18\right) \cdot z + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - j \cdot \left(k \cdot 27\right) \]
      10. lower-*.f64N/A

        \[\leadsto \left(\left(\mathsf{fma}\left(\frac{a \cdot t}{z}, -4, \left(\left(x \cdot y\right) \cdot t\right) \cdot 18\right) \cdot z + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - j \cdot \left(k \cdot 27\right) \]
      11. *-commutativeN/A

        \[\leadsto \left(\left(\mathsf{fma}\left(\frac{a \cdot t}{z}, -4, \left(\left(y \cdot x\right) \cdot t\right) \cdot 18\right) \cdot z + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - j \cdot \left(k \cdot 27\right) \]
      12. lower-*.f6487.3

        \[\leadsto \left(\left(\mathsf{fma}\left(\frac{a \cdot t}{z}, -4, \left(\left(y \cdot x\right) \cdot t\right) \cdot 18\right) \cdot z + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - j \cdot \left(k \cdot 27\right) \]
    7. Applied rewrites87.3%

      \[\leadsto \left(\left(\color{blue}{\mathsf{fma}\left(\frac{a \cdot t}{z}, -4, \left(\left(y \cdot x\right) \cdot t\right) \cdot 18\right) \cdot z} + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - j \cdot \left(k \cdot 27\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 91.3% accurate, N/A× speedup?

\[\begin{array}{l} [x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\\\ [x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\ \\ \begin{array}{l} \mathbf{if}\;\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i \leq \infty:\\ \;\;\;\;\mathsf{fma}\left(-27 \cdot j, k, \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, c \cdot b - 4 \cdot \mathsf{fma}\left(a, t, i \cdot x\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-18, \left(z \cdot y\right) \cdot t, i \cdot 4\right) \cdot \left(-x\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i j k)
 :precision binary64
 (if (<=
      (-
       (+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c))
       (* (* x 4.0) i))
      INFINITY)
   (fma
    (* -27.0 j)
    k
    (fma (* 18.0 t) (* (* z y) x) (- (* c b) (* 4.0 (fma a t (* i x))))))
   (* (fma -18.0 (* (* z y) t) (* i 4.0)) (- x))))
assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k);
assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k);
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
	double tmp;
	if ((((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) <= ((double) INFINITY)) {
		tmp = fma((-27.0 * j), k, fma((18.0 * t), ((z * y) * x), ((c * b) - (4.0 * fma(a, t, (i * x))))));
	} else {
		tmp = fma(-18.0, ((z * y) * t), (i * 4.0)) * -x;
	}
	return tmp;
}
x, y, z, t, a, b, c, i, j, k = sort([x, y, z, t, a, b, c, i, j, k])
x, y, z, t, a, b, c, i, j, k = sort([x, y, z, t, a, b, c, i, j, k])
function code(x, y, z, t, a, b, c, i, j, k)
	tmp = 0.0
	if (Float64(Float64(Float64(Float64(Float64(Float64(Float64(x * 18.0) * y) * z) * t) - Float64(Float64(a * 4.0) * t)) + Float64(b * c)) - Float64(Float64(x * 4.0) * i)) <= Inf)
		tmp = fma(Float64(-27.0 * j), k, fma(Float64(18.0 * t), Float64(Float64(z * y) * x), Float64(Float64(c * b) - Float64(4.0 * fma(a, t, Float64(i * x))))));
	else
		tmp = Float64(fma(-18.0, Float64(Float64(z * y) * t), Float64(i * 4.0)) * Float64(-x));
	end
	return tmp
end
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := If[LessEqual[N[(N[(N[(N[(N[(N[(N[(x * 18.0), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision] - N[(N[(a * 4.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(b * c), $MachinePrecision]), $MachinePrecision] - N[(N[(x * 4.0), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(-27.0 * j), $MachinePrecision] * k + N[(N[(18.0 * t), $MachinePrecision] * N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision] + N[(N[(c * b), $MachinePrecision] - N[(4.0 * N[(a * t + N[(i * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-18.0 * N[(N[(z * y), $MachinePrecision] * t), $MachinePrecision] + N[(i * 4.0), $MachinePrecision]), $MachinePrecision] * (-x)), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\\\
[x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\
\\
\begin{array}{l}
\mathbf{if}\;\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(-27 \cdot j, k, \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, c \cdot b - 4 \cdot \mathsf{fma}\left(a, t, i \cdot x\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (+.f64 (-.f64 (*.f64 (*.f64 (*.f64 (*.f64 x #s(literal 18 binary64)) y) z) t) (*.f64 (*.f64 a #s(literal 4 binary64)) t)) (*.f64 b c)) (*.f64 (*.f64 x #s(literal 4 binary64)) i)) < +inf.0

    1. Initial program 90.6%

      \[\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \]
    2. Add Preprocessing
    3. Taylor expanded in j around 0

      \[\leadsto \color{blue}{\left(-27 \cdot \left(j \cdot k\right) + \left(18 \cdot \left(t \cdot \left(x \cdot \left(y \cdot z\right)\right)\right) + b \cdot c\right)\right) - \left(4 \cdot \left(a \cdot t\right) + 4 \cdot \left(i \cdot x\right)\right)} \]
    4. Step-by-step derivation
      1. associate--l+N/A

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

        \[\leadsto \left(-27 \cdot j\right) \cdot k + \left(\color{blue}{\left(18 \cdot \left(t \cdot \left(x \cdot \left(y \cdot z\right)\right)\right) + b \cdot c\right)} - \left(4 \cdot \left(a \cdot t\right) + 4 \cdot \left(i \cdot x\right)\right)\right) \]
      3. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(-27 \cdot j, \color{blue}{k}, \left(18 \cdot \left(t \cdot \left(x \cdot \left(y \cdot z\right)\right)\right) + b \cdot c\right) - \left(4 \cdot \left(a \cdot t\right) + 4 \cdot \left(i \cdot x\right)\right)\right) \]
      4. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-27 \cdot j, k, \left(18 \cdot \left(t \cdot \left(x \cdot \left(y \cdot z\right)\right)\right) + b \cdot c\right) - \left(4 \cdot \left(a \cdot t\right) + 4 \cdot \left(i \cdot x\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{fma}\left(-27 \cdot j, k, 18 \cdot \left(t \cdot \left(x \cdot \left(y \cdot z\right)\right)\right) + \left(b \cdot c - \left(4 \cdot \left(a \cdot t\right) + 4 \cdot \left(i \cdot x\right)\right)\right)\right) \]
      6. associate-*r*N/A

        \[\leadsto \mathsf{fma}\left(-27 \cdot j, k, \left(18 \cdot t\right) \cdot \left(x \cdot \left(y \cdot z\right)\right) + \left(b \cdot c - \left(4 \cdot \left(a \cdot t\right) + 4 \cdot \left(i \cdot x\right)\right)\right)\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(-27 \cdot j, k, \mathsf{fma}\left(18 \cdot t, x \cdot \left(y \cdot z\right), b \cdot c - \left(4 \cdot \left(a \cdot t\right) + 4 \cdot \left(i \cdot x\right)\right)\right)\right) \]
    5. Applied rewrites93.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-27 \cdot j, k, \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, c \cdot b - 4 \cdot \mathsf{fma}\left(a, t, i \cdot x\right)\right)\right)} \]

    if +inf.0 < (-.f64 (+.f64 (-.f64 (*.f64 (*.f64 (*.f64 (*.f64 x #s(literal 18 binary64)) y) z) t) (*.f64 (*.f64 a #s(literal 4 binary64)) t)) (*.f64 b c)) (*.f64 (*.f64 x #s(literal 4 binary64)) i))

    1. Initial program 0.0%

      \[\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \]
    2. Add Preprocessing
    3. Taylor expanded in x around -inf

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(-18 \cdot \left(t \cdot \left(y \cdot z\right)\right) - -4 \cdot i\right)\right)} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(x \cdot \left(-18 \cdot \left(t \cdot \left(y \cdot z\right)\right) - -4 \cdot i\right)\right) \]
      2. lower-neg.f64N/A

        \[\leadsto -x \cdot \left(-18 \cdot \left(t \cdot \left(y \cdot z\right)\right) - -4 \cdot i\right) \]
      3. *-commutativeN/A

        \[\leadsto -\left(-18 \cdot \left(t \cdot \left(y \cdot z\right)\right) - -4 \cdot i\right) \cdot x \]
      4. lower-*.f64N/A

        \[\leadsto -\left(-18 \cdot \left(t \cdot \left(y \cdot z\right)\right) - -4 \cdot i\right) \cdot x \]
      5. fp-cancel-sub-sign-invN/A

        \[\leadsto -\left(-18 \cdot \left(t \cdot \left(y \cdot z\right)\right) + \left(\mathsf{neg}\left(-4\right)\right) \cdot i\right) \cdot x \]
      6. metadata-evalN/A

        \[\leadsto -\left(-18 \cdot \left(t \cdot \left(y \cdot z\right)\right) + 4 \cdot i\right) \cdot x \]
      7. lower-fma.f64N/A

        \[\leadsto -\mathsf{fma}\left(-18, t \cdot \left(y \cdot z\right), 4 \cdot i\right) \cdot x \]
      8. *-commutativeN/A

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

        \[\leadsto -\mathsf{fma}\left(-18, \left(y \cdot z\right) \cdot t, 4 \cdot i\right) \cdot x \]
      10. *-commutativeN/A

        \[\leadsto -\mathsf{fma}\left(-18, \left(z \cdot y\right) \cdot t, 4 \cdot i\right) \cdot x \]
      11. lower-*.f64N/A

        \[\leadsto -\mathsf{fma}\left(-18, \left(z \cdot y\right) \cdot t, 4 \cdot i\right) \cdot x \]
      12. *-commutativeN/A

        \[\leadsto -\mathsf{fma}\left(-18, \left(z \cdot y\right) \cdot t, i \cdot 4\right) \cdot x \]
      13. lower-*.f6463.2

        \[\leadsto -\mathsf{fma}\left(-18, \left(z \cdot y\right) \cdot t, i \cdot 4\right) \cdot x \]
    5. Applied rewrites63.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i \leq \infty:\\ \;\;\;\;\mathsf{fma}\left(-27 \cdot j, k, \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, c \cdot b - 4 \cdot \mathsf{fma}\left(a, t, i \cdot x\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-18, \left(z \cdot y\right) \cdot t, i \cdot 4\right) \cdot \left(-x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 41.7% accurate, N/A× speedup?

\[\begin{array}{l} [x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\\\ [x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\ \\ \mathsf{fma}\left(-18, \left(z \cdot y\right) \cdot t, i \cdot 4\right) \cdot \left(-x\right) \end{array} \]
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i j k)
 :precision binary64
 (* (fma -18.0 (* (* z y) t) (* i 4.0)) (- x)))
assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k);
assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k);
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
	return fma(-18.0, ((z * y) * t), (i * 4.0)) * -x;
}
x, y, z, t, a, b, c, i, j, k = sort([x, y, z, t, a, b, c, i, j, k])
x, y, z, t, a, b, c, i, j, k = sort([x, y, z, t, a, b, c, i, j, k])
function code(x, y, z, t, a, b, c, i, j, k)
	return Float64(fma(-18.0, Float64(Float64(z * y) * t), Float64(i * 4.0)) * Float64(-x))
end
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := N[(N[(-18.0 * N[(N[(z * y), $MachinePrecision] * t), $MachinePrecision] + N[(i * 4.0), $MachinePrecision]), $MachinePrecision] * (-x)), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\\\
[x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\
\\
\mathsf{fma}\left(-18, \left(z \cdot y\right) \cdot t, i \cdot 4\right) \cdot \left(-x\right)
\end{array}
Derivation
  1. Initial program 81.1%

    \[\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k \]
  2. Add Preprocessing
  3. Taylor expanded in x around -inf

    \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(-18 \cdot \left(t \cdot \left(y \cdot z\right)\right) - -4 \cdot i\right)\right)} \]
  4. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto \mathsf{neg}\left(x \cdot \left(-18 \cdot \left(t \cdot \left(y \cdot z\right)\right) - -4 \cdot i\right)\right) \]
    2. lower-neg.f64N/A

      \[\leadsto -x \cdot \left(-18 \cdot \left(t \cdot \left(y \cdot z\right)\right) - -4 \cdot i\right) \]
    3. *-commutativeN/A

      \[\leadsto -\left(-18 \cdot \left(t \cdot \left(y \cdot z\right)\right) - -4 \cdot i\right) \cdot x \]
    4. lower-*.f64N/A

      \[\leadsto -\left(-18 \cdot \left(t \cdot \left(y \cdot z\right)\right) - -4 \cdot i\right) \cdot x \]
    5. fp-cancel-sub-sign-invN/A

      \[\leadsto -\left(-18 \cdot \left(t \cdot \left(y \cdot z\right)\right) + \left(\mathsf{neg}\left(-4\right)\right) \cdot i\right) \cdot x \]
    6. metadata-evalN/A

      \[\leadsto -\left(-18 \cdot \left(t \cdot \left(y \cdot z\right)\right) + 4 \cdot i\right) \cdot x \]
    7. lower-fma.f64N/A

      \[\leadsto -\mathsf{fma}\left(-18, t \cdot \left(y \cdot z\right), 4 \cdot i\right) \cdot x \]
    8. *-commutativeN/A

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

      \[\leadsto -\mathsf{fma}\left(-18, \left(y \cdot z\right) \cdot t, 4 \cdot i\right) \cdot x \]
    10. *-commutativeN/A

      \[\leadsto -\mathsf{fma}\left(-18, \left(z \cdot y\right) \cdot t, 4 \cdot i\right) \cdot x \]
    11. lower-*.f64N/A

      \[\leadsto -\mathsf{fma}\left(-18, \left(z \cdot y\right) \cdot t, 4 \cdot i\right) \cdot x \]
    12. *-commutativeN/A

      \[\leadsto -\mathsf{fma}\left(-18, \left(z \cdot y\right) \cdot t, i \cdot 4\right) \cdot x \]
    13. lower-*.f6445.3

      \[\leadsto -\mathsf{fma}\left(-18, \left(z \cdot y\right) \cdot t, i \cdot 4\right) \cdot x \]
  5. Applied rewrites45.3%

    \[\leadsto \color{blue}{-\mathsf{fma}\left(-18, \left(z \cdot y\right) \cdot t, i \cdot 4\right) \cdot x} \]
  6. Final simplification45.3%

    \[\leadsto \mathsf{fma}\left(-18, \left(z \cdot y\right) \cdot t, i \cdot 4\right) \cdot \left(-x\right) \]
  7. Add Preprocessing

Reproduce

?
herbie shell --seed 2025057 
(FPCore (x y z t a b c i j k)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, E"
  :precision binary64

  :alt
  (! :herbie-platform default (if (< t -8105407698770699/5000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (- (* (* 18 t) (* (* x y) z)) (* (+ (* a t) (* i x)) 4)) (- (* (* k j) 27) (* c b))) (if (< t 8284013971902611/50000000000000) (+ (- (* (* 18 y) (* x (* z t))) (* (+ (* a t) (* i x)) 4)) (- (* c b) (* 27 (* k j)))) (- (- (* (* 18 t) (* (* x y) z)) (* (+ (* a t) (* i x)) 4)) (- (* (* k j) 27) (* c b))))))

  (- (- (+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c)) (* (* x 4.0) i)) (* (* j 27.0) k)))