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

Percentage Accurate: 85.3% → 89.8%
Time: 6.7s
Alternatives: 19
Speedup: 0.5×

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}

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 19 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.3% 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: 89.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(j \cdot 27\right) \cdot k\\ \mathbf{if}\;\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - t\_1 \leq \infty:\\ \;\;\;\;\mathsf{fma}\left(c, b, \mathsf{fma}\left(\left(x \cdot y\right) \cdot z, 18, a \cdot -4\right) \cdot t - \mathsf{fma}\left(i \cdot x, 4, \left(j \cdot k\right) \cdot 27\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(y \cdot x\right) \cdot z\right) \cdot t\right) \cdot 18 - t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i j k)
 :precision binary64
 (let* ((t_1 (* (* j 27.0) k)))
   (if (<=
        (-
         (-
          (+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c))
          (* (* x 4.0) i))
         t_1)
        INFINITY)
     (fma
      c
      b
      (-
       (* (fma (* (* x y) z) 18.0 (* a -4.0)) t)
       (fma (* i x) 4.0 (* (* j k) 27.0))))
     (- (* (* (* (* y x) z) t) 18.0) t_1))))
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 (((((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - t_1) <= ((double) INFINITY)) {
		tmp = fma(c, b, ((fma(((x * y) * z), 18.0, (a * -4.0)) * t) - fma((i * x), 4.0, ((j * k) * 27.0))));
	} else {
		tmp = ((((y * x) * z) * t) * 18.0) - t_1;
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i, j, k)
	t_1 = Float64(Float64(j * 27.0) * k)
	tmp = 0.0
	if (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)) - t_1) <= Inf)
		tmp = fma(c, b, Float64(Float64(fma(Float64(Float64(x * y) * z), 18.0, Float64(a * -4.0)) * t) - fma(Float64(i * x), 4.0, Float64(Float64(j * k) * 27.0))));
	else
		tmp = Float64(Float64(Float64(Float64(Float64(y * x) * z) * t) * 18.0) - t_1);
	end
	return tmp
end
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[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] - t$95$1), $MachinePrecision], Infinity], N[(c * b + N[(N[(N[(N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision] * 18.0 + N[(a * -4.0), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision] - N[(N[(i * x), $MachinePrecision] * 4.0 + N[(N[(j * k), $MachinePrecision] * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision] * 18.0), $MachinePrecision] - t$95$1), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - t\_1 \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(c, b, \mathsf{fma}\left(\left(x \cdot y\right) \cdot z, 18, a \cdot -4\right) \cdot t - \mathsf{fma}\left(i \cdot x, 4, \left(j \cdot k\right) \cdot 27\right)\right)\\

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


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

    1. Initial program 95.4%

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

      \[\leadsto \color{blue}{c \cdot b} - \left(j \cdot 27\right) \cdot k \]
    6. Taylor expanded in i around inf

      \[\leadsto \color{blue}{-4 \cdot \left(i \cdot x\right)} - \left(j \cdot 27\right) \cdot k \]
    7. 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. *-commutativeN/A

        \[\leadsto \left(i \cdot -4\right) \cdot x - \left(j \cdot 27\right) \cdot k \]
      4. lower-*.f6433.8

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

      \[\leadsto \color{blue}{\left(i \cdot -4\right) \cdot x} - \left(j \cdot 27\right) \cdot k \]
    9. Taylor expanded in y around inf

      \[\leadsto \color{blue}{18 \cdot \left(t \cdot \left(x \cdot \left(y \cdot z\right)\right)\right)} - \left(j \cdot 27\right) \cdot k \]
    10. 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} - \left(j \cdot 27\right) \cdot k \]
      2. lower-*.f64N/A

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

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

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

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

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

        \[\leadsto \left(\left(\left(y \cdot x\right) \cdot z\right) \cdot t\right) \cdot 18 - \left(j \cdot 27\right) \cdot k \]
      8. lower-*.f6442.2

        \[\leadsto \left(\left(\left(y \cdot x\right) \cdot z\right) \cdot t\right) \cdot 18 - \left(j \cdot 27\right) \cdot k \]
    11. Applied rewrites42.2%

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

Alternative 2: 89.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(j \cdot 27\right) \cdot k\\ \mathbf{if}\;\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - t\_1 \leq \infty:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\left(x \cdot y\right) \cdot z, 18, -4 \cdot a\right), t, c \cdot b\right) - \mathsf{fma}\left(4 \cdot x, i, \left(k \cdot j\right) \cdot 27\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(y \cdot x\right) \cdot z\right) \cdot t\right) \cdot 18 - t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i j k)
 :precision binary64
 (let* ((t_1 (* (* j 27.0) k)))
   (if (<=
        (-
         (-
          (+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c))
          (* (* x 4.0) i))
         t_1)
        INFINITY)
     (-
      (fma (fma (* (* x y) z) 18.0 (* -4.0 a)) t (* c b))
      (fma (* 4.0 x) i (* (* k j) 27.0)))
     (- (* (* (* (* y x) z) t) 18.0) t_1))))
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 (((((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - t_1) <= ((double) INFINITY)) {
		tmp = fma(fma(((x * y) * z), 18.0, (-4.0 * a)), t, (c * b)) - fma((4.0 * x), i, ((k * j) * 27.0));
	} else {
		tmp = ((((y * x) * z) * t) * 18.0) - t_1;
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i, j, k)
	t_1 = Float64(Float64(j * 27.0) * k)
	tmp = 0.0
	if (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)) - t_1) <= Inf)
		tmp = Float64(fma(fma(Float64(Float64(x * y) * z), 18.0, Float64(-4.0 * a)), t, Float64(c * b)) - fma(Float64(4.0 * x), i, Float64(Float64(k * j) * 27.0)));
	else
		tmp = Float64(Float64(Float64(Float64(Float64(y * x) * z) * t) * 18.0) - t_1);
	end
	return tmp
