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

Percentage Accurate: 85.2% → 91.5%
Time: 4.9s
Alternatives: 15
Speedup: 0.6×

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

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

Initial Program: 85.2% 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: 91.5% accurate, 0.6× 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])\\ \\ \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 \cdot t, z \cdot y, -4 \cdot i\right) \cdot x\\ \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.
(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 t) (* z y) (* -4.0 i)) x)))
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 * t), (z * y), (-4.0 * i)) * x;
	}
	return tmp;
}
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(Float64(18.0 * t), Float64(z * y), Float64(-4.0 * i)) * 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.
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[(N[(18.0 * t), $MachinePrecision] * N[(z * y), $MachinePrecision] + N[(-4.0 * i), $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])\\
\\
\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 \cdot t, z \cdot y, -4 \cdot i\right) \cdot x\\


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

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

      \[\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}{x \cdot \left(18 \cdot \left(t \cdot \left(y \cdot z\right)\right) - 4 \cdot i\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \left(18 \cdot \left(t \cdot \left(y \cdot z\right)\right) - 4 \cdot i\right) \cdot \color{blue}{x} \]
      3. 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 \]
      4. associate-*r*N/A

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

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

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

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

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

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

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

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

Alternative 2: 85.6% accurate, 0.3× 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])\\ \\ \begin{array}{l} t_1 := \mathsf{fma}\left(a, t, i \cdot x\right)\\ t_2 := \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, c \cdot b - 4 \cdot t\_1\right)\\ t_3 := \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\\ \mathbf{if}\;t\_3 \leq -5 \cdot 10^{+86}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_3 \leq 2 \cdot 10^{+304}:\\ \;\;\;\;c \cdot b - \mathsf{fma}\left(4, t\_1, \left(k \cdot j\right) \cdot 27\right)\\ \mathbf{elif}\;t\_3 \leq \infty:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(18 \cdot t, z \cdot y, -4 \cdot i\right) \cdot x\\ \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.
(FPCore (x y z t a b c i j k)
 :precision binary64
 (let* ((t_1 (fma a t (* i x)))
        (t_2 (fma (* 18.0 t) (* (* z y) x) (- (* c b) (* 4.0 t_1))))
        (t_3
         (-
          (+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c))
          (* (* x 4.0) i))))
   (if (<= t_3 -5e+86)
     t_2
     (if (<= t_3 2e+304)
       (- (* c b) (fma 4.0 t_1 (* (* k j) 27.0)))
       (if (<= t_3 INFINITY) t_2 (* (fma (* 18.0 t) (* z y) (* -4.0 i)) x))))))
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 = fma(a, t, (i * x));
	double t_2 = fma((18.0 * t), ((z * y) * x), ((c * b) - (4.0 * t_1)));
	double t_3 = ((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i);
	double tmp;
	if (t_3 <= -5e+86) {
		tmp = t_2;
	} else if (t_3 <= 2e+304) {
		tmp = (c * b) - fma(4.0, t_1, ((k * j) * 27.0));
	} else if (t_3 <= ((double) INFINITY)) {
		tmp = t_2;
	} else {
		tmp = fma((18.0 * t), (z * y), (-4.0 * i)) * x;
	}
	return tmp;
}
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 = fma(a, t, Float64(i * x))
	t_2 = fma(Float64(18.0 * t), Float64(Float64(z * y) * x), Float64(Float64(c * b) - Float64(4.0 * t_1)))
	t_3 = 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))
	tmp = 0.0
	if (t_3 <= -5e+86)
		tmp = t_2;
	elseif (t_3 <= 2e+304)
		tmp = Float64(Float64(c * b) - fma(4.0, t_1, Float64(Float64(k * j) * 27.0)));
	elseif (t_3 <= Inf)
		tmp = t_2;
	else
		tmp = Float64(fma(Float64(18.0 * t), Float64(z * y), Float64(-4.0 * i)) * 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.
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(a * t + N[(i * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(18.0 * t), $MachinePrecision] * N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision] + N[(N[(c * b), $MachinePrecision] - N[(4.0 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = 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]}, If[LessEqual[t$95$3, -5e+86], t$95$2, If[LessEqual[t$95$3, 2e+304], N[(N[(c * b), $MachinePrecision] - N[(4.0 * t$95$1 + N[(N[(k * j), $MachinePrecision] * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], t$95$2, N[(N[(N[(18.0 * t), $MachinePrecision] * N[(z * y), $MachinePrecision] + N[(-4.0 * i), $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])\\
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, t, i \cdot x\right)\\
t_2 := \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, c \cdot b - 4 \cdot t\_1\right)\\
t_3 := \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\\
\mathbf{if}\;t\_3 \leq -5 \cdot 10^{+86}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{+304}:\\
\;\;\;\;c \cdot b - \mathsf{fma}\left(4, t\_1, \left(k \cdot j\right) \cdot 27\right)\\

\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 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)) < -4.9999999999999998e86 or 1.9999999999999999e304 < (-.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 84.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 j around 0

      \[\leadsto \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)} \]
    4. Step-by-step derivation
      1. associate--l+N/A

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

        \[\leadsto \left(18 \cdot t\right) \cdot \left(x \cdot \left(y \cdot z\right)\right) + \left(\color{blue}{b \cdot c} - \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(18 \cdot t, \color{blue}{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) \]
      4. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(18 \cdot t, \color{blue}{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) \]
      5. *-commutativeN/A

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, c \cdot b - \left(4 \cdot \left(a \cdot t\right) + 4 \cdot \left(i \cdot x\right)\right)\right) \]
      12. distribute-lft-outN/A

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

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

        \[\leadsto \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) \]
      15. lower-*.f6486.8

        \[\leadsto \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) \]
    5. Applied rewrites86.8%

      \[\leadsto \color{blue}{\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)} \]

    if -4.9999999999999998e86 < (-.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.9999999999999999e304

    1. Initial program 99.9%

      \[\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 y around 0

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

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

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

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

        \[\leadsto c \cdot b - \left(\left(4 \cdot \left(a \cdot t\right) + 4 \cdot \left(i \cdot x\right)\right) + \color{blue}{27 \cdot \left(j \cdot k\right)}\right) \]
      5. distribute-lft-outN/A

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{c \cdot b - \mathsf{fma}\left(4, \mathsf{fma}\left(a, t, i \cdot x\right), \left(k \cdot j\right) \cdot 27\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}{x \cdot \left(18 \cdot \left(t \cdot \left(y \cdot z\right)\right) - 4 \cdot i\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \left(18 \cdot \left(t \cdot \left(y \cdot z\right)\right) - 4 \cdot i\right) \cdot \color{blue}{x} \]
      3. 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 \]
      4. associate-*r*N/A

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

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

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

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

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

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

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

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

Alternative 3: 36.9% accurate, 1.2× 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])\\ \\ \begin{array}{l} t_1 := \left(j \cdot 27\right) \cdot k\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{+160}:\\ \;\;\;\;\left(-27 \cdot j\right) \cdot k\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-168}:\\ \;\;\;\;c \cdot b\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+133}:\\ \;\;\;\;-4 \cdot \left(a \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-27 \cdot k\right) \cdot j\\ \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.
(FPCore (x y z t a b c i j k)
 :precision binary64
 (let* ((t_1 (* (* j 27.0) k)))
   (if (<= t_1 -2e+160)
     (* (* -27.0 j) k)
     (if (<= t_1 5e-168)
       (* c b)
       (if (<= t_1 5e+133) (* -4.0 (* a t)) (* (* -27.0 k) j))))))
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 = (j * 27.0) * k;
	double tmp;
	if (t_1 <= -2e+160) {
		tmp = (-27.0 * j) * k;
	} else if (t_1 <= 5e-168) {
		tmp = c * b;
	} else if (t_1 <= 5e+133) {
		tmp = -4.0 * (a * t);
	} else {
		tmp = (-27.0 * k) * j;
	}
	return tmp;
}
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
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
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (j * 27.0d0) * k
    if (t_1 <= (-2d+160)) then
        tmp = ((-27.0d0) * j) * k
    else if (t_1 <= 5d-168) then
        tmp = c * b
    else if (t_1 <= 5d+133) then
        tmp = (-4.0d0) * (a * t)
    else
        tmp = ((-27.0d0) * k) * j
    end if
    code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k;
public static 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 = (j * 27.0) * k;
	double tmp;
	if (t_1 <= -2e+160) {
		tmp = (-27.0 * j) * k;
	} else if (t_1 <= 5e-168) {
		tmp = c * b;
	} else if (t_1 <= 5e+133) {
		tmp = -4.0 * (a * t);
	} else {
		tmp = (-27.0 * k) * j;
	}
	return tmp;
}
[x, y, z, t, a, b, c, i, j, k] = sort([x, y, z, t, a, b, c, i, j, k])
def code(x, y, z, t, a, b, c, i, j, k):
	t_1 = (j * 27.0) * k
	tmp = 0
	if t_1 <= -2e+160:
		tmp = (-27.0 * j) * k
	elif t_1 <= 5e-168:
		tmp = c * b
	elif t_1 <= 5e+133:
		tmp = -4.0 * (a * t)
	else:
		tmp = (-27.0 * k) * j
	return tmp
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(j * 27.0) * k)
	tmp = 0.0
	if (t_1 <= -2e+160)
		tmp = Float64(Float64(-27.0 * j) * k);
	elseif (t_1 <= 5e-168)
		tmp = Float64(c * b);
	elseif (t_1 <= 5e+133)
		tmp = Float64(-4.0 * Float64(a * t));
	else
		tmp = Float64(Float64(-27.0 * k) * j);
	end
	return tmp
end
x, y, z, t, a, b, c, i, j, k = num2cell(sort([x, y, z, t, a, b, c, i, j, k])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i, j, k)
	t_1 = (j * 27.0) * k;
	tmp = 0.0;
	if (t_1 <= -2e+160)
		tmp = (-27.0 * j) * k;
	elseif (t_1 <= 5e-168)
		tmp = c * b;
	elseif (t_1 <= 5e+133)
		tmp = -4.0 * (a * t);
	else
		tmp = (-27.0 * k) * j;
	end
	tmp_2 = tmp;
end
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[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+160], N[(N[(-27.0 * j), $MachinePrecision] * k), $MachinePrecision], If[LessEqual[t$95$1, 5e-168], N[(c * b), $MachinePrecision], If[LessEqual[t$95$1, 5e+133], N[(-4.0 * N[(a * t), $MachinePrecision]), $MachinePrecision], N[(N[(-27.0 * k), $MachinePrecision] * j), $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])\\
\\
\begin{array}{l}
t_1 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+160}:\\
\;\;\;\;\left(-27 \cdot j\right) \cdot k\\

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-168}:\\
\;\;\;\;c \cdot b\\

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+133}:\\
\;\;\;\;-4 \cdot \left(a \cdot t\right)\\