end
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[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] - t$95$1), $MachinePrecision], Infinity], N[(N[(N[(N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision] * 18.0 + N[(-4.0 * a), $MachinePrecision]), $MachinePrecision] * t + N[(c * b), $MachinePrecision]), $MachinePrecision] - N[(N[(4.0 * x), $MachinePrecision] * i + N[(N[(k * j), $MachinePrecision] * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision] * 18.0), $MachinePrecision] - t$95$1), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - t\_1 \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\left(x \cdot y\right) \cdot z, 18, -4 \cdot a\right), t, c \cdot b\right) - \mathsf{fma}\left(4 \cdot x, i, \left(k \cdot j\right) \cdot 27\right)\\

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


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

    1. Initial program 95.4%

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

      \[\leadsto \color{blue}{c \cdot b} - \left(j \cdot 27\right) \cdot k \]
    6. Taylor expanded in i around inf

      \[\leadsto \color{blue}{-4 \cdot \left(i \cdot x\right)} - \left(j \cdot 27\right) \cdot k \]
    7. 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. *-commutativeN/A

        \[\leadsto \left(i \cdot -4\right) \cdot x - \left(j \cdot 27\right) \cdot k \]
      4. lower-*.f6433.8

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

      \[\leadsto \color{blue}{\left(i \cdot -4\right) \cdot x} - \left(j \cdot 27\right) \cdot k \]
    9. Taylor expanded in y around inf

      \[\leadsto \color{blue}{18 \cdot \left(t \cdot \left(x \cdot \left(y \cdot z\right)\right)\right)} - \left(j \cdot 27\right) \cdot k \]
    10. 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} - \left(j \cdot 27\right) \cdot k \]
      2. lower-*.f64N/A

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

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

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

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

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

        \[\leadsto \left(\left(\left(y \cdot x\right) \cdot z\right) \cdot t\right) \cdot 18 - \left(j \cdot 27\right) \cdot k \]
      8. lower-*.f6442.2

        \[\leadsto \left(\left(\left(y \cdot x\right) \cdot z\right) \cdot t\right) \cdot 18 - \left(j \cdot 27\right) \cdot k \]
    11. Applied rewrites42.2%

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

Alternative 3: 66.8% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b, c, \mathsf{fma}\left(i, x, t \cdot a\right) \cdot -4\right)\\
t_2 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+147}:\\
\;\;\;\;\mathsf{fma}\left(c, b, \left(k \cdot j\right) \cdot -27\right)\\

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-227}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 10^{-99}:\\
\;\;\;\;\mathsf{fma}\left(\left(t \cdot z\right) \cdot 18, y, i \cdot -4\right) \cdot x\\

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+51}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(a \cdot t\right) - t\_2\\


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

    1. Initial program 79.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. Applied rewrites81.9%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(c, b, \left(k \cdot j\right) \cdot -27\right) \]
      4. lift-*.f6469.8

        \[\leadsto \mathsf{fma}\left(c, b, \left(k \cdot j\right) \cdot -27\right) \]
    7. Applied rewrites69.8%

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

    if -2e147 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 1.99999999999999989e-227 or 1e-99 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 2e51

    1. Initial program 87.6%

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

      \[\leadsto \color{blue}{\left(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-*.f6483.0

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

      \[\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)} \]
    6. Taylor expanded in y around 0

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(b, c, \mathsf{fma}\left(i, x, t \cdot a\right) \cdot -4\right) \]
      9. lower-*.f6470.7

        \[\leadsto \mathsf{fma}\left(b, c, \mathsf{fma}\left(i, x, t \cdot a\right) \cdot -4\right) \]
    8. Applied rewrites70.7%

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

    if 1.99999999999999989e-227 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 1e-99

    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 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-*.f6451.1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2e51 < (*.f64 (*.f64 j #s(literal 27 binary64)) k)

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

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

        \[\leadsto -4 \cdot \color{blue}{\left(a \cdot t\right)} - \left(j \cdot 27\right) \cdot k \]
      2. lower-*.f6459.7

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

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

Alternative 4: 67.0% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b, c, \mathsf{fma}\left(i, x, t \cdot a\right) \cdot -4\right)\\
t_2 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+147}:\\
\;\;\;\;\mathsf{fma}\left(c, b, \left(k \cdot j\right) \cdot -27\right)\\

\mathbf{elif}\;t\_2 \leq 10^{-251}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{-137}:\\
\;\;\;\;\mathsf{fma}\left(\left(y \cdot x\right) \cdot z, 18, -4 \cdot a\right) \cdot t\\

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+51}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(a \cdot t\right) - t\_2\\


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

    1. Initial program 79.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. Applied rewrites81.9%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(c, b, \left(k \cdot j\right) \cdot -27\right) \]
      4. lift-*.f6469.8

        \[\leadsto \mathsf{fma}\left(c, b, \left(k \cdot j\right) \cdot -27\right) \]
    7. Applied rewrites69.8%

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

    if -2e147 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 1.00000000000000002e-251 or 3.99999999999999991e-137 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 2e51

    1. Initial program 87.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 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-*.f6482.9

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

      \[\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)} \]
    6. Taylor expanded in y around 0

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(b, c, \mathsf{fma}\left(i, x, t \cdot a\right) \cdot -4\right) \]
      9. lower-*.f6470.6

        \[\leadsto \mathsf{fma}\left(b, c, \mathsf{fma}\left(i, x, t \cdot a\right) \cdot -4\right) \]
    8. Applied rewrites70.6%

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

    if 1.00000000000000002e-251 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 3.99999999999999991e-137

    1. Initial program 86.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. Applied rewrites86.7%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-4 \cdot a + 18 \cdot \left(x \cdot \left(y \cdot z\right)\right)\right) \cdot \color{blue}{t} \]
    9. Applied rewrites51.0%

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

    if 2e51 < (*.f64 (*.f64 j #s(literal 27 binary64)) k)

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

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

        \[\leadsto -4 \cdot \color{blue}{\left(a \cdot t\right)} - \left(j \cdot 27\right) \cdot k \]
      2. lower-*.f6459.7

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

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

Alternative 5: 66.6% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b, c, \mathsf{fma}\left(i, x, t \cdot a\right) \cdot -4\right)\\
t_2 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+147}:\\
\;\;\;\;\mathsf{fma}\left(c, b, \left(k \cdot j\right) \cdot -27\right)\\

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-207}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{-137}:\\
\;\;\;\;\left(\left(\left(y \cdot x\right) \cdot z\right) \cdot t\right) \cdot 18\\

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+51}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(a \cdot t\right) - t\_2\\


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

    1. Initial program 79.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. Applied rewrites81.9%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(c, b, \left(k \cdot j\right) \cdot -27\right) \]
      4. lift-*.f6469.8

        \[\leadsto \mathsf{fma}\left(c, b, \left(k \cdot j\right) \cdot -27\right) \]
    7. Applied rewrites69.8%

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

    if -2e147 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 5.00000000000000014e-207 or 3.99999999999999991e-137 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 2e51

    1. Initial program 87.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 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-*.f6483.1

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

      \[\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)} \]
    6. Taylor expanded in y around 0

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(b, c, \mathsf{fma}\left(i, x, t \cdot a\right) \cdot -4\right) \]
      9. lower-*.f6470.8

        \[\leadsto \mathsf{fma}\left(b, c, \mathsf{fma}\left(i, x, t \cdot a\right) \cdot -4\right) \]
    8. Applied rewrites70.8%

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

    if 5.00000000000000014e-207 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 3.99999999999999991e-137

    1. Initial program 85.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. Applied rewrites85.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2e51 < (*.f64 (*.f64 j #s(literal 27 binary64)) k)

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

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

        \[\leadsto -4 \cdot \color{blue}{\left(a \cdot t\right)} - \left(j \cdot 27\right) \cdot k \]
      2. lower-*.f6459.7

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

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

Alternative 6: 67.8% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(c, b, \left(k \cdot j\right) \cdot -27\right)\\
t_2 := \mathsf{fma}\left(b, c, \mathsf{fma}\left(i, x, t \cdot a\right) \cdot -4\right)\\
t_3 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_3 \leq -2 \cdot 10^{+147}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_3 \leq 5 \cdot 10^{-207}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_3 \leq 4 \cdot 10^{-137}:\\
\;\;\;\;\left(\left(\left(y \cdot x\right) \cdot z\right) \cdot t\right) \cdot 18\\

\mathbf{elif}\;t\_3 \leq 10^{+98}:\\
\;\;\;\;t\_2\\

\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) < -2e147 or 9.99999999999999998e97 < (*.f64 (*.f64 j #s(literal 27 binary64)) k)

    1. Initial program 81.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. Applied rewrites83.9%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(c, b, \left(k \cdot j\right) \cdot -27\right) \]
      4. lift-*.f6467.8

        \[\leadsto \mathsf{fma}\left(c, b, \left(k \cdot j\right) \cdot -27\right) \]
    7. Applied rewrites67.8%

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

    if -2e147 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 5.00000000000000014e-207 or 3.99999999999999991e-137 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 9.99999999999999998e97

    1. Initial program 87.4%

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

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

      \[\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)} \]
    6. Taylor expanded in y around 0

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(b, c, \mathsf{fma}\left(i, x, t \cdot a\right) \cdot -4\right) \]
      9. lower-*.f6470.4

        \[\leadsto \mathsf{fma}\left(b, c, \mathsf{fma}\left(i, x, t \cdot a\right) \cdot -4\right) \]
    8. Applied rewrites70.4%

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

    if 5.00000000000000014e-207 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 3.99999999999999991e-137

    1. Initial program 85.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. Applied rewrites85.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\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 7: 53.7% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(c, b, \left(k \cdot j\right) \cdot -27\right)\\
t_2 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+68}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 10^{-192}:\\
\;\;\;\;\mathsf{fma}\left(c, b, \left(i \cdot x\right) \cdot -4\right)\\

\mathbf{elif}\;t\_2 \leq 10^{-99}:\\
\;\;\;\;\left(\left(\left(z \cdot y\right) \cdot 18\right) \cdot t\right) \cdot x\\