\mathbf{else}:\\
\;\;\;\;\left(-27 \cdot k\right) \cdot j\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 (*.f64 j #s(literal 27 binary64)) k) < -2.00000000000000001e160

    1. Initial program 70.9%

      \[\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 inf

      \[\leadsto \color{blue}{-27 \cdot \left(j \cdot k\right)} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -27 \cdot \color{blue}{\left(j \cdot k\right)} \]
      2. *-commutativeN/A

        \[\leadsto -27 \cdot \left(k \cdot \color{blue}{j}\right) \]
      3. lower-*.f6461.9

        \[\leadsto -27 \cdot \left(k \cdot \color{blue}{j}\right) \]
    5. Applied rewrites61.9%

      \[\leadsto \color{blue}{-27 \cdot \left(k \cdot j\right)} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto -27 \cdot \left(k \cdot \color{blue}{j}\right) \]
      2. lift-*.f64N/A

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

        \[\leadsto -27 \cdot \left(j \cdot \color{blue}{k}\right) \]
      4. associate-*r*N/A

        \[\leadsto \left(-27 \cdot j\right) \cdot \color{blue}{k} \]
      5. lower-*.f64N/A

        \[\leadsto \left(-27 \cdot j\right) \cdot \color{blue}{k} \]
      6. lower-*.f6461.9

        \[\leadsto \left(-27 \cdot j\right) \cdot k \]
    7. Applied rewrites61.9%

      \[\leadsto \left(-27 \cdot j\right) \cdot \color{blue}{k} \]

    if -2.00000000000000001e160 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 5.00000000000000001e-168

    1. Initial program 83.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 b around inf

      \[\leadsto \color{blue}{b \cdot c} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto c \cdot \color{blue}{b} \]
      2. lower-*.f6430.2

        \[\leadsto c \cdot \color{blue}{b} \]
    5. Applied rewrites30.2%

      \[\leadsto \color{blue}{c \cdot b} \]

    if 5.00000000000000001e-168 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 4.99999999999999961e133

    1. Initial program 92.5%

      \[\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 a around inf

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

        \[\leadsto -4 \cdot \color{blue}{\left(a \cdot t\right)} \]
      2. lower-*.f6430.8

        \[\leadsto -4 \cdot \left(a \cdot \color{blue}{t}\right) \]
    5. Applied rewrites30.8%

      \[\leadsto \color{blue}{-4 \cdot \left(a \cdot t\right)} \]

    if 4.99999999999999961e133 < (*.f64 (*.f64 j #s(literal 27 binary64)) k)

    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 j around inf

      \[\leadsto \color{blue}{-27 \cdot \left(j \cdot k\right)} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -27 \cdot \color{blue}{\left(j \cdot k\right)} \]
      2. *-commutativeN/A

        \[\leadsto -27 \cdot \left(k \cdot \color{blue}{j}\right) \]
      3. lower-*.f6461.6

        \[\leadsto -27 \cdot \left(k \cdot \color{blue}{j}\right) \]
    5. Applied rewrites61.6%

      \[\leadsto \color{blue}{-27 \cdot \left(k \cdot j\right)} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto -27 \cdot \left(k \cdot \color{blue}{j}\right) \]
      2. lift-*.f64N/A

        \[\leadsto -27 \cdot \color{blue}{\left(k \cdot j\right)} \]
      3. associate-*r*N/A

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

        \[\leadsto \left(-27 \cdot k\right) \cdot \color{blue}{j} \]
      5. lower-*.f6461.7

        \[\leadsto \left(-27 \cdot k\right) \cdot j \]
    7. Applied rewrites61.7%

      \[\leadsto \left(-27 \cdot k\right) \cdot \color{blue}{j} \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 4: 36.8% accurate, 1.2× 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])\\ \\ \begin{array}{l} t_1 := \left(-27 \cdot j\right) \cdot k\\ t_2 := \left(j \cdot 27\right) \cdot k\\ \mathbf{if}\;t\_2 \leq -2 \cdot 10^{+160}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-168}:\\ \;\;\;\;c \cdot b\\ \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+133}:\\ \;\;\;\;-4 \cdot \left(a \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \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.
(FPCore (x y z t a b c i j k)
 :precision binary64
 (let* ((t_1 (* (* -27.0 j) k)) (t_2 (* (* j 27.0) k)))
   (if (<= t_2 -2e+160)
     t_1
     (if (<= t_2 5e-168) (* c b) (if (<= t_2 5e+133) (* -4.0 (* a t)) t_1)))))
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 = (-27.0 * j) * k;
	double t_2 = (j * 27.0) * k;
	double tmp;
	if (t_2 <= -2e+160) {
		tmp = t_1;
	} else if (t_2 <= 5e-168) {
		tmp = c * b;
	} else if (t_2 <= 5e+133) {
		tmp = -4.0 * (a * t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
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
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = ((-27.0d0) * j) * k
    t_2 = (j * 27.0d0) * k
    if (t_2 <= (-2d+160)) then
        tmp = t_1
    else if (t_2 <= 5d-168) then
        tmp = c * b
    else if (t_2 <= 5d+133) then
        tmp = (-4.0d0) * (a * t)
    else
        tmp = t_1
    end if
    code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k;
public static 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 = (-27.0 * j) * k;
	double t_2 = (j * 27.0) * k;
	double tmp;
	if (t_2 <= -2e+160) {
		tmp = t_1;
	} else if (t_2 <= 5e-168) {
		tmp = c * b;
	} else if (t_2 <= 5e+133) {
		tmp = -4.0 * (a * t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
[x, y, z, t, a, b, c, i, j, k] = sort([x, y, z, t, a, b, c, i, j, k])
def code(x, y, z, t, a, b, c, i, j, k):
	t_1 = (-27.0 * j) * k
	t_2 = (j * 27.0) * k
	tmp = 0
	if t_2 <= -2e+160:
		tmp = t_1
	elif t_2 <= 5e-168:
		tmp = c * b
	elif t_2 <= 5e+133:
		tmp = -4.0 * (a * t)
	else:
		tmp = t_1
	return tmp
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(-27.0 * j) * k)
	t_2 = Float64(Float64(j * 27.0) * k)
	tmp = 0.0
	if (t_2 <= -2e+160)
		tmp = t_1;
	elseif (t_2 <= 5e-168)
		tmp = Float64(c * b);
	elseif (t_2 <= 5e+133)
		tmp = Float64(-4.0 * Float64(a * t));
	else
		tmp = t_1;
	end
	return tmp
end
x, y, z, t, a, b, c, i, j, k = num2cell(sort([x, y, z, t, a, b, c, i, j, k])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i, j, k)
	t_1 = (-27.0 * j) * k;
	t_2 = (j * 27.0) * k;
	tmp = 0.0;
	if (t_2 <= -2e+160)
		tmp = t_1;
	elseif (t_2 <= 5e-168)
		tmp = c * b;
	elseif (t_2 <= 5e+133)
		tmp = -4.0 * (a * t);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
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[(-27.0 * j), $MachinePrecision] * k), $MachinePrecision]}, Block[{t$95$2 = N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+160], t$95$1, If[LessEqual[t$95$2, 5e-168], N[(c * b), $MachinePrecision], If[LessEqual[t$95$2, 5e+133], N[(-4.0 * N[(a * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\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])\\
\\
\begin{array}{l}
t_1 := \left(-27 \cdot j\right) \cdot k\\
t_2 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+160}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-168}:\\
\;\;\;\;c \cdot b\\

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+133}:\\
\;\;\;\;-4 \cdot \left(a \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 j #s(literal 27 binary64)) k) < -2.00000000000000001e160 or 4.99999999999999961e133 < (*.f64 (*.f64 j #s(literal 27 binary64)) k)

    1. Initial program 76.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 j around inf

      \[\leadsto \color{blue}{-27 \cdot \left(j \cdot k\right)} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -27 \cdot \color{blue}{\left(j \cdot k\right)} \]
      2. *-commutativeN/A

        \[\leadsto -27 \cdot \left(k \cdot \color{blue}{j}\right) \]
      3. lower-*.f6461.7

        \[\leadsto -27 \cdot \left(k \cdot \color{blue}{j}\right) \]
    5. Applied rewrites61.7%

      \[\leadsto \color{blue}{-27 \cdot \left(k \cdot j\right)} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto -27 \cdot \left(k \cdot \color{blue}{j}\right) \]
      2. lift-*.f64N/A

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

        \[\leadsto -27 \cdot \left(j \cdot \color{blue}{k}\right) \]
      4. associate-*r*N/A

        \[\leadsto \left(-27 \cdot j\right) \cdot \color{blue}{k} \]
      5. lower-*.f64N/A

        \[\leadsto \left(-27 \cdot j\right) \cdot \color{blue}{k} \]
      6. lower-*.f6461.8

        \[\leadsto \left(-27 \cdot j\right) \cdot k \]
    7. Applied rewrites61.8%

      \[\leadsto \left(-27 \cdot j\right) \cdot \color{blue}{k} \]

    if -2.00000000000000001e160 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 5.00000000000000001e-168

    1. Initial program 83.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 b around inf

      \[\leadsto \color{blue}{b \cdot c} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto c \cdot \color{blue}{b} \]
      2. lower-*.f6430.2

        \[\leadsto c \cdot \color{blue}{b} \]
    5. Applied rewrites30.2%

      \[\leadsto \color{blue}{c \cdot b} \]

    if 5.00000000000000001e-168 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 4.99999999999999961e133

    1. Initial program 92.5%

      \[\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 a around inf

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

        \[\leadsto -4 \cdot \color{blue}{\left(a \cdot t\right)} \]
      2. lower-*.f6430.8

        \[\leadsto -4 \cdot \left(a \cdot \color{blue}{t}\right) \]
    5. Applied rewrites30.8%

      \[\leadsto \color{blue}{-4 \cdot \left(a \cdot t\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 5: 36.9% accurate, 1.2× 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])\\ \\ \begin{array}{l} t_1 := -27 \cdot \left(k \cdot j\right)\\ t_2 := \left(j \cdot 27\right) \cdot k\\ \mathbf{if}\;t\_2 \leq -2 \cdot 10^{+160}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-168}:\\ \;\;\;\;c \cdot b\\ \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+133}:\\ \;\;\;\;-4 \cdot \left(a \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \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.
(FPCore (x y z t a b c i j k)
 :precision binary64
 (let* ((t_1 (* -27.0 (* k j))) (t_2 (* (* j 27.0) k)))
   (if (<= t_2 -2e+160)
     t_1
     (if (<= t_2 5e-168) (* c b) (if (<= t_2 5e+133) (* -4.0 (* a t)) t_1)))))
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 = -27.0 * (k * j);
	double t_2 = (j * 27.0) * k;
	double tmp;
	if (t_2 <= -2e+160) {
		tmp = t_1;
	} else if (t_2 <= 5e-168) {
		tmp = c * b;
	} else if (t_2 <= 5e+133) {
		tmp = -4.0 * (a * t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
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
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (-27.0d0) * (k * j)
    t_2 = (j * 27.0d0) * k
    if (t_2 <= (-2d+160)) then
        tmp = t_1
    else if (t_2 <= 5d-168) then
        tmp = c * b
    else if (t_2 <= 5d+133) then
        tmp = (-4.0d0) * (a * t)
    else
        tmp = t_1
    end if
    code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k;
public static 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 = -27.0 * (k * j);
	double t_2 = (j * 27.0) * k;
	double tmp;
	if (t_2 <= -2e+160) {
		tmp = t_1;
	} else if (t_2 <= 5e-168) {
		tmp = c * b;
	} else if (t_2 <= 5e+133) {
		tmp = -4.0 * (a * t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
[x, y, z, t, a, b, c, i, j, k] = sort([x, y, z, t, a, b, c, i, j, k])
def code(x, y, z, t, a, b, c, i, j, k):
	t_1 = -27.0 * (k * j)
	t_2 = (j * 27.0) * k
	tmp = 0
	if t_2 <= -2e+160:
		tmp = t_1
	elif t_2 <= 5e-168:
		tmp = c * b
	elif t_2 <= 5e+133:
		tmp = -4.0 * (a * t)
	else:
		tmp = t_1
	return tmp
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(-27.0 * Float64(k * j))
	t_2 = Float64(Float64(j * 27.0) * k)
	tmp = 0.0
	if (t_2 <= -2e+160)
		tmp = t_1;
	elseif (t_2 <= 5e-168)
		tmp = Float64(c * b);
	elseif (t_2 <= 5e+133)
		tmp = Float64(-4.0 * Float64(a * t));
	else
		tmp = t_1;
	end
	return tmp
end
x, y, z, t, a, b, c, i, j, k = num2cell(sort([x, y, z, t, a, b, c, i, j, k])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i, j, k)
	t_1 = -27.0 * (k * j);
	t_2 = (j * 27.0) * k;
	tmp = 0.0;
	if (t_2 <= -2e+160)
		tmp = t_1;
	elseif (t_2 <= 5e-168)
		tmp = c * b;
	elseif (t_2 <= 5e+133)
		tmp = -4.0 * (a * t);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
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[(-27.0 * N[(k * j), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+160], t$95$1, If[LessEqual[t$95$2, 5e-168], N[(c * b), $MachinePrecision], If[LessEqual[t$95$2, 5e+133], N[(-4.0 * N[(a * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\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])\\
\\
\begin{array}{l}
t_1 := -27 \cdot \left(k \cdot j\right)\\
t_2 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+160}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-168}:\\
\;\;\;\;c \cdot b\\

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+133}:\\
\;\;\;\;-4 \cdot \left(a \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 j #s(literal 27 binary64)) k) < -2.00000000000000001e160 or 4.99999999999999961e133 < (*.f64 (*.f64 j #s(literal 27 binary64)) k)

    1. Initial program 76.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 j around inf

      \[\leadsto \color{blue}{-27 \cdot \left(j \cdot k\right)} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -27 \cdot \color{blue}{\left(j \cdot k\right)} \]
      2. *-commutativeN/A

        \[\leadsto -27 \cdot \left(k \cdot \color{blue}{j}\right) \]
      3. lower-*.f6461.7

        \[\leadsto -27 \cdot \left(k \cdot \color{blue}{j}\right) \]
    5. Applied rewrites61.7%

      \[\leadsto \color{blue}{-27 \cdot \left(k \cdot j\right)} \]

    if -2.00000000000000001e160 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 5.00000000000000001e-168

    1. Initial program 83.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 b around inf

      \[\leadsto \color{blue}{b \cdot c} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto c \cdot \color{blue}{b} \]
      2. lower-*.f6430.2

        \[\leadsto c \cdot \color{blue}{b} \]
    5. Applied rewrites30.2%

      \[\leadsto \color{blue}{c \cdot b} \]

    if 5.00000000000000001e-168 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 4.99999999999999961e133

    1. Initial program 92.5%

      \[\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 a around inf

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

        \[\leadsto -4 \cdot \color{blue}{\left(a \cdot t\right)} \]
      2. lower-*.f6430.8

        \[\leadsto -4 \cdot \left(a \cdot \color{blue}{t}\right) \]
    5. Applied rewrites30.8%

      \[\leadsto \color{blue}{-4 \cdot \left(a \cdot t\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 6: 79.5% accurate, 1.4× 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])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.35 \cdot 10^{+121}:\\ \;\;\;\;\mathsf{fma}\left(18 \cdot t, z \cdot y, -4 \cdot i\right) \cdot x\\ \mathbf{elif}\;x \leq 8.4 \cdot 10^{+152}:\\ \;\;\;\;c \cdot b - \mathsf{fma}\left(4, \mathsf{fma}\left(a, t, i \cdot x\right), \left(k \cdot j\right) \cdot 27\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(z \cdot y\right) \cdot -18, 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.
(FPCore (x y z t a b c i j k)
 :precision binary64
 (if (<= x -1.35e+121)
   (* (fma (* 18.0 t) (* z y) (* -4.0 i)) x)
   (if (<= x 8.4e+152)
     (- (* c b) (fma 4.0 (fma a t (* i x)) (* (* k j) 27.0)))
     (* (fma (* (* z y) -18.0) t (* i 4.0)) (- x)))))
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 <= -1.35e+121) {
		tmp = fma((18.0 * t), (z * y), (-4.0 * i)) * x;
	} else if (x <= 8.4e+152) {
		tmp = (c * b) - fma(4.0, fma(a, t, (i * x)), ((k * j) * 27.0));
	} else {
		tmp = fma(((z * y) * -18.0), 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])
function code(x, y, z, t, a, b, c, i, j, k)
	tmp = 0.0
	if (x <= -1.35e+121)
		tmp = Float64(fma(Float64(18.0 * t), Float64(z * y), Float64(-4.0 * i)) * x);
	elseif (x <= 8.4e+152)
		tmp = Float64(Float64(c * b) - fma(4.0, fma(a, t, Float64(i * x)), Float64(Float64(k * j) * 27.0)));
	else
		tmp = Float64(fma(Float64(Float64(z * y) * -18.0), 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.
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := If[LessEqual[x, -1.35e+121], N[(N[(N[(18.0 * t), $MachinePrecision] * N[(z * y), $MachinePrecision] + N[(-4.0 * i), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[x, 8.4e+152], N[(N[(c * b), $MachinePrecision] - N[(4.0 * N[(a * t + N[(i * x), $MachinePrecision]), $MachinePrecision] + N[(N[(k * j), $MachinePrecision] * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(z * y), $MachinePrecision] * -18.0), $MachinePrecision] * t + 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])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{+121}:\\
\;\;\;\;\mathsf{fma}\left(18 \cdot t, z \cdot y, -4 \cdot i\right) \cdot x\\

\mathbf{elif}\;x \leq 8.4 \cdot 10^{+152}:\\
\;\;\;\;c \cdot b - \mathsf{fma}\left(4, \mathsf{fma}\left(a, t, i \cdot x\right), \left(k \cdot j\right) \cdot 27\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.3500000000000001e121

    1. Initial program 70.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 x around inf

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

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

        \[\leadsto \left(18 \cdot \left(t \cdot \left(y \cdot z\right)\right) - 4 \cdot i\right) \cdot \color{blue}{x} \]
      3. 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 \]
      4. associate-*r*N/A

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

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

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

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

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

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

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

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

    if -1.3500000000000001e121 < x < 8.4000000000000007e152

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

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

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

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

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

        \[\leadsto c \cdot b - \left(\left(4 \cdot \left(a \cdot t\right) + 4 \cdot \left(i \cdot x\right)\right) + \color{blue}{27 \cdot \left(j \cdot k\right)}\right) \]
      5. distribute-lft-outN/A

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

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

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

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

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

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

        \[\leadsto c \cdot b - \mathsf{fma}\left(4, \mathsf{fma}\left(a, t, \color{blue}{i} \cdot x\right), \left(k \cdot j\right) \cdot 27\right) \]
      12. lower-*.f6481.9

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

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

    if 8.4000000000000007e152 < x

    1. Initial program 68.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-*.f6488.7

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

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

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

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

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

        \[\leadsto -\left(-18 \cdot \left(\left(z \cdot y\right) \cdot t\right) + i \cdot 4\right) \cdot x \]
      5. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 37.3% accurate, 1.6× 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])\\ \\ \begin{array}{l} t_1 := \left(j \cdot 27\right) \cdot k\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{+160} \lor \neg \left(t\_1 \leq 10^{+56}\right):\\ \;\;\;\;-27 \cdot \left(k \cdot j\right)\\ \mathbf{else}:\\ \;\;\;\;c \cdot b\\ \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.
(FPCore (x y z t a b c i j k)
 :precision binary64
 (let* ((t_1 (* (* j 27.0) k)))
   (if (or (<= t_1 -2e+160) (not (<= t_1 1e+56))) (* -27.0 (* k j)) (* c b))))
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 = (j * 27.0) * k;
	double tmp;
	if ((t_1 <= -2e+160) || !(t_1 <= 1e+56)) {
		tmp = -27.0 * (k * j);
	} else {
		tmp = c * b;
	}
	return tmp;
}
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
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
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (j * 27.0d0) * k
    if ((t_1 <= (-2d+160)) .or. (.not. (t_1 <= 1d+56))) then
        tmp = (-27.0d0) * (k * j)
    else
        tmp = c * b
    end if
    code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k;
public static 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 = (j * 27.0) * k;
	double tmp;
	if ((t_1 <= -2e+160) || !(t_1 <= 1e+56)) {
		tmp = -27.0 * (k * j);
	} else {
		tmp = c * b;
	}
	return tmp;
}
[x, y, z, t, a, b, c, i, j, k] = sort([x, y, z, t, a, b, c, i, j, k])
def code(x, y, z, t, a, b, c, i, j, k):
	t_1 = (j * 27.0) * k
	tmp = 0
	if (t_1 <= -2e+160) or not (t_1 <= 1e+56):
		tmp = -27.0 * (k * j)
	else:
		tmp = c * b
	return tmp
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(j * 27.0) * k)
	tmp = 0.0
	if ((t_1 <= -2e+160) || !(t_1 <= 1e+56))
		tmp = Float64(-27.0 * Float64(k * j));
	else
		tmp = Float64(c * b);
	end
	return tmp
end
x, y, z, t, a, b, c, i, j, k = num2cell(sort([x, y, z, t, a, b, c, i, j, k])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i, j, k)
	t_1 = (j * 27.0) * k;
	tmp = 0.0;
	if ((t_1 <= -2e+160) || ~((t_1 <= 1e+56)))
		tmp = -27.0 * (k * j);
	else
		tmp = c * b;
	end
	tmp_2 = tmp;
end
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[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2e+160], N[Not[LessEqual[t$95$1, 1e+56]], $MachinePrecision]], N[(-27.0 * N[(k * j), $MachinePrecision]), $MachinePrecision], N[(c * b), $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])\\
\\
\begin{array}{l}
t_1 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+160} \lor \neg \left(t\_1 \leq 10^{+56}\right):\\
\;\;\;\;-27 \cdot \left(k \cdot j\right)\\

\mathbf{else}:\\
\;\;\;\;c \cdot b\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 j #s(literal 27 binary64)) k) < -2.00000000000000001e160 or 1.00000000000000009e56 < (*.f64 (*.f64 j #s(literal 27 binary64)) k)

    1. Initial program 77.9%

      \[\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 inf

      \[\leadsto \color{blue}{-27 \cdot \left(j \cdot k\right)} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -27 \cdot \color{blue}{\left(j \cdot k\right)} \]
      2. *-commutativeN/A

        \[\leadsto -27 \cdot \left(k \cdot \color{blue}{j}\right) \]
      3. lower-*.f6455.0

        \[\leadsto -27 \cdot \left(k \cdot \color{blue}{j}\right) \]
    5. Applied rewrites55.0%

      \[\leadsto \color{blue}{-27 \cdot \left(k \cdot j\right)} \]

    if -2.00000000000000001e160 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 1.00000000000000009e56

    1. Initial program 85.9%

      \[\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 b around inf

      \[\leadsto \color{blue}{b \cdot c} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto c \cdot \color{blue}{b} \]
      2. lower-*.f6428.5

        \[\leadsto c \cdot \color{blue}{b} \]
    5. Applied rewrites28.5%

      \[\leadsto \color{blue}{c \cdot b} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification37.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(j \cdot 27\right) \cdot k \leq -2 \cdot 10^{+160} \lor \neg \left(\left(j \cdot 27\right) \cdot k \leq 10^{+56}\right):\\ \;\;\;\;-27 \cdot \left(k \cdot j\right)\\ \mathbf{else}:\\ \;\;\;\;c \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 48.5% accurate, 1.6× 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])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.4 \cdot 10^{+121}:\\ \;\;\;\;\left(z \cdot y\right) \cdot \left(x \cdot \left(t \cdot 18\right)\right)\\ \mathbf{elif}\;x \leq 8.2 \cdot 10^{-38}:\\ \;\;\;\;c \cdot b - j \cdot \left(k \cdot 27\right)\\ \mathbf{elif}\;x \leq 7.5 \cdot 10^{+128}:\\ \;\;\;\;\left(-4 \cdot i\right) \cdot x - \left(j \cdot 27\right) \cdot k\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(y \cdot x\right) \cdot z\right) \cdot t\right) \cdot 18\\ \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.
(FPCore (x y z t a b c i j k)
 :precision binary64
 (if (<= x -1.4e+121)
   (* (* z y) (* x (* t 18.0)))
   (if (<= x 8.2e-38)
     (- (* c b) (* j (* k 27.0)))
     (if (<= x 7.5e+128)
       (- (* (* -4.0 i) x) (* (* j 27.0) k))
       (* (* (* (* y x) z) t) 18.0)))))
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 <= -1.4e+121) {
		tmp = (z * y) * (x * (t * 18.0));
	} else if (x <= 8.2e-38) {
		tmp = (c * b) - (j * (k * 27.0));
	} else if (x <= 7.5e+128) {
		tmp = ((-4.0 * i) * x) - ((j * 27.0) * k);
	} else {
		tmp = (((y * x) * z) * t) * 18.0;
	}
	return tmp;
}
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
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
    real(8) :: tmp
    if (x <= (-1.4d+121)) then
        tmp = (z * y) * (x * (t * 18.0d0))
    else if (x <= 8.2d-38) then
        tmp = (c * b) - (j * (k * 27.0d0))
    else if (x <= 7.5d+128) then
        tmp = (((-4.0d0) * i) * x) - ((j * 27.0d0) * k)
    else
        tmp = (((y * x) * z) * t) * 18.0d0
    end if
    code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k;
public static 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 <= -1.4e+121) {
		tmp = (z * y) * (x * (t * 18.0));
	} else if (x <= 8.2e-38) {
		tmp = (c * b) - (j * (k * 27.0));
	} else if (x <= 7.5e+128) {
		tmp = ((-4.0 * i) * x) - ((j * 27.0) * k);
	} else {
		tmp = (((y * x) * z) * t) * 18.0;
	}
	return tmp;
}
[x, y, z, t, a, b, c, i, j, k] = sort([x, y, z, t, a, b, c, i, j, k])
def code(x, y, z, t, a, b, c, i, j, k):
	tmp = 0
	if x <= -1.4e+121:
		tmp = (z * y) * (x * (t * 18.0))
	elif x <= 8.2e-38:
		tmp = (c * b) - (j * (k * 27.0))
	elif x <= 7.5e+128:
		tmp = ((-4.0 * i) * x) - ((j * 27.0) * k)
	else:
		tmp = (((y * x) * z) * t) * 18.0
	return tmp
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 (x <= -1.4e+121)
		tmp = Float64(Float64(z * y) * Float64(x * Float64(t * 18.0)));
	elseif (x <= 8.2e-38)
		tmp = Float64(Float64(c * b) - Float64(j * Float64(k * 27.0)));
	elseif (x <= 7.5e+128)
		tmp = Float64(Float64(Float64(-4.0 * i) * x) - Float64(Float64(j * 27.0) * k));
	else
		tmp = Float64(Float64(Float64(Float64(y * x) * z) * t) * 18.0);
	end
	return tmp
end
x, y, z, t, a, b, c, i, j, k = num2cell(sort([x, y, z, t, a, b, c, i, j, k])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i, j, k)
	tmp = 0.0;
	if (x <= -1.4e+121)
		tmp = (z * y) * (x * (t * 18.0));
	elseif (x <= 8.2e-38)
		tmp = (c * b) - (j * (k * 27.0));
	elseif (x <= 7.5e+128)
		tmp = ((-4.0 * i) * x) - ((j * 27.0) * k);
	else
		tmp = (((y * x) * z) * t) * 18.0;
	end
	tmp_2 = tmp;
end
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[x, -1.4e+121], N[(N[(z * y), $MachinePrecision] * N[(x * N[(t * 18.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8.2e-38], N[(N[(c * b), $MachinePrecision] - N[(j * N[(k * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.5e+128], N[(N[(N[(-4.0 * i), $MachinePrecision] * x), $MachinePrecision] - N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision] * 18.0), $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])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{+121}:\\
\;\;\;\;\left(z \cdot y\right) \cdot \left(x \cdot \left(t \cdot 18\right)\right)\\

\mathbf{elif}\;x \leq 8.2 \cdot 10^{-38}:\\
\;\;\;\;c \cdot b - j \cdot \left(k \cdot 27\right)\\

\mathbf{elif}\;x \leq 7.5 \cdot 10^{+128}:\\
\;\;\;\;\left(-4 \cdot i\right) \cdot x - \left(j \cdot 27\right) \cdot k\\

\mathbf{else}:\\
\;\;\;\;\left(\left(\left(y \cdot x\right) \cdot z\right) \cdot t\right) \cdot 18\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.40000000000000003e121

    1. Initial program 70.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 y around inf

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

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

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

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

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

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

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

        \[\leadsto \left(\left(\left(z \cdot y\right) \cdot x\right) \cdot t\right) \cdot 18 \]
      8. lower-*.f6458.1

        \[\leadsto \left(\left(\left(z \cdot y\right) \cdot x\right) \cdot t\right) \cdot 18 \]
    5. Applied rewrites58.1%

      \[\leadsto \color{blue}{\left(\left(\left(z \cdot y\right) \cdot x\right) \cdot t\right) \cdot 18} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(\left(\left(z \cdot y\right) \cdot x\right) \cdot t\right) \cdot \color{blue}{18} \]
      2. lift-*.f64N/A

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

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

        \[\leadsto \left(\left(\left(z \cdot y\right) \cdot x\right) \cdot t\right) \cdot 18 \]
      5. associate-*l*N/A

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

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

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

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

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

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

        \[\leadsto \left(\left(z \cdot y\right) \cdot x\right) \cdot \left(\color{blue}{t} \cdot 18\right) \]
      12. lift-*.f64N/A

        \[\leadsto \left(\left(z \cdot y\right) \cdot x\right) \cdot \left(t \cdot 18\right) \]
      13. lower-*.f6458.1

        \[\leadsto \left(\left(z \cdot y\right) \cdot x\right) \cdot \left(t \cdot \color{blue}{18}\right) \]
    7. Applied rewrites58.1%

      \[\leadsto \left(\left(z \cdot y\right) \cdot x\right) \cdot \color{blue}{\left(t \cdot 18\right)} \]
    8. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(\left(z \cdot y\right) \cdot x\right) \cdot \left(t \cdot \color{blue}{18}\right) \]
      2. lift-*.f64N/A

        \[\leadsto \left(\left(z \cdot y\right) \cdot x\right) \cdot \color{blue}{\left(t \cdot 18\right)} \]
      3. lift-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \left(z \cdot y\right) \cdot \left(x \cdot \color{blue}{\left(t \cdot 18\right)}\right) \]
      11. lift-*.f6465.0

        \[\leadsto \left(z \cdot y\right) \cdot \left(x \cdot \left(t \cdot \color{blue}{18}\right)\right) \]
    9. Applied rewrites65.0%

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

    if -1.40000000000000003e121 < x < 8.1999999999999996e-38

    1. Initial program 92.2%

      \[\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(\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) - 4 \cdot \left(a \cdot t\right)\right)} - \left(j \cdot 27\right) \cdot k \]
    4. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto \left(-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) - 4 \cdot \left(a \cdot t\right)\right)}\right) - \left(j \cdot 27\right) \cdot k \]
      2. associate-*r*N/A

        \[\leadsto \left(\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)} - 4 \cdot \left(a \cdot t\right)\right)\right) - \left(j \cdot 27\right) \cdot k \]
      3. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto c \cdot \color{blue}{b} - j \cdot \left(k \cdot 27\right) \]
      2. lift-*.f6453.4

        \[\leadsto c \cdot \color{blue}{b} - j \cdot \left(k \cdot 27\right) \]
    10. Applied rewrites53.4%

      \[\leadsto \color{blue}{c \cdot b} - j \cdot \left(k \cdot 27\right) \]

    if 8.1999999999999996e-38 < x < 7.50000000000000076e128

    1. Initial program 81.2%

      \[\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 inf

      \[\leadsto \color{blue}{-4 \cdot \left(i \cdot x\right)} - \left(j \cdot 27\right) \cdot k \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(-4 \cdot i\right) \cdot \color{blue}{x} - \left(j \cdot 27\right) \cdot k \]
      2. lower-*.f64N/A

        \[\leadsto \left(-4 \cdot i\right) \cdot \color{blue}{x} - \left(j \cdot 27\right) \cdot k \]
      3. lower-*.f6464.4

        \[\leadsto \left(-4 \cdot i\right) \cdot x - \left(j \cdot 27\right) \cdot k \]
    5. Applied rewrites64.4%

      \[\leadsto \color{blue}{\left(-4 \cdot i\right) \cdot x} - \left(j \cdot 27\right) \cdot k \]

    if 7.50000000000000076e128 < x

    1. Initial program 65.2%

      \[\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 y around inf

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

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

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

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

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

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

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

        \[\leadsto \left(\left(\left(z \cdot y\right) \cdot x\right) \cdot t\right) \cdot 18 \]
      8. lower-*.f6455.6

        \[\leadsto \left(\left(\left(z \cdot y\right) \cdot x\right) \cdot t\right) \cdot 18 \]
    5. Applied rewrites55.6%

      \[\leadsto \color{blue}{\left(\left(\left(z \cdot y\right) \cdot x\right) \cdot t\right) \cdot 18} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

        \[\leadsto \left(\left(x \cdot \left(y \cdot z\right)\right) \cdot t\right) \cdot 18 \]
      5. associate-*r*N/A

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

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

        \[\leadsto \left(\left(\left(y \cdot x\right) \cdot z\right) \cdot t\right) \cdot 18 \]
      8. lower-*.f6458.1

        \[\leadsto \left(\left(\left(y \cdot x\right) \cdot z\right) \cdot t\right) \cdot 18 \]
    7. Applied rewrites58.1%

      \[\leadsto \left(\left(\left(y \cdot x\right) \cdot z\right) \cdot t\right) \cdot 18 \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 9: 64.8% accurate, 1.6× 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])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.25 \cdot 10^{+121}:\\ \;\;\;\;\mathsf{fma}\left(18 \cdot t, z \cdot y, -4 \cdot i\right) \cdot x\\ \mathbf{elif}\;x \leq 1.35 \cdot 10^{+128}:\\ \;\;\;\;\mathsf{fma}\left(c, b, \left(-4 \cdot i\right) \cdot x\right) - \left(j \cdot 27\right) \cdot k\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(z \cdot y\right) \cdot -18, 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.
(FPCore (x y z t a b c i j k)
 :precision binary64
 (if (<= x -1.25e+121)
   (* (fma (* 18.0 t) (* z y) (* -4.0 i)) x)
   (if (<= x 1.35e+128)
     (- (fma c b (* (* -4.0 i) x)) (* (* j 27.0) k))
     (* (fma (* (* z y) -18.0) t (* i 4.0)) (- x)))))
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 <= -1.25e+121) {
		tmp = fma((18.0 * t), (z * y), (-4.0 * i)) * x;
	} else if (x <= 1.35e+128) {
		tmp = fma(c, b, ((-4.0 * i) * x)) - ((j * 27.0) * k);
	} else {
		tmp = fma(((z * y) * -18.0), 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])
function code(x, y, z, t, a, b, c, i, j, k)
	tmp = 0.0
	if (x <= -1.25e+121)
		tmp = Float64(fma(Float64(18.0 * t), Float64(z * y), Float64(-4.0 * i)) * x);
	elseif (x <= 1.35e+128)
		tmp = Float64(fma(c, b, Float64(Float64(-4.0 * i) * x)) - Float64(Float64(j * 27.0) * k));
	else
		tmp = Float64(fma(Float64(Float64(z * y) * -18.0), 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.
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := If[LessEqual[x, -1.25e+121], N[(N[(N[(18.0 * t), $MachinePrecision] * N[(z * y), $MachinePrecision] + N[(-4.0 * i), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[x, 1.35e+128], N[(N[(c * b + N[(N[(-4.0 * i), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] - N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(z * y), $MachinePrecision] * -18.0), $MachinePrecision] * t + 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])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.25 \cdot 10^{+121}:\\
\;\;\;\;\mathsf{fma}\left(18 \cdot t, z \cdot y, -4 \cdot i\right) \cdot x\\

\mathbf{elif}\;x \leq 1.35 \cdot 10^{+128}:\\
\;\;\;\;\mathsf{fma}\left(c, b, \left(-4 \cdot i\right) \cdot x\right) - \left(j \cdot 27\right) \cdot k\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.25000000000000002e121

    1. Initial program 70.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 x around inf

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

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

        \[\leadsto \left(18 \cdot \left(t \cdot \left(y \cdot z\right)\right) - 4 \cdot i\right) \cdot \color{blue}{x} \]
      3. 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 \]
      4. associate-*r*N/A

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

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

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

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

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

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

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

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

    if -1.25000000000000002e121 < x < 1.35000000000000001e128

    1. Initial program 89.9%

      \[\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 t around 0

      \[\leadsto \color{blue}{\left(b \cdot c - 4 \cdot \left(i \cdot x\right)\right)} - \left(j \cdot 27\right) \cdot k \]
    4. Step-by-step derivation
      1. fp-cancel-sub-sign-invN/A

        \[\leadsto \left(b \cdot c + \color{blue}{\left(\mathsf{neg}\left(4\right)\right) \cdot \left(i \cdot x\right)}\right) - \left(j \cdot 27\right) \cdot k \]
      2. *-commutativeN/A

        \[\leadsto \left(c \cdot b + \color{blue}{\left(\mathsf{neg}\left(4\right)\right)} \cdot \left(i \cdot x\right)\right) - \left(j \cdot 27\right) \cdot k \]
      3. metadata-evalN/A

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

        \[\leadsto \mathsf{fma}\left(c, \color{blue}{b}, -4 \cdot \left(i \cdot x\right)\right) - \left(j \cdot 27\right) \cdot k \]
      5. associate-*r*N/A

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

        \[\leadsto \mathsf{fma}\left(c, b, \left(-4 \cdot i\right) \cdot x\right) - \left(j \cdot 27\right) \cdot k \]
      7. lower-*.f6467.0

        \[\leadsto \mathsf{fma}\left(c, b, \left(-4 \cdot i\right) \cdot x\right) - \left(j \cdot 27\right) \cdot k \]
    5. Applied rewrites67.0%

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

    if 1.35000000000000001e128 < x

    1. Initial program 65.2%

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

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

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

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

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

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

        \[\leadsto -\left(-18 \cdot \left(\left(z \cdot y\right) \cdot t\right) + i \cdot 4\right) \cdot x \]
      5. associate-*r*N/A

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

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

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

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

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

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

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

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

        \[\leadsto -\mathsf{fma}\left(\left(z \cdot y\right) \cdot -18, t, i \cdot 4\right) \cdot x \]
      14. lift-*.f6480.4

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

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

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

Alternative 10: 59.4% accurate, 1.7× 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])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -4.2 \cdot 10^{-5}:\\ \;\;\;\;\mathsf{fma}\left(18 \cdot t, z \cdot y, -4 \cdot i\right) \cdot x\\ \mathbf{elif}\;x \leq 2.9 \cdot 10^{+16}:\\ \;\;\;\;c \cdot b - j \cdot \left(k \cdot 27\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(z \cdot y\right) \cdot -18, 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.
(FPCore (x y z t a b c i j k)
 :precision binary64
 (if (<= x -4.2e-5)
   (* (fma (* 18.0 t) (* z y) (* -4.0 i)) x)
   (if (<= x 2.9e+16)
     (- (* c b) (* j (* k 27.0)))
     (* (fma (* (* z y) -18.0) t (* i 4.0)) (- x)))))
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 <= -4.2e-5) {
		tmp = fma((18.0 * t), (z * y), (-4.0 * i)) * x;
	} else if (x <= 2.9e+16) {
		tmp = (c * b) - (j * (k * 27.0));
	} else {
		tmp = fma(((z * y) * -18.0), 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])
function code(x, y, z, t, a, b, c, i, j, k)
	tmp = 0.0
	if (x <= -4.2e-5)
		tmp = Float64(fma(Float64(18.0 * t), Float64(z * y), Float64(-4.0 * i)) * x);
	elseif (x <= 2.9e+16)
		tmp = Float64(Float64(c * b) - Float64(j * Float64(k * 27.0)));
	else
		tmp = Float64(fma(Float64(Float64(z * y) * -18.0), 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.
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := If[LessEqual[x, -4.2e-5], N[(N[(N[(18.0 * t), $MachinePrecision] * N[(z * y), $MachinePrecision] + N[(-4.0 * i), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[x, 2.9e+16], N[(N[(c * b), $MachinePrecision] - N[(j * N[(k * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(z * y), $MachinePrecision] * -18.0), $MachinePrecision] * t + 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])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.2 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(18 \cdot t, z \cdot y, -4 \cdot i\right) \cdot x\\

\mathbf{elif}\;x \leq 2.9 \cdot 10^{+16}:\\
\;\;\;\;c \cdot b - j \cdot \left(k \cdot 27\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -4.19999999999999977e-5

    1. Initial program 79.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 x around inf

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

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

        \[\leadsto \left(18 \cdot \left(t \cdot \left(y \cdot z\right)\right) - 4 \cdot i\right) \cdot \color{blue}{x} \]
      3. 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 \]
      4. associate-*r*N/A

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

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

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

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

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

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

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

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

    if -4.19999999999999977e-5 < x < 2.9e16

    1. Initial program 91.9%

      \[\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(\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) - 4 \cdot \left(a \cdot t\right)\right)} - \left(j \cdot 27\right) \cdot k \]
    4. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto \left(-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) - 4 \cdot \left(a \cdot t\right)\right)}\right) - \left(j \cdot 27\right) \cdot k \]
      2. associate-*r*N/A

        \[\leadsto \left(\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)} - 4 \cdot \left(a \cdot t\right)\right)\right) - \left(j \cdot 27\right) \cdot k \]
      3. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto c \cdot \color{blue}{b} - j \cdot \left(k \cdot 27\right) \]
      2. lift-*.f6457.5

        \[\leadsto c \cdot \color{blue}{b} - j \cdot \left(k \cdot 27\right) \]
    10. Applied rewrites57.5%

      \[\leadsto \color{blue}{c \cdot b} - j \cdot \left(k \cdot 27\right) \]

    if 2.9e16 < x

    1. Initial program 69.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 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-*.f6472.5

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

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

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

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

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

        \[\leadsto -\left(-18 \cdot \left(\left(z \cdot y\right) \cdot t\right) + i \cdot 4\right) \cdot x \]
      5. associate-*r*N/A

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

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

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

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

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

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

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

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

        \[\leadsto -\mathsf{fma}\left(\left(z \cdot y\right) \cdot -18, t, i \cdot 4\right) \cdot x \]
      14. lift-*.f6472.6

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

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

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

Alternative 11: 59.5% accurate, 1.7× 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])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -4.2 \cdot 10^{-5} \lor \neg \left(x \leq 2.9 \cdot 10^{+16}\right):\\ \;\;\;\;\mathsf{fma}\left(18 \cdot t, z \cdot y, -4 \cdot i\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;c \cdot b - 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.
(FPCore (x y z t a b c i j k)
 :precision binary64
 (if (or (<= x -4.2e-5) (not (<= x 2.9e+16)))
   (* (fma (* 18.0 t) (* z y) (* -4.0 i)) x)
   (- (* c b) (* j (* k 27.0)))))
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 <= -4.2e-5) || !(x <= 2.9e+16)) {
		tmp = fma((18.0 * t), (z * y), (-4.0 * i)) * x;
	} else {
		tmp = (c * b) - (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])
function code(x, y, z, t, a, b, c, i, j, k)
	tmp = 0.0
	if ((x <= -4.2e-5) || !(x <= 2.9e+16))
		tmp = Float64(fma(Float64(18.0 * t), Float64(z * y), Float64(-4.0 * i)) * x);
	else
		tmp = Float64(Float64(c * b) - 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.
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := If[Or[LessEqual[x, -4.2e-5], N[Not[LessEqual[x, 2.9e+16]], $MachinePrecision]], N[(N[(N[(18.0 * t), $MachinePrecision] * N[(z * y), $MachinePrecision] + N[(-4.0 * i), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(N[(c * b), $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])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.2 \cdot 10^{-5} \lor \neg \left(x \leq 2.9 \cdot 10^{+16}\right):\\
\;\;\;\;\mathsf{fma}\left(18 \cdot t, z \cdot y, -4 \cdot i\right) \cdot x\\

\mathbf{else}:\\
\;\;\;\;c \cdot b - j \cdot \left(k \cdot 27\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.19999999999999977e-5 or 2.9e16 < x

    1. Initial program 74.8%

      \[\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}{x \cdot \left(18 \cdot \left(t \cdot \left(y \cdot z\right)\right) - 4 \cdot i\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \left(18 \cdot \left(t \cdot \left(y \cdot z\right)\right) - 4 \cdot i\right) \cdot \color{blue}{x} \]
      3. 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 \]
      4. associate-*r*N/A

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

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

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

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

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

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

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

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

    if -4.19999999999999977e-5 < x < 2.9e16

    1. Initial program 91.9%

      \[\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(\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) - 4 \cdot \left(a \cdot t\right)\right)} - \left(j \cdot 27\right) \cdot k \]
    4. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto \left(-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) - 4 \cdot \left(a \cdot t\right)\right)}\right) - \left(j \cdot 27\right) \cdot k \]
      2. associate-*r*N/A

        \[\leadsto \left(\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)} - 4 \cdot \left(a \cdot t\right)\right)\right) - \left(j \cdot 27\right) \cdot k \]
      3. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto c \cdot \color{blue}{b} - j \cdot \left(k \cdot 27\right) \]
      2. lift-*.f6457.5

        \[\leadsto c \cdot \color{blue}{b} - j \cdot \left(k \cdot 27\right) \]
    10. Applied rewrites57.5%

      \[\leadsto \color{blue}{c \cdot b} - j \cdot \left(k \cdot 27\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification65.7%

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

Alternative 12: 48.6% accurate, 2.1× 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])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.4 \cdot 10^{+121} \lor \neg \left(x \leq 1.7 \cdot 10^{+130}\right):\\ \;\;\;\;\left(z \cdot y\right) \cdot \left(x \cdot \left(t \cdot 18\right)\right)\\ \mathbf{else}:\\ \;\;\;\;c \cdot b - 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.
(FPCore (x y z t a b c i j k)
 :precision binary64
 (if (or (<= x -1.4e+121) (not (<= x 1.7e+130)))
   (* (* z y) (* x (* t 18.0)))
   (- (* c b) (* j (* k 27.0)))))
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 <= -1.4e+121) || !(x <= 1.7e+130)) {
		tmp = (z * y) * (x * (t * 18.0));
	} else {
		tmp = (c * b) - (j * (k * 27.0));
	}
	return tmp;
}
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
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
    real(8) :: tmp
    if ((x <= (-1.4d+121)) .or. (.not. (x <= 1.7d+130))) then
        tmp = (z * y) * (x * (t * 18.0d0))
    else
        tmp = (c * b) - (j * (k * 27.0d0))
    end if
    code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k;
public static 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 <= -1.4e+121) || !(x <= 1.7e+130)) {
		tmp = (z * y) * (x * (t * 18.0));
	} else {
		tmp = (c * b) - (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])
def code(x, y, z, t, a, b, c, i, j, k):
	tmp = 0
	if (x <= -1.4e+121) or not (x <= 1.7e+130):
		tmp = (z * y) * (x * (t * 18.0))
	else:
		tmp = (c * b) - (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])
function code(x, y, z, t, a, b, c, i, j, k)
	tmp = 0.0
	if ((x <= -1.4e+121) || !(x <= 1.7e+130))
		tmp = Float64(Float64(z * y) * Float64(x * Float64(t * 18.0)));
	else
		tmp = Float64(Float64(c * b) - Float64(j * Float64(k * 27.0)));
	end
	return tmp
end
x, y, z, t, a, b, c, i, j, k = num2cell(sort([x, y, z, t, a, b, c, i, j, k])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i, j, k)
	tmp = 0.0;
	if ((x <= -1.4e+121) || ~((x <= 1.7e+130)))
		tmp = (z * y) * (x * (t * 18.0));
	else
		tmp = (c * b) - (j * (k * 27.0));
	end
	tmp_2 = tmp;
end
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[Or[LessEqual[x, -1.4e+121], N[Not[LessEqual[x, 1.7e+130]], $MachinePrecision]], N[(N[(z * y), $MachinePrecision] * N[(x * N[(t * 18.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * b), $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])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{+121} \lor \neg \left(x \leq 1.7 \cdot 10^{+130}\right):\\
\;\;\;\;\left(z \cdot y\right) \cdot \left(x \cdot \left(t \cdot 18\right)\right)\\

\mathbf{else}:\\
\;\;\;\;c \cdot b - j \cdot \left(k \cdot 27\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.40000000000000003e121 or 1.7e130 < x

    1. Initial program 67.9%

      \[\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 y around inf

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

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

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

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

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

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

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

        \[\leadsto \left(\left(\left(z \cdot y\right) \cdot x\right) \cdot t\right) \cdot 18 \]
      8. lower-*.f6456.9

        \[\leadsto \left(\left(\left(z \cdot y\right) \cdot x\right) \cdot t\right) \cdot 18 \]
    5. Applied rewrites56.9%

      \[\leadsto \color{blue}{\left(\left(\left(z \cdot y\right) \cdot x\right) \cdot t\right) \cdot 18} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(\left(\left(z \cdot y\right) \cdot x\right) \cdot t\right) \cdot \color{blue}{18} \]
      2. lift-*.f64N/A

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

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

        \[\leadsto \left(\left(\left(z \cdot y\right) \cdot x\right) \cdot t\right) \cdot 18 \]
      5. associate-*l*N/A

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

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

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

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

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

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

        \[\leadsto \left(\left(z \cdot y\right) \cdot x\right) \cdot \left(\color{blue}{t} \cdot 18\right) \]
      12. lift-*.f64N/A

        \[\leadsto \left(\left(z \cdot y\right) \cdot x\right) \cdot \left(t \cdot 18\right) \]
      13. lower-*.f6456.9

        \[\leadsto \left(\left(z \cdot y\right) \cdot x\right) \cdot \left(t \cdot \color{blue}{18}\right) \]
    7. Applied rewrites56.9%

      \[\leadsto \left(\left(z \cdot y\right) \cdot x\right) \cdot \color{blue}{\left(t \cdot 18\right)} \]
    8. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(\left(z \cdot y\right) \cdot x\right) \cdot \left(t \cdot \color{blue}{18}\right) \]
      2. lift-*.f64N/A

        \[\leadsto \left(\left(z \cdot y\right) \cdot x\right) \cdot \color{blue}{\left(t \cdot 18\right)} \]
      3. lift-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \left(z \cdot y\right) \cdot \left(x \cdot \color{blue}{\left(t \cdot 18\right)}\right) \]
      11. lift-*.f6461.4

        \[\leadsto \left(z \cdot y\right) \cdot \left(x \cdot \left(t \cdot \color{blue}{18}\right)\right) \]
    9. Applied rewrites61.4%

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

    if -1.40000000000000003e121 < x < 1.7e130

    1. Initial program 89.9%

      \[\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(\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) - 4 \cdot \left(a \cdot t\right)\right)} - \left(j \cdot 27\right) \cdot k \]
    4. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto \left(-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) - 4 \cdot \left(a \cdot t\right)\right)}\right) - \left(j \cdot 27\right) \cdot k \]
      2. associate-*r*N/A

        \[\leadsto \left(\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)} - 4 \cdot \left(a \cdot t\right)\right)\right) - \left(j \cdot 27\right) \cdot k \]
      3. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto c \cdot \color{blue}{b} - j \cdot \left(k \cdot 27\right) \]
      2. lift-*.f6451.5

        \[\leadsto c \cdot \color{blue}{b} - j \cdot \left(k \cdot 27\right) \]
    10. Applied rewrites51.5%

      \[\leadsto \color{blue}{c \cdot b} - j \cdot \left(k \cdot 27\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification54.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.4 \cdot 10^{+121} \lor \neg \left(x \leq 1.7 \cdot 10^{+130}\right):\\ \;\;\;\;\left(z \cdot y\right) \cdot \left(x \cdot \left(t \cdot 18\right)\right)\\ \mathbf{else}:\\ \;\;\;\;c \cdot b - j \cdot \left(k \cdot 27\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 48.6% accurate, 2.1× 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])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.4 \cdot 10^{+121}:\\ \;\;\;\;\left(z \cdot y\right) \cdot \left(x \cdot \left(t \cdot 18\right)\right)\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{+129}:\\ \;\;\;\;c \cdot b - j \cdot \left(k \cdot 27\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(y \cdot x\right) \cdot z\right) \cdot t\right) \cdot 18\\ \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.