\mathbf{elif}\;t\_2 \leq 10^{+60}:\\
\;\;\;\;\mathsf{fma}\left(i \cdot -4, x, b \cdot c\right)\\

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


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

    1. Initial program 82.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. Applied rewrites84.9%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(c, b, \left(k \cdot j\right) \cdot -27\right) \]
      4. lift-*.f6462.4

        \[\leadsto \mathsf{fma}\left(c, b, \left(k \cdot j\right) \cdot -27\right) \]
    7. Applied rewrites62.4%

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

    if -9.99999999999999953e67 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 1.0000000000000001e-192

    1. Initial program 87.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. Applied rewrites89.4%

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

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

      \[\leadsto \mathsf{fma}\left(c, b, \color{blue}{-4 \cdot \left(i \cdot x\right)}\right) \]
    6. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \mathsf{fma}\left(c, b, \left(i \cdot x\right) \cdot \color{blue}{-4}\right) \]
      3. lift-*.f6450.7

        \[\leadsto \mathsf{fma}\left(c, b, \left(i \cdot x\right) \cdot -4\right) \]
    7. Applied rewrites50.7%

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

    if 1.0000000000000001e-192 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 1e-99

    1. Initial program 85.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 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-*.f6452.6

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(18 \cdot t, z \cdot y, -4 \cdot i\right) \cdot x} \]
    6. Taylor expanded in t around inf

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\mathsf{fma}\left(\frac{i}{t}, -4, \left(y \cdot z\right) \cdot 18\right) \cdot t\right) \cdot x \]
    9. Taylor expanded in y around inf

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

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

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

        \[\leadsto \left(\left(\left(z \cdot y\right) \cdot 18\right) \cdot t\right) \cdot x \]
      4. lift-*.f6429.0

        \[\leadsto \left(\left(\left(z \cdot y\right) \cdot 18\right) \cdot t\right) \cdot x \]
    11. Applied rewrites29.0%

      \[\leadsto \left(\left(\left(z \cdot y\right) \cdot 18\right) \cdot t\right) \cdot x \]

    if 1e-99 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 9.9999999999999995e59

    1. Initial program 88.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 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-*.f6480.6

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

      \[\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)} \]
    6. Taylor expanded in t around 0

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

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

        \[\leadsto b \cdot c + -4 \cdot \left(i \cdot x\right) \]
      3. +-commutativeN/A

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

        \[\leadsto \left(-4 \cdot i\right) \cdot x + b \cdot c \]
      5. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(i \cdot -4, x, b \cdot c\right) \]
      8. lower-*.f6448.1

        \[\leadsto \mathsf{fma}\left(i \cdot -4, x, b \cdot c\right) \]
    8. Applied rewrites48.1%

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

Alternative 8: 53.7% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(c, b, \left(k \cdot j\right) \cdot -27\right)\\
t_2 := \mathsf{fma}\left(c, b, \left(i \cdot x\right) \cdot -4\right)\\
t_3 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_3 \leq -1 \cdot 10^{+68}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_3 \leq 10^{-251}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_3 \leq 4 \cdot 10^{-137}:\\
\;\;\;\;\left(\left(\left(y \cdot x\right) \cdot z\right) \cdot t\right) \cdot 18\\

\mathbf{elif}\;t\_3 \leq 10^{+60}:\\
\;\;\;\;t\_2\\