(FPCore (x y z t a b c i j k)
 :precision binary64
 (if (<= x -1.4e+121)
   (* (* z y) (* x (* t 18.0)))
   (if (<= x 9.5e+129)
     (- (* c b) (* j (* k 27.0)))
     (* (* (* (* y x) z) t) 18.0))))
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 <= -1.4e+121) {
		tmp = (z * y) * (x * (t * 18.0));
	} else if (x <= 9.5e+129) {
		tmp = (c * b) - (j * (k * 27.0));
	} else {
		tmp = (((y * x) * z) * t) * 18.0;
	}
	return tmp;
}
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
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
    real(8) :: tmp
    if (x <= (-1.4d+121)) then
        tmp = (z * y) * (x * (t * 18.0d0))
    else if (x <= 9.5d+129) then
        tmp = (c * b) - (j * (k * 27.0d0))
    else
        tmp = (((y * x) * z) * t) * 18.0d0
    end if
    code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k;
public static 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 <= -1.4e+121) {
		tmp = (z * y) * (x * (t * 18.0));
	} else if (x <= 9.5e+129) {
		tmp = (c * b) - (j * (k * 27.0));
	} else {
		tmp = (((y * x) * z) * t) * 18.0;
	}
	return tmp;
}
[x, y, z, t, a, b, c, i, j, k] = sort([x, y, z, t, a, b, c, i, j, k])
def code(x, y, z, t, a, b, c, i, j, k):
	tmp = 0
	if x <= -1.4e+121:
		tmp = (z * y) * (x * (t * 18.0))
	elif x <= 9.5e+129:
		tmp = (c * b) - (j * (k * 27.0))
	else:
		tmp = (((y * x) * z) * t) * 18.0
	return tmp
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 (x <= -1.4e+121)
		tmp = Float64(Float64(z * y) * Float64(x * Float64(t * 18.0)));
	elseif (x <= 9.5e+129)
		tmp = Float64(Float64(c * b) - Float64(j * Float64(k * 27.0)));
	else
		tmp = Float64(Float64(Float64(Float64(y * x) * z) * t) * 18.0);
	end
	return tmp