\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) < -9.99999999999999953e67 or 9.9999999999999995e59 < (*.f64 (*.f64 j #s(literal 27 binary64)) k)

    1. Initial program 82.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. Applied rewrites84.9%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(c, b, \left(k \cdot j\right) \cdot -27\right) \]
      4. lift-*.f6462.4

        \[\leadsto \mathsf{fma}\left(c, b, \left(k \cdot j\right) \cdot -27\right) \]
    7. Applied rewrites62.4%

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

    if -9.99999999999999953e67 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 1.00000000000000002e-251 or 3.99999999999999991e-137 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 9.9999999999999995e59

    1. Initial program 87.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. Applied rewrites89.7%

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

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

      \[\leadsto \mathsf{fma}\left(c, b, \color{blue}{-4 \cdot \left(i \cdot x\right)}\right) \]
    6. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \mathsf{fma}\left(c, b, \left(i \cdot x\right) \cdot \color{blue}{-4}\right) \]
      3. lift-*.f6450.2

        \[\leadsto \mathsf{fma}\left(c, b, \left(i \cdot x\right) \cdot -4\right) \]
    7. Applied rewrites50.2%

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

    if 1.00000000000000002e-251 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 3.99999999999999991e-137

    1. Initial program 86.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. Applied rewrites86.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(\left(y \cdot x\right) \cdot z\right) \cdot t\right) \cdot 18 \]
      10. lower-*.f6429.2

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

      \[\leadsto \color{blue}{\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 9: 79.9% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(c, b, -\mathsf{fma}\left(4 \cdot i, x, \left(k \cdot j\right) \cdot 27\right)\right)\\
t_2 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+147}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 10^{+18}:\\
\;\;\;\;\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)\\

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


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

    1. Initial program 81.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. Applied rewrites84.8%

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

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

      \[\leadsto \mathsf{fma}\left(c, b, \color{blue}{-1 \cdot \left(4 \cdot \left(i \cdot x\right) + 27 \cdot \left(j \cdot k\right)\right)}\right) \]
    6. Step-by-step derivation
      1. mul-1-negN/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(c, b, -\mathsf{fma}\left(4 \cdot i, x, \left(k \cdot j\right) \cdot 27\right)\right) \]
      9. lift-*.f6474.3

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

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

    if -2e147 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 1e18

    1. Initial program 87.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 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-*.f6483.3

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

      \[\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)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 10: 35.3% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(j \cdot 27\right) \cdot k\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{+147}:\\ \;\;\;\;-27 \cdot \left(k \cdot j\right)\\ \mathbf{elif}\;t\_1 \leq 10^{-99}:\\ \;\;\;\;-4 \cdot \left(a \cdot t\right)\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+51}:\\ \;\;\;\;c \cdot b\\ \mathbf{else}:\\ \;\;\;\;\left(-27 \cdot k\right) \cdot j\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i j k)
 :precision binary64
 (let* ((t_1 (* (* j 27.0) k)))
   (if (<= t_1 -2e+147)
     (* -27.0 (* k j))
     (if (<= t_1 1e-99)
       (* -4.0 (* a t))
       (if (<= t_1 2e+51) (* c b) (* (* -27.0 k) j))))))
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+147) {
		tmp = -27.0 * (k * j);
	} else if (t_1 <= 1e-99) {
		tmp = -4.0 * (a * t);
	} else if (t_1 <= 2e+51) {
		tmp = c * b;
	} else {
		tmp = (-27.0 * k) * j;
	}
	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) :: tmp
    t_1 = (j * 27.0d0) * k
    if (t_1 <= (-2d+147)) then
        tmp = (-27.0d0) * (k * j)
    else if (t_1 <= 1d-99) then
        tmp = (-4.0d0) * (a * t)
    else if (t_1 <= 2d+51) then
        tmp = c * b
    else
        tmp = ((-27.0d0) * k) * j
    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 = (j * 27.0) * k;
	double tmp;
	if (t_1 <= -2e+147) {
		tmp = -27.0 * (k * j);
	} else if (t_1 <= 1e-99) {
		tmp = -4.0 * (a * t);
	} else if (t_1 <= 2e+51) {
		tmp = c * b;
	} else {
		tmp = (-27.0 * k) * j;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i, j, k):
	t_1 = (j * 27.0) * k
	tmp = 0
	if t_1 <= -2e+147:
		tmp = -27.0 * (k * j)
	elif t_1 <= 1e-99:
		tmp = -4.0 * (a * t)
	elif t_1 <= 2e+51:
		tmp = c * b
	else:
		tmp = (-27.0 * k) * j
	return tmp
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+147)
		tmp = Float64(-27.0 * Float64(k * j));
	elseif (t_1 <= 1e-99)
		tmp = Float64(-4.0 * Float64(a * t));
	elseif (t_1 <= 2e+51)
		tmp = Float64(c * b);
	else
		tmp = Float64(Float64(-27.0 * k) * j);
	end
	return tmp
end
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+147)
		tmp = -27.0 * (k * j);
	elseif (t_1 <= 1e-99)
		tmp = -4.0 * (a * t);
	elseif (t_1 <= 2e+51)
		tmp = c * b;
	else
		tmp = (-27.0 * k) * j;
	end
	tmp_2 = tmp;