end
x, y, z, t, a, b, c, i, j, k = num2cell(sort([x, y, z, t, a, b, c, i, j, k])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i, j, k)
	tmp = 0.0;
	if (x <= -1.4e+121)
		tmp = (z * y) * (x * (t * 18.0));
	elseif (x <= 9.5e+129)
		tmp = (c * b) - (j * (k * 27.0));
	else
		tmp = (((y * x) * z) * t) * 18.0;
	end
	tmp_2 = tmp;
end
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[x, -1.4e+121], N[(N[(z * y), $MachinePrecision] * N[(x * N[(t * 18.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 9.5e+129], N[(N[(c * b), $MachinePrecision] - N[(j * N[(k * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision] * 18.0), $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])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{+121}:\\
\;\;\;\;\left(z \cdot y\right) \cdot \left(x \cdot \left(t \cdot 18\right)\right)\\

\mathbf{elif}\;x \leq 9.5 \cdot 10^{+129}:\\
\;\;\;\;c \cdot b - j \cdot \left(k \cdot 27\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\left(\left(y \cdot x\right) \cdot z\right) \cdot t\right) \cdot 18\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.40000000000000003e121

    1. Initial program 70.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 y around inf

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

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

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

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

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

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

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

        \[\leadsto \left(\left(\left(z \cdot y\right) \cdot x\right) \cdot t\right) \cdot 18 \]
      8. lower-*.f6458.1

        \[\leadsto \left(\left(\left(z \cdot y\right) \cdot x\right) \cdot t\right) \cdot 18 \]
    5. Applied rewrites58.1%

      \[\leadsto \color{blue}{\left(\left(\left(z \cdot y\right) \cdot x\right) \cdot t\right) \cdot 18} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(\left(\left(z \cdot y\right) \cdot x\right) \cdot t\right) \cdot \color{blue}{18} \]
      2. lift-*.f64N/A

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

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

        \[\leadsto \left(\left(\left(z \cdot y\right) \cdot x\right) \cdot t\right) \cdot 18 \]
      5. associate-*l*N/A

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

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

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

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

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

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

        \[\leadsto \left(\left(z \cdot y\right) \cdot x\right) \cdot \left(\color{blue}{t} \cdot 18\right) \]
      12. lift-*.f64N/A

        \[\leadsto \left(\left(z \cdot y\right) \cdot x\right) \cdot \left(t \cdot 18\right) \]
      13. lower-*.f6458.1

        \[\leadsto \left(\left(z \cdot y\right) \cdot x\right) \cdot \left(t \cdot \color{blue}{18}\right) \]
    7. Applied rewrites58.1%

      \[\leadsto \left(\left(z \cdot y\right) \cdot x\right) \cdot \color{blue}{\left(t \cdot 18\right)} \]
    8. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(\left(z \cdot y\right) \cdot x\right) \cdot \left(t \cdot \color{blue}{18}\right) \]
      2. lift-*.f64N/A

        \[\leadsto \left(\left(z \cdot y\right) \cdot x\right) \cdot \color{blue}{\left(t \cdot 18\right)} \]
      3. lift-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \left(z \cdot y\right) \cdot \left(x \cdot \color{blue}{\left(t \cdot 18\right)}\right) \]
      11. lift-*.f6465.0

        \[\leadsto \left(z \cdot y\right) \cdot \left(x \cdot \left(t \cdot \color{blue}{18}\right)\right) \]
    9. Applied rewrites65.0%

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

    if -1.40000000000000003e121 < x < 9.5000000000000004e129

    1. Initial program 89.9%

      \[\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(\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) - 4 \cdot \left(a \cdot t\right)\right)} - \left(j \cdot 27\right) \cdot k \]
    4. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto \left(-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) - 4 \cdot \left(a \cdot t\right)\right)}\right) - \left(j \cdot 27\right) \cdot k \]
      2. associate-*r*N/A

        \[\leadsto \left(\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)} - 4 \cdot \left(a \cdot t\right)\right)\right) - \left(j \cdot 27\right) \cdot k \]
      3. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto c \cdot \color{blue}{b} - j \cdot \left(k \cdot 27\right) \]
      2. lift-*.f6451.5

        \[\leadsto c \cdot \color{blue}{b} - j \cdot \left(k \cdot 27\right) \]
    10. Applied rewrites51.5%

      \[\leadsto \color{blue}{c \cdot b} - j \cdot \left(k \cdot 27\right) \]

    if 9.5000000000000004e129 < x

    1. Initial program 65.2%

      \[\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 y around inf

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

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

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

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

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

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

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

        \[\leadsto \left(\left(\left(z \cdot y\right) \cdot x\right) \cdot t\right) \cdot 18 \]
      8. lower-*.f6455.6

        \[\leadsto \left(\left(\left(z \cdot y\right) \cdot x\right) \cdot t\right) \cdot 18 \]
    5. Applied rewrites55.6%

      \[\leadsto \color{blue}{\left(\left(\left(z \cdot y\right) \cdot x\right) \cdot t\right) \cdot 18} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

        \[\leadsto \left(\left(x \cdot \left(y \cdot z\right)\right) \cdot t\right) \cdot 18 \]
      5. associate-*r*N/A

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

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

        \[\leadsto \left(\left(\left(y \cdot x\right) \cdot z\right) \cdot t\right) \cdot 18 \]
      8. lower-*.f6458.1

        \[\leadsto \left(\left(\left(y \cdot x\right) \cdot z\right) \cdot t\right) \cdot 18 \]
    7. Applied rewrites58.1%

      \[\leadsto \left(\left(\left(y \cdot x\right) \cdot z\right) \cdot t\right) \cdot 18 \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 14: 47.5% accurate, 2.2× 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])\\ \\ \begin{array}{l} \mathbf{if}\;i \leq -8.6 \cdot 10^{+192} \lor \neg \left(i \leq 2.85 \cdot 10^{+139}\right):\\ \;\;\;\;\left(-4 \cdot i\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;c \cdot b - 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.
(FPCore (x y z t a b c i j k)
 :precision binary64
 (if (or (<= i -8.6e+192) (not (<= i 2.85e+139)))
   (* (* -4.0 i) x)
   (- (* c b) (* j (* k 27.0)))))
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 ((i <= -8.6e+192) || !(i <= 2.85e+139)) {
		tmp = (-4.0 * i) * x;
	} else {
		tmp = (c * b) - (j * (k * 27.0));
	}
	return tmp;
}
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
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
    real(8) :: tmp
    if ((i <= (-8.6d+192)) .or. (.not. (i <= 2.85d+139))) then
        tmp = ((-4.0d0) * i) * x
    else
        tmp = (c * b) - (j * (k * 27.0d0))
    end if
    code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k;
public static 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 ((i <= -8.6e+192) || !(i <= 2.85e+139)) {
		tmp = (-4.0 * i) * x;
	} else {
		tmp = (c * b) - (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])
def code(x, y, z, t, a, b, c, i, j, k):
	tmp = 0
	if (i <= -8.6e+192) or not (i <= 2.85e+139):
		tmp = (-4.0 * i) * x
	else:
		tmp = (c * b) - (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])