end
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+147], N[(-27.0 * N[(k * j), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e-99], N[(-4.0 * N[(a * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+51], N[(c * b), $MachinePrecision], N[(N[(-27.0 * k), $MachinePrecision] * j), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+147}:\\
\;\;\;\;-27 \cdot \left(k \cdot j\right)\\

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

\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+51}:\\
\;\;\;\;c \cdot b\\

\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) < -2e147

    1. Initial program 79.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 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-*.f6460.3

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

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

    if -2e147 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 1e-99

    1. Initial program 87.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 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-*.f6425.0

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

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

    if 1e-99 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 2e51

    1. Initial program 88.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-*.f6426.6

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

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

    if 2e51 < (*.f64 (*.f64 j #s(literal 27 binary64)) k)

    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 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-*.f6448.9

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

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

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

        \[\leadsto -27 \cdot \left(k \cdot \color{blue}{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-*.f6448.9

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

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

Alternative 11: 35.3% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \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^{+147}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 10^{-99}:\\ \;\;\;\;-4 \cdot \left(a \cdot t\right)\\ \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+51}:\\ \;\;\;\;c \cdot b\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(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+147)
     t_1
     (if (<= t_2 1e-99) (* -4.0 (* a t)) (if (<= t_2 2e+51) (* c b) t_1)))))
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+147) {
		tmp = t_1;
	} else if (t_2 <= 1e-99) {
		tmp = -4.0 * (a * t);
	} else if (t_2 <= 2e+51) {
		tmp = c * b;
	} else {
		tmp = t_1;
	}
	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 = (-27.0d0) * (k * j)
    t_2 = (j * 27.0d0) * k
    if (t_2 <= (-2d+147)) then
        tmp = t_1
    else if (t_2 <= 1d-99) then
        tmp = (-4.0d0) * (a * t)
    else if (t_2 <= 2d+51) then
        tmp = c * b
    else
        tmp = t_1
    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 = -27.0 * (k * j);
	double t_2 = (j * 27.0) * k;
	double tmp;
	if (t_2 <= -2e+147) {
		tmp = t_1;
	} else if (t_2 <= 1e-99) {
		tmp = -4.0 * (a * t);
	} else if (t_2 <= 2e+51) {
		tmp = c * b;
	} else {
		tmp = t_1;
	}
	return tmp;
}
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+147:
		tmp = t_1
	elif t_2 <= 1e-99:
		tmp = -4.0 * (a * t)
	elif t_2 <= 2e+51:
		tmp = c * b
	else:
		tmp = t_1
	return tmp
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+147)
		tmp = t_1;
	elseif (t_2 <= 1e-99)
		tmp = Float64(-4.0 * Float64(a * t));
	elseif (t_2 <= 2e+51)
		tmp = Float64(c * b);
	else
		tmp = t_1;
	end
	return tmp
end
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+147)
		tmp = t_1;
	elseif (t_2 <= 1e-99)
		tmp = -4.0 * (a * t);
	elseif (t_2 <= 2e+51)
		tmp = c * b;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
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+147], t$95$1, If[LessEqual[t$95$2, 1e-99], N[(-4.0 * N[(a * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+51], N[(c * b), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

\\
\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^{+147}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+51}:\\
\;\;\;\;c \cdot b\\

\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) < -2e147 or 2e51 < (*.f64 (*.f64 j #s(literal 27 binary64)) k)

    1. Initial program 81.4%

      \[\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-*.f6453.6

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

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

    if -2e147 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 1e-99

    1. Initial program 87.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 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-*.f6425.0

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

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

    if 1e-99 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 2e51

    1. Initial program 88.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-*.f6426.6

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

      \[\leadsto \color{blue}{c \cdot b} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 12: 55.2% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(c, b, \left(k \cdot j\right) \cdot -27\right)\\
t_2 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+68}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 10^{+60}:\\
\;\;\;\;\mathsf{fma}\left(c, b, \left(i \cdot x\right) \cdot -4\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 j #s(literal 27 binary64)) k) < -9.99999999999999953e67 or 9.9999999999999995e59 < (*.f64 (*.f64 j #s(literal 27 binary64)) k)

    1. Initial program 82.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. Applied rewrites84.9%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(c, b, \left(k \cdot j\right) \cdot -27\right) \]
      4. lift-*.f6462.4

        \[\leadsto \mathsf{fma}\left(c, b, \left(k \cdot j\right) \cdot -27\right) \]
    7. Applied rewrites62.4%

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

    if -9.99999999999999953e67 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 9.9999999999999995e59

    1. Initial program 87.4%

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

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

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

      \[\leadsto \mathsf{fma}\left(c, b, \color{blue}{-4 \cdot \left(i \cdot x\right)}\right) \]
    6. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \mathsf{fma}\left(c, b, \left(i \cdot x\right) \cdot \color{blue}{-4}\right) \]
      3. lift-*.f6450.4

        \[\leadsto \mathsf{fma}\left(c, b, \left(i \cdot x\right) \cdot -4\right) \]
    7. Applied rewrites50.4%

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

Alternative 13: 52.2% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \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^{+262}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+195}:\\ \;\;\;\;\mathsf{fma}\left(c, b, \left(i \cdot x\right) \cdot -4\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(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+262)
     t_1
     (if (<= t_2 5e+195) (fma c b (* (* i x) -4.0)) t_1))))
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+262) {
		tmp = t_1;
	} else if (t_2 <= 5e+195) {
		tmp = fma(c, b, ((i * x) * -4.0));
	} else {
		tmp = t_1;
	}
	return tmp;
}
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+262)
		tmp = t_1;
	elseif (t_2 <= 5e+195)
		tmp = fma(c, b, Float64(Float64(i * x) * -4.0));
	else
		tmp = t_1;
	end
	return tmp
end
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+262], t$95$1, If[LessEqual[t$95$2, 5e+195], N[(c * b + N[(N[(i * x), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\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^{+262}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+195}:\\
\;\;\;\;\mathsf{fma}\left(c, b, \left(i \cdot x\right) \cdot -4\right)\\

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


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

    1. Initial program 76.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-*.f6472.3

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

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

    if -2e262 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 4.9999999999999998e195

    1. Initial program 87.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. Applied rewrites89.6%

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

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

      \[\leadsto \mathsf{fma}\left(c, b, \color{blue}{-4 \cdot \left(i \cdot x\right)}\right) \]
    6. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \mathsf{fma}\left(c, b, \left(i \cdot x\right) \cdot \color{blue}{-4}\right) \]
      3. lift-*.f6447.3

        \[\leadsto \mathsf{fma}\left(c, b, \left(i \cdot x\right) \cdot -4\right) \]
    7. Applied rewrites47.3%

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

Alternative 14: 52.3% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \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^{+262}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+195}:\\ \;\;\;\;\mathsf{fma}\left(i \cdot -4, x, b \cdot c\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(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+262)
     t_1
     (if (<= t_2 5e+195) (fma (* i -4.0) x (* b c)) t_1))))
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+262) {
		tmp = t_1;
	} else if (t_2 <= 5e+195) {
		tmp = fma((i * -4.0), x, (b * c));
	} else {
		tmp = t_1;
	}
	return tmp;
}
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+262)
		tmp = t_1;
	elseif (t_2 <= 5e+195)
		tmp = fma(Float64(i * -4.0), x, Float64(b * c));
	else
		tmp = t_1;
	end
	return tmp