function code(x, y, z, t, a, b, c, i, j, k)
	tmp = 0.0
	if ((i <= -8.6e+192) || !(i <= 2.85e+139))
		tmp = Float64(Float64(-4.0 * i) * x);
	else
		tmp = Float64(Float64(c * b) - Float64(j * Float64(k * 27.0)));
	end
	return tmp
end
x, y, z, t, a, b, c, i, j, k = num2cell(sort([x, y, z, t, a, b, c, i, j, k])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i, j, k)
	tmp = 0.0;
	if ((i <= -8.6e+192) || ~((i <= 2.85e+139)))
		tmp = (-4.0 * i) * x;
	else
		tmp = (c * b) - (j * (k * 27.0));
	end
	tmp_2 = tmp;
end
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[Or[LessEqual[i, -8.6e+192], N[Not[LessEqual[i, 2.85e+139]], $MachinePrecision]], N[(N[(-4.0 * i), $MachinePrecision] * x), $MachinePrecision], N[(N[(c * b), $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])\\
\\
\begin{array}{l}
\mathbf{if}\;i \leq -8.6 \cdot 10^{+192} \lor \neg \left(i \leq 2.85 \cdot 10^{+139}\right):\\
\;\;\;\;\left(-4 \cdot i\right) \cdot x\\

\mathbf{else}:\\
\;\;\;\;c \cdot b - j \cdot \left(k \cdot 27\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if i < -8.59999999999999952e192 or 2.8499999999999999e139 < i

    1. Initial program 72.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. Taylor expanded in i around inf

      \[\leadsto \color{blue}{-4 \cdot \left(i \cdot x\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(-4 \cdot i\right) \cdot \color{blue}{x} \]
      2. lower-*.f64N/A

        \[\leadsto \left(-4 \cdot i\right) \cdot \color{blue}{x} \]
      3. lower-*.f6457.5

        \[\leadsto \left(-4 \cdot i\right) \cdot x \]
    5. Applied rewrites57.5%

      \[\leadsto \color{blue}{\left(-4 \cdot i\right) \cdot x} \]

    if -8.59999999999999952e192 < i < 2.8499999999999999e139

    1. Initial program 86.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 i around 0

      \[\leadsto \color{blue}{\left(\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) - 4 \cdot \left(a \cdot t\right)\right)} - \left(j \cdot 27\right) \cdot k \]
    4. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto \left(-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) - 4 \cdot \left(a \cdot t\right)\right)}\right) - \left(j \cdot 27\right) \cdot k \]
      2. associate-*r*N/A

        \[\leadsto \left(\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)} - 4 \cdot \left(a \cdot t\right)\right)\right) - \left(j \cdot 27\right) \cdot k \]
      3. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto c \cdot \color{blue}{b} - j \cdot \left(k \cdot 27\right) \]
      2. lift-*.f6445.1

        \[\leadsto c \cdot \color{blue}{b} - j \cdot \left(k \cdot 27\right) \]
    10. Applied rewrites45.1%

      \[\leadsto \color{blue}{c \cdot b} - j \cdot \left(k \cdot 27\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification47.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -8.6 \cdot 10^{+192} \lor \neg \left(i \leq 2.85 \cdot 10^{+139}\right):\\ \;\;\;\;\left(-4 \cdot i\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;c \cdot b - j \cdot \left(k \cdot 27\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 24.3% accurate, 11.3× 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])\\ \\ c \cdot b \end{array} \]
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 (* c b))
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 c * b;
}
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
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 = c * b
end function
assert x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k;
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 c * b;
}
[x, y, z, t, a, b, c, i, j, k] = sort([x, y, z, t, a, b, c, i, j, k])
def code(x, y, z, t, a, b, c, i, j, k):
	return c * b
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(c * b)
end
x, y, z, t, a, b, c, i, j, k = num2cell(sort([x, y, z, t, a, b, c, i, j, k])){:}
function tmp = code(x, y, z, t, a, b, c, i, j, k)
	tmp = c * b;
end
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[(c * b), $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])\\
\\
c \cdot b
\end{array}
Derivation
  1. Initial program 83.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 b around inf

    \[\leadsto \color{blue}{b \cdot c} \]
  4. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto c \cdot \color{blue}{b} \]
    2. lower-*.f6422.4

      \[\leadsto c \cdot \color{blue}{b} \]
  5. Applied rewrites22.4%

    \[\leadsto \color{blue}{c \cdot b} \]
  6. Add Preprocessing

Developer Target 1: 89.0% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(a \cdot t + i \cdot x\right) \cdot 4\\ t_2 := \left(\left(18 \cdot t\right) \cdot \left(\left(x \cdot y\right) \cdot z\right) - t\_1\right) - \left(\left(k \cdot j\right) \cdot 27 - c \cdot b\right)\\ \mathbf{if}\;t < -1.6210815397541398 \cdot 10^{-69}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t < 165.68027943805222:\\ \;\;\;\;\left(\left(18 \cdot y\right) \cdot \left(x \cdot \left(z \cdot t\right)\right) - t\_1\right) + \left(c \cdot b - 27 \cdot \left(k \cdot j\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i j k)
 :precision binary64
 (let* ((t_1 (* (+ (* a t) (* i x)) 4.0))
        (t_2
         (-
          (- (* (* 18.0 t) (* (* x y) z)) t_1)
          (- (* (* k j) 27.0) (* c b)))))
   (if (< t -1.6210815397541398e-69)
     t_2
     (if (< t 165.68027943805222)
       (+ (- (* (* 18.0 y) (* x (* z t))) t_1) (- (* c b) (* 27.0 (* k j))))
       t_2))))
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 = ((a * t) + (i * x)) * 4.0;
	double t_2 = (((18.0 * t) * ((x * y) * z)) - t_1) - (((k * j) * 27.0) - (c * b));
	double tmp;
	if (t < -1.6210815397541398e-69) {
		tmp = t_2;
	} else if (t < 165.68027943805222) {
		tmp = (((18.0 * y) * (x * (z * t))) - t_1) + ((c * b) - (27.0 * (k * j)));
	} else {
		tmp = t_2;
	}
	return tmp;
}
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
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = ((a * t) + (i * x)) * 4.0d0
    t_2 = (((18.0d0 * t) * ((x * y) * z)) - t_1) - (((k * j) * 27.0d0) - (c * b))
    if (t < (-1.6210815397541398d-69)) then
        tmp = t_2
    else if (t < 165.68027943805222d0) then
        tmp = (((18.0d0 * y) * (x * (z * t))) - t_1) + ((c * b) - (27.0d0 * (k * j)))
    else
        tmp = t_2
    end if
    code = tmp
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) {
	double t_1 = ((a * t) + (i * x)) * 4.0;
	double t_2 = (((18.0 * t) * ((x * y) * z)) - t_1) - (((k * j) * 27.0) - (c * b));
	double tmp;
	if (t < -1.6210815397541398e-69) {
		tmp = t_2;
	} else if (t < 165.68027943805222) {
		tmp = (((18.0 * y) * (x * (z * t))) - t_1) + ((c * b) - (27.0 * (k * j)));
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i, j, k):
	t_1 = ((a * t) + (i * x)) * 4.0
	t_2 = (((18.0 * t) * ((x * y) * z)) - t_1) - (((k * j) * 27.0) - (c * b))
	tmp = 0
	if t < -1.6210815397541398e-69:
		tmp = t_2
	elif t < 165.68027943805222:
		tmp = (((18.0 * y) * (x * (z * t))) - t_1) + ((c * b) - (27.0 * (k * j)))
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t, a, b, c, i, j, k)
	t_1 = Float64(Float64(Float64(a * t) + Float64(i * x)) * 4.0)
	t_2 = Float64(Float64(Float64(Float64(18.0 * t) * Float64(Float64(x * y) * z)) - t_1) - Float64(Float64(Float64(k * j) * 27.0) - Float64(c * b)))
	tmp = 0.0
	if (t < -1.6210815397541398e-69)
		tmp = t_2;
	elseif (t < 165.68027943805222)
		tmp = Float64(Float64(Float64(Float64(18.0 * y) * Float64(x * Float64(z * t))) - t_1) + Float64(Float64(c * b) - Float64(27.0 * Float64(k * j))));
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i, j, k)
	t_1 = ((a * t) + (i * x)) * 4.0;
	t_2 = (((18.0 * t) * ((x * y) * z)) - t_1) - (((k * j) * 27.0) - (c * b));
	tmp = 0.0;
	if (t < -1.6210815397541398e-69)
		tmp = t_2;
	elseif (t < 165.68027943805222)
		tmp = (((18.0 * y) * (x * (z * t))) - t_1) + ((c * b) - (27.0 * (k * j)));
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(N[(N[(a * t), $MachinePrecision] + N[(i * x), $MachinePrecision]), $MachinePrecision] * 4.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(18.0 * t), $MachinePrecision] * N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision] - N[(N[(N[(k * j), $MachinePrecision] * 27.0), $MachinePrecision] - N[(c * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t, -1.6210815397541398e-69], t$95$2, If[Less[t, 165.68027943805222], N[(N[(N[(N[(18.0 * y), $MachinePrecision] * N[(x * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision] + N[(N[(c * b), $MachinePrecision] - N[(27.0 * N[(k * j), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(a \cdot t + i \cdot x\right) \cdot 4\\
t_2 := \left(\left(18 \cdot t\right) \cdot \left(\left(x \cdot y\right) \cdot z\right) - t\_1\right) - \left(\left(k \cdot j\right) \cdot 27 - c \cdot b\right)\\
\mathbf{if}\;t < -1.6210815397541398 \cdot 10^{-69}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t < 165.68027943805222:\\
\;\;\;\;\left(\left(18 \cdot y\right) \cdot \left(x \cdot \left(z \cdot t\right)\right) - t\_1\right) + \left(c \cdot b - 27 \cdot \left(k \cdot j\right)\right)\\

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


\end{array}
\end{array}

Reproduce

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