end
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+262], t$95$1, If[LessEqual[t$95$2, 5e+195], N[(N[(i * -4.0), $MachinePrecision] * x + N[(b * c), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\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^{+262}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+195}:\\
\;\;\;\;\mathsf{fma}\left(i \cdot -4, x, b \cdot c\right)\\

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


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

    1. Initial program 76.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-*.f6472.3

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

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

    if -2e262 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 4.9999999999999998e195

    1. Initial program 87.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 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-*.f6479.0

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

      \[\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)} \]
    6. Taylor expanded in t around 0

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

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

        \[\leadsto b \cdot c + -4 \cdot \left(i \cdot x\right) \]
      3. +-commutativeN/A

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

        \[\leadsto \left(-4 \cdot i\right) \cdot x + b \cdot c \]
      5. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(i \cdot -4, x, b \cdot c\right) \]
      8. lower-*.f6447.3

        \[\leadsto \mathsf{fma}\left(i \cdot -4, x, b \cdot c\right) \]
    8. Applied rewrites47.3%

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

Alternative 15: 72.5% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(\left(y \cdot x\right) \cdot z, 18, -4 \cdot a\right) \cdot t\\ \mathbf{if}\;t \leq -2.65 \cdot 10^{+122}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 7.8 \cdot 10^{+62}:\\ \;\;\;\;\mathsf{fma}\left(c, b, -\mathsf{fma}\left(4 \cdot i, x, \left(k \cdot j\right) \cdot 27\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i j k)
 :precision binary64
 (let* ((t_1 (* (fma (* (* y x) z) 18.0 (* -4.0 a)) t)))
   (if (<= t -2.65e+122)
     t_1
     (if (<= t 7.8e+62)
       (fma c b (- (fma (* 4.0 i) x (* (* k j) 27.0))))
       t_1))))
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(((y * x) * z), 18.0, (-4.0 * a)) * t;
	double tmp;
	if (t <= -2.65e+122) {
		tmp = t_1;
	} else if (t <= 7.8e+62) {
		tmp = fma(c, b, -fma((4.0 * i), x, ((k * j) * 27.0)));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i, j, k)
	t_1 = Float64(fma(Float64(Float64(y * x) * z), 18.0, Float64(-4.0 * a)) * t)
	tmp = 0.0
	if (t <= -2.65e+122)
		tmp = t_1;
	elseif (t <= 7.8e+62)
		tmp = fma(c, b, Float64(-fma(Float64(4.0 * i), x, Float64(Float64(k * j) * 27.0))));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(N[(N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision] * 18.0 + N[(-4.0 * a), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -2.65e+122], t$95$1, If[LessEqual[t, 7.8e+62], N[(c * b + (-N[(N[(4.0 * i), $MachinePrecision] * x + N[(N[(k * j), $MachinePrecision] * 27.0), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\left(y \cdot x\right) \cdot z, 18, -4 \cdot a\right) \cdot t\\
\mathbf{if}\;t \leq -2.65 \cdot 10^{+122}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.65e122 or 7.8e62 < t

    1. Initial program 81.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. Applied rewrites88.7%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-4 \cdot a + 18 \cdot \left(x \cdot \left(y \cdot z\right)\right)\right) \cdot \color{blue}{t} \]
    9. Applied rewrites70.0%

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

    if -2.65e122 < t < 7.8e62

    1. Initial program 87.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. Applied rewrites87.0%

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

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

      \[\leadsto \mathsf{fma}\left(c, b, \color{blue}{-1 \cdot \left(4 \cdot \left(i \cdot x\right) + 27 \cdot \left(j \cdot k\right)\right)}\right) \]
    6. Step-by-step derivation
      1. mul-1-negN/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(c, b, -\mathsf{fma}\left(4 \cdot i, x, \left(k \cdot j\right) \cdot 27\right)\right) \]
      9. lift-*.f6473.8

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

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

Alternative 16: 72.0% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(\left(y \cdot x\right) \cdot z, 18, -4 \cdot a\right) \cdot t\\ \mathbf{if}\;t \leq -2.65 \cdot 10^{+122}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 7.8 \cdot 10^{+62}:\\ \;\;\;\;b \cdot c - \mathsf{fma}\left(4 \cdot x, i, \left(k \cdot j\right) \cdot 27\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i j k)
 :precision binary64
 (let* ((t_1 (* (fma (* (* y x) z) 18.0 (* -4.0 a)) t)))
   (if (<= t -2.65e+122)
     t_1
     (if (<= t 7.8e+62) (- (* b c) (fma (* 4.0 x) i (* (* k j) 27.0))) t_1))))
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(((y * x) * z), 18.0, (-4.0 * a)) * t;
	double tmp;
	if (t <= -2.65e+122) {
		tmp = t_1;
	} else if (t <= 7.8e+62) {
		tmp = (b * c) - fma((4.0 * x), i, ((k * j) * 27.0));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i, j, k)
	t_1 = Float64(fma(Float64(Float64(y * x) * z), 18.0, Float64(-4.0 * a)) * t)
	tmp = 0.0
	if (t <= -2.65e+122)
		tmp = t_1;
	elseif (t <= 7.8e+62)
		tmp = Float64(Float64(b * c) - fma(Float64(4.0 * x), i, Float64(Float64(k * j) * 27.0)));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(N[(N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision] * 18.0 + N[(-4.0 * a), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -2.65e+122], t$95$1, If[LessEqual[t, 7.8e+62], N[(N[(b * c), $MachinePrecision] - N[(N[(4.0 * x), $MachinePrecision] * i + N[(N[(k * j), $MachinePrecision] * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\left(y \cdot x\right) \cdot z, 18, -4 \cdot a\right) \cdot t\\
\mathbf{if}\;t \leq -2.65 \cdot 10^{+122}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.65e122 or 7.8e62 < t

    1. Initial program 81.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. Applied rewrites88.7%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-4 \cdot a + 18 \cdot \left(x \cdot \left(y \cdot z\right)\right)\right) \cdot \color{blue}{t} \]
    9. Applied rewrites70.0%

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

    if -2.65e122 < t < 7.8e62

    1. Initial program 87.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. Applied rewrites87.0%

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

      \[\leadsto \color{blue}{b \cdot c} - \mathsf{fma}\left(4 \cdot x, i, \left(k \cdot j\right) \cdot 27\right) \]
    5. Step-by-step derivation
      1. lower-*.f6473.1

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

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

Alternative 17: 36.9% accurate, 2.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \cdot c \leq -4 \cdot 10^{+162}:\\ \;\;\;\;c \cdot b\\ \mathbf{elif}\;b \cdot c \leq 4 \cdot 10^{+110}:\\ \;\;\;\;-27 \cdot \left(k \cdot j\right)\\ \mathbf{else}:\\ \;\;\;\;c \cdot b\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i j k)
 :precision binary64
 (if (<= (* b c) -4e+162)
   (* c b)
   (if (<= (* b c) 4e+110) (* -27.0 (* k j)) (* c b))))
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 ((b * c) <= -4e+162) {
		tmp = c * b;
	} else if ((b * c) <= 4e+110) {
		tmp = -27.0 * (k * j);
	} else {
		tmp = c * b;
	}
	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) :: tmp
    if ((b * c) <= (-4d+162)) then
        tmp = c * b
    else if ((b * c) <= 4d+110) then
        tmp = (-27.0d0) * (k * j)
    else
        tmp = c * b
    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 tmp;
	if ((b * c) <= -4e+162) {
		tmp = c * b;
	} else if ((b * c) <= 4e+110) {
		tmp = -27.0 * (k * j);
	} else {
		tmp = c * b;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i, j, k):
	tmp = 0
	if (b * c) <= -4e+162:
		tmp = c * b
	elif (b * c) <= 4e+110:
		tmp = -27.0 * (k * j)
	else:
		tmp = c * b
	return tmp
function code(x, y, z, t, a, b, c, i, j, k)
	tmp = 0.0
	if (Float64(b * c) <= -4e+162)
		tmp = Float64(c * b);
	elseif (Float64(b * c) <= 4e+110)
		tmp = Float64(-27.0 * Float64(k * j));
	else
		tmp = Float64(c * b);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i, j, k)
	tmp = 0.0;
	if ((b * c) <= -4e+162)
		tmp = c * b;
	elseif ((b * c) <= 4e+110)
		tmp = -27.0 * (k * j);
	else
		tmp = c * b;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := If[LessEqual[N[(b * c), $MachinePrecision], -4e+162], N[(c * b), $MachinePrecision], If[LessEqual[N[(b * c), $MachinePrecision], 4e+110], N[(-27.0 * N[(k * j), $MachinePrecision]), $MachinePrecision], N[(c * b), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \cdot c \leq -4 \cdot 10^{+162}:\\
\;\;\;\;c \cdot b\\

\mathbf{elif}\;b \cdot c \leq 4 \cdot 10^{+110}:\\
\;\;\;\;-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 b c) < -3.9999999999999998e162 or 4.0000000000000001e110 < (*.f64 b c)

    1. Initial program 81.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-*.f6460.0

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

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

    if -3.9999999999999998e162 < (*.f64 b c) < 4.0000000000000001e110

    1. Initial program 86.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 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-*.f6427.1

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

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

Alternative 18: 32.0% accurate, 2.3× speedup?

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

\\
\begin{array}{l}
t_1 := -4 \cdot \left(a \cdot t\right)\\
\mathbf{if}\;a \leq -2.6 \cdot 10^{+65}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;a \leq -1.15 \cdot 10^{-171}:\\
\;\;\;\;\left(-4 \cdot i\right) \cdot x\\

\mathbf{elif}\;a \leq 1.2 \cdot 10^{+95}:\\
\;\;\;\;\left(-27 \cdot k\right) \cdot j\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -2.60000000000000003e65 or 1.2e95 < a

    1. Initial program 81.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 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-*.f6443.3

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

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

    if -2.60000000000000003e65 < a < -1.14999999999999989e-171

    1. Initial program 87.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 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-*.f6423.7

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

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

    if -1.14999999999999989e-171 < a < 1.2e95

    1. Initial program 87.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 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-*.f6426.1

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

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

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

        \[\leadsto -27 \cdot \left(k \cdot \color{blue}{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-*.f6426.1

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

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

Alternative 19: 23.6% accurate, 11.3× speedup?

\[\begin{array}{l} \\ c \cdot b \end{array} \]
(FPCore (x y z t a b c i j k) :precision binary64 (* c b))
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;
}
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
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;
}
def code(x, y, z, t, a, b, c, i, j, k):
	return c * b
function code(x, y, z, t, a, b, c, i, j, k)
	return Float64(c * b)
end
function tmp = code(x, y, z, t, a, b, c, i, j, k)
	tmp = c * b;
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := N[(c * b), $MachinePrecision]
\begin{array}{l}

\\
c \cdot b
\end{array}
Derivation
  1. Initial program 85.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-*.f6423.6

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

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

Developer Target 1: 89.2% 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 2025091 
(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)))