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

Percentage Accurate: 94.4% → 98.1%
Time: 8.9s
Alternatives: 15
Speedup: 0.0×

Specification

?
\[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
(FPCore (x y z t a b)
  :precision binary64
  (+ (- (* x 2) (* (* (* y 9) z) t)) (* (* a 27) b)))
double code(double x, double y, double z, double t, double a, double b) {
	return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
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)
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
    code = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + ((a * 27.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
def code(x, y, z, t, a, b):
	return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b)
function code(x, y, z, t, a, b)
	return Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(Float64(a * 27.0) * b))
end
function tmp = code(x, y, z, t, a, b)
	tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * 2), $MachinePrecision] - N[(N[(N[(y * 9), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 15 alternatives:

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

Initial Program: 94.4% accurate, 1.0× speedup?

\[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
(FPCore (x y z t a b)
  :precision binary64
  (+ (- (* x 2) (* (* (* y 9) z) t)) (* (* a 27) b)))
double code(double x, double y, double z, double t, double a, double b) {
	return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
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)
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
    code = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + ((a * 27.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
def code(x, y, z, t, a, b):
	return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b)
function code(x, y, z, t, a, b)
	return Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(Float64(a * 27.0) * b))
end
function tmp = code(x, y, z, t, a, b)
	tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * 2), $MachinePrecision] - N[(N[(N[(y * 9), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b

Alternative 1: 98.1% accurate, 0.0× speedup?

\[\begin{array}{l} t_1 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\ t_2 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\ t_3 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_2\right)\\ t_4 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_2\right)\\ \mathbf{if}\;t\_3 \leq \frac{3148880786512287}{15744403932561434696684473303452629045213679255131528440951130063136634306810047014785327192773139116009306758441243430342744218096217082060889571263281690386187633395165356521866664817226721079737670210248565328244806179188238434160900023542852296724603729870848}:\\ \;\;\;\;\left(x \cdot 2 - \left(\left(t\_4 \cdot t\_3\right) \cdot t\_1\right) \cdot 9\right) + \left(\mathsf{min}\left(a, b\right) \cdot 27\right) \cdot \mathsf{max}\left(a, b\right)\\ \mathbf{else}:\\ \;\;\;\;x - \left(t\_4 \cdot \left(t\_3 \cdot \left(9 \cdot t\_1\right)\right) - \left(\mathsf{max}\left(a, b\right) \cdot \left(27 \cdot \mathsf{min}\left(a, b\right)\right) + x\right)\right)\\ \end{array} \]
(FPCore (x y z t a b)
  :precision binary64
  (let* ((t_1 (fmin (fmin y z) t))
       (t_2 (fmax (fmin y z) t))
       (t_3 (fmin (fmax y z) t_2))
       (t_4 (fmax (fmax y z) t_2)))
  (if (<=
       t_3
       3148880786512287/15744403932561434696684473303452629045213679255131528440951130063136634306810047014785327192773139116009306758441243430342744218096217082060889571263281690386187633395165356521866664817226721079737670210248565328244806179188238434160900023542852296724603729870848)
    (+
     (- (* x 2) (* (* (* t_4 t_3) t_1) 9))
     (* (* (fmin a b) 27) (fmax a b)))
    (-
     x
     (-
      (* t_4 (* t_3 (* 9 t_1)))
      (+ (* (fmax a b) (* 27 (fmin a b))) x))))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = fmin(fmin(y, z), t);
	double t_2 = fmax(fmin(y, z), t);
	double t_3 = fmin(fmax(y, z), t_2);
	double t_4 = fmax(fmax(y, z), t_2);
	double tmp;
	if (t_3 <= 2e-247) {
		tmp = ((x * 2.0) - (((t_4 * t_3) * t_1) * 9.0)) + ((fmin(a, b) * 27.0) * fmax(a, b));
	} else {
		tmp = x - ((t_4 * (t_3 * (9.0 * t_1))) - ((fmax(a, b) * (27.0 * fmin(a, b))) + x));
	}
	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)
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) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: tmp
    t_1 = fmin(fmin(y, z), t)
    t_2 = fmax(fmin(y, z), t)
    t_3 = fmin(fmax(y, z), t_2)
    t_4 = fmax(fmax(y, z), t_2)
    if (t_3 <= 2d-247) then
        tmp = ((x * 2.0d0) - (((t_4 * t_3) * t_1) * 9.0d0)) + ((fmin(a, b) * 27.0d0) * fmax(a, b))
    else
        tmp = x - ((t_4 * (t_3 * (9.0d0 * t_1))) - ((fmax(a, b) * (27.0d0 * fmin(a, b))) + x))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = fmin(fmin(y, z), t);
	double t_2 = fmax(fmin(y, z), t);
	double t_3 = fmin(fmax(y, z), t_2);
	double t_4 = fmax(fmax(y, z), t_2);
	double tmp;
	if (t_3 <= 2e-247) {
		tmp = ((x * 2.0) - (((t_4 * t_3) * t_1) * 9.0)) + ((fmin(a, b) * 27.0) * fmax(a, b));
	} else {
		tmp = x - ((t_4 * (t_3 * (9.0 * t_1))) - ((fmax(a, b) * (27.0 * fmin(a, b))) + x));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = fmin(fmin(y, z), t)
	t_2 = fmax(fmin(y, z), t)
	t_3 = fmin(fmax(y, z), t_2)
	t_4 = fmax(fmax(y, z), t_2)
	tmp = 0
	if t_3 <= 2e-247:
		tmp = ((x * 2.0) - (((t_4 * t_3) * t_1) * 9.0)) + ((fmin(a, b) * 27.0) * fmax(a, b))
	else:
		tmp = x - ((t_4 * (t_3 * (9.0 * t_1))) - ((fmax(a, b) * (27.0 * fmin(a, b))) + x))
	return tmp
function code(x, y, z, t, a, b)
	t_1 = fmin(fmin(y, z), t)
	t_2 = fmax(fmin(y, z), t)
	t_3 = fmin(fmax(y, z), t_2)
	t_4 = fmax(fmax(y, z), t_2)
	tmp = 0.0
	if (t_3 <= 2e-247)
		tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(t_4 * t_3) * t_1) * 9.0)) + Float64(Float64(fmin(a, b) * 27.0) * fmax(a, b)));
	else
		tmp = Float64(x - Float64(Float64(t_4 * Float64(t_3 * Float64(9.0 * t_1))) - Float64(Float64(fmax(a, b) * Float64(27.0 * fmin(a, b))) + x)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = min(min(y, z), t);
	t_2 = max(min(y, z), t);
	t_3 = min(max(y, z), t_2);
	t_4 = max(max(y, z), t_2);
	tmp = 0.0;
	if (t_3 <= 2e-247)
		tmp = ((x * 2.0) - (((t_4 * t_3) * t_1) * 9.0)) + ((min(a, b) * 27.0) * max(a, b));
	else
		tmp = x - ((t_4 * (t_3 * (9.0 * t_1))) - ((max(a, b) * (27.0 * min(a, b))) + x));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Min[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$3 = N[Min[N[Max[y, z], $MachinePrecision], t$95$2], $MachinePrecision]}, Block[{t$95$4 = N[Max[N[Max[y, z], $MachinePrecision], t$95$2], $MachinePrecision]}, If[LessEqual[t$95$3, 3148880786512287/15744403932561434696684473303452629045213679255131528440951130063136634306810047014785327192773139116009306758441243430342744218096217082060889571263281690386187633395165356521866664817226721079737670210248565328244806179188238434160900023542852296724603729870848], N[(N[(N[(x * 2), $MachinePrecision] - N[(N[(N[(t$95$4 * t$95$3), $MachinePrecision] * t$95$1), $MachinePrecision] * 9), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Min[a, b], $MachinePrecision] * 27), $MachinePrecision] * N[Max[a, b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(t$95$4 * N[(t$95$3 * N[(9 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[Max[a, b], $MachinePrecision] * N[(27 * N[Min[a, b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_2 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_3 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_2\right)\\
t_4 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_2\right)\\
\mathbf{if}\;t\_3 \leq \frac{3148880786512287}{15744403932561434696684473303452629045213679255131528440951130063136634306810047014785327192773139116009306758441243430342744218096217082060889571263281690386187633395165356521866664817226721079737670210248565328244806179188238434160900023542852296724603729870848}:\\
\;\;\;\;\left(x \cdot 2 - \left(\left(t\_4 \cdot t\_3\right) \cdot t\_1\right) \cdot 9\right) + \left(\mathsf{min}\left(a, b\right) \cdot 27\right) \cdot \mathsf{max}\left(a, b\right)\\

\mathbf{else}:\\
\;\;\;\;x - \left(t\_4 \cdot \left(t\_3 \cdot \left(9 \cdot t\_1\right)\right) - \left(\mathsf{max}\left(a, b\right) \cdot \left(27 \cdot \mathsf{min}\left(a, b\right)\right) + x\right)\right)\\


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

    1. Initial program 94.4%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2e-247 < z

    1. Initial program 94.4%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 98.1% accurate, 0.0× speedup?

\[\begin{array}{l} t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\ t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\ t_3 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\ t_4 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\ \mathbf{if}\;\left(t\_4 \cdot 9\right) \cdot t\_2 \leq 100000000000000001097906362944045541740492309677311846336810682903157585404911491537163328978494688899061249669721172515611590283743140088328307009198146046031271664502933027185697489699588559043338384466165001178426897626212945177628091195786707458122783970171784415105291802893207873272974885715430223118336:\\ \;\;\;\;x - \left(t\_3 \cdot \left(t\_2 \cdot \left(9 \cdot t\_4\right)\right) - \left(\mathsf{max}\left(a, b\right) \cdot \left(27 \cdot \mathsf{min}\left(a, b\right)\right) + x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot 2 - \left(\left(t\_3 \cdot t\_4\right) \cdot 9\right) \cdot t\_2\right) + \left(\mathsf{min}\left(a, b\right) \cdot 27\right) \cdot \mathsf{max}\left(a, b\right)\\ \end{array} \]
(FPCore (x y z t a b)
  :precision binary64
  (let* ((t_1 (fmax (fmin y z) t))
       (t_2 (fmin (fmax y z) t_1))
       (t_3 (fmax (fmax y z) t_1))
       (t_4 (fmin (fmin y z) t)))
  (if (<=
       (* (* t_4 9) t_2)
       100000000000000001097906362944045541740492309677311846336810682903157585404911491537163328978494688899061249669721172515611590283743140088328307009198146046031271664502933027185697489699588559043338384466165001178426897626212945177628091195786707458122783970171784415105291802893207873272974885715430223118336)
    (-
     x
     (-
      (* t_3 (* t_2 (* 9 t_4)))
      (+ (* (fmax a b) (* 27 (fmin a b))) x)))
    (+
     (- (* x 2) (* (* (* t_3 t_4) 9) t_2))
     (* (* (fmin a b) 27) (fmax a b))))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = fmax(fmin(y, z), t);
	double t_2 = fmin(fmax(y, z), t_1);
	double t_3 = fmax(fmax(y, z), t_1);
	double t_4 = fmin(fmin(y, z), t);
	double tmp;
	if (((t_4 * 9.0) * t_2) <= 1e+308) {
		tmp = x - ((t_3 * (t_2 * (9.0 * t_4))) - ((fmax(a, b) * (27.0 * fmin(a, b))) + x));
	} else {
		tmp = ((x * 2.0) - (((t_3 * t_4) * 9.0) * t_2)) + ((fmin(a, b) * 27.0) * fmax(a, 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)
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) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: tmp
    t_1 = fmax(fmin(y, z), t)
    t_2 = fmin(fmax(y, z), t_1)
    t_3 = fmax(fmax(y, z), t_1)
    t_4 = fmin(fmin(y, z), t)
    if (((t_4 * 9.0d0) * t_2) <= 1d+308) then
        tmp = x - ((t_3 * (t_2 * (9.0d0 * t_4))) - ((fmax(a, b) * (27.0d0 * fmin(a, b))) + x))
    else
        tmp = ((x * 2.0d0) - (((t_3 * t_4) * 9.0d0) * t_2)) + ((fmin(a, b) * 27.0d0) * fmax(a, b))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = fmax(fmin(y, z), t);
	double t_2 = fmin(fmax(y, z), t_1);
	double t_3 = fmax(fmax(y, z), t_1);
	double t_4 = fmin(fmin(y, z), t);
	double tmp;
	if (((t_4 * 9.0) * t_2) <= 1e+308) {
		tmp = x - ((t_3 * (t_2 * (9.0 * t_4))) - ((fmax(a, b) * (27.0 * fmin(a, b))) + x));
	} else {
		tmp = ((x * 2.0) - (((t_3 * t_4) * 9.0) * t_2)) + ((fmin(a, b) * 27.0) * fmax(a, b));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = fmax(fmin(y, z), t)
	t_2 = fmin(fmax(y, z), t_1)
	t_3 = fmax(fmax(y, z), t_1)
	t_4 = fmin(fmin(y, z), t)
	tmp = 0
	if ((t_4 * 9.0) * t_2) <= 1e+308:
		tmp = x - ((t_3 * (t_2 * (9.0 * t_4))) - ((fmax(a, b) * (27.0 * fmin(a, b))) + x))
	else:
		tmp = ((x * 2.0) - (((t_3 * t_4) * 9.0) * t_2)) + ((fmin(a, b) * 27.0) * fmax(a, b))
	return tmp
function code(x, y, z, t, a, b)
	t_1 = fmax(fmin(y, z), t)
	t_2 = fmin(fmax(y, z), t_1)
	t_3 = fmax(fmax(y, z), t_1)
	t_4 = fmin(fmin(y, z), t)
	tmp = 0.0
	if (Float64(Float64(t_4 * 9.0) * t_2) <= 1e+308)
		tmp = Float64(x - Float64(Float64(t_3 * Float64(t_2 * Float64(9.0 * t_4))) - Float64(Float64(fmax(a, b) * Float64(27.0 * fmin(a, b))) + x)));
	else
		tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(t_3 * t_4) * 9.0) * t_2)) + Float64(Float64(fmin(a, b) * 27.0) * fmax(a, b)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = max(min(y, z), t);
	t_2 = min(max(y, z), t_1);
	t_3 = max(max(y, z), t_1);
	t_4 = min(min(y, z), t);
	tmp = 0.0;
	if (((t_4 * 9.0) * t_2) <= 1e+308)
		tmp = x - ((t_3 * (t_2 * (9.0 * t_4))) - ((max(a, b) * (27.0 * min(a, b))) + x));
	else
		tmp = ((x * 2.0) - (((t_3 * t_4) * 9.0) * t_2)) + ((min(a, b) * 27.0) * max(a, b));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Max[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$4 = N[Min[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, If[LessEqual[N[(N[(t$95$4 * 9), $MachinePrecision] * t$95$2), $MachinePrecision], 100000000000000001097906362944045541740492309677311846336810682903157585404911491537163328978494688899061249669721172515611590283743140088328307009198146046031271664502933027185697489699588559043338384466165001178426897626212945177628091195786707458122783970171784415105291802893207873272974885715430223118336], N[(x - N[(N[(t$95$3 * N[(t$95$2 * N[(9 * t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[Max[a, b], $MachinePrecision] * N[(27 * N[Min[a, b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2), $MachinePrecision] - N[(N[(N[(t$95$3 * t$95$4), $MachinePrecision] * 9), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Min[a, b], $MachinePrecision] * 27), $MachinePrecision] * N[Max[a, b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_4 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\
\mathbf{if}\;\left(t\_4 \cdot 9\right) \cdot t\_2 \leq 100000000000000001097906362944045541740492309677311846336810682903157585404911491537163328978494688899061249669721172515611590283743140088328307009198146046031271664502933027185697489699588559043338384466165001178426897626212945177628091195786707458122783970171784415105291802893207873272974885715430223118336:\\
\;\;\;\;x - \left(t\_3 \cdot \left(t\_2 \cdot \left(9 \cdot t\_4\right)\right) - \left(\mathsf{max}\left(a, b\right) \cdot \left(27 \cdot \mathsf{min}\left(a, b\right)\right) + x\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - \left(\left(t\_3 \cdot t\_4\right) \cdot 9\right) \cdot t\_2\right) + \left(\mathsf{min}\left(a, b\right) \cdot 27\right) \cdot \mathsf{max}\left(a, b\right)\\


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

    1. Initial program 94.4%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1e308 < (*.f64 (*.f64 y #s(literal 9 binary64)) z)

    1. Initial program 94.4%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

Alternative 3: 96.9% accurate, 0.0× speedup?

\[\begin{array}{l} t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\ t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\ t_3 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\ t_4 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\ \mathbf{if}\;\left(t\_4 \cdot 9\right) \cdot t\_2 \leq 5000000000000000308639167639335784434971861554815056291550264252694066882698357794712695854722323983471552292257456306551729539271697808586910576768349361427712955105458094109306737151690687681363669298012313862249742312894517401540770056211835210095606628791592565251804447546056630075392:\\ \;\;\;\;x - \left(t\_3 \cdot \left(t\_2 \cdot \left(9 \cdot t\_4\right)\right) - \left(\mathsf{max}\left(a, b\right) \cdot \left(27 \cdot \mathsf{min}\left(a, b\right)\right) + x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x - \left(t\_4 \cdot t\_3\right) \cdot \left(9 \cdot t\_2\right)\\ \end{array} \]
(FPCore (x y z t a b)
  :precision binary64
  (let* ((t_1 (fmax (fmin y z) t))
       (t_2 (fmin (fmax y z) t_1))
       (t_3 (fmax (fmax y z) t_1))
       (t_4 (fmin (fmin y z) t)))
  (if (<=
       (* (* t_4 9) t_2)
       5000000000000000308639167639335784434971861554815056291550264252694066882698357794712695854722323983471552292257456306551729539271697808586910576768349361427712955105458094109306737151690687681363669298012313862249742312894517401540770056211835210095606628791592565251804447546056630075392)
    (-
     x
     (-
      (* t_3 (* t_2 (* 9 t_4)))
      (+ (* (fmax a b) (* 27 (fmin a b))) x)))
    (- x (* (* t_4 t_3) (* 9 t_2))))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = fmax(fmin(y, z), t);
	double t_2 = fmin(fmax(y, z), t_1);
	double t_3 = fmax(fmax(y, z), t_1);
	double t_4 = fmin(fmin(y, z), t);
	double tmp;
	if (((t_4 * 9.0) * t_2) <= 5e+288) {
		tmp = x - ((t_3 * (t_2 * (9.0 * t_4))) - ((fmax(a, b) * (27.0 * fmin(a, b))) + x));
	} else {
		tmp = x - ((t_4 * t_3) * (9.0 * 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)
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) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: tmp
    t_1 = fmax(fmin(y, z), t)
    t_2 = fmin(fmax(y, z), t_1)
    t_3 = fmax(fmax(y, z), t_1)
    t_4 = fmin(fmin(y, z), t)
    if (((t_4 * 9.0d0) * t_2) <= 5d+288) then
        tmp = x - ((t_3 * (t_2 * (9.0d0 * t_4))) - ((fmax(a, b) * (27.0d0 * fmin(a, b))) + x))
    else
        tmp = x - ((t_4 * t_3) * (9.0d0 * 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 t_1 = fmax(fmin(y, z), t);
	double t_2 = fmin(fmax(y, z), t_1);
	double t_3 = fmax(fmax(y, z), t_1);
	double t_4 = fmin(fmin(y, z), t);
	double tmp;
	if (((t_4 * 9.0) * t_2) <= 5e+288) {
		tmp = x - ((t_3 * (t_2 * (9.0 * t_4))) - ((fmax(a, b) * (27.0 * fmin(a, b))) + x));
	} else {
		tmp = x - ((t_4 * t_3) * (9.0 * t_2));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = fmax(fmin(y, z), t)
	t_2 = fmin(fmax(y, z), t_1)
	t_3 = fmax(fmax(y, z), t_1)
	t_4 = fmin(fmin(y, z), t)
	tmp = 0
	if ((t_4 * 9.0) * t_2) <= 5e+288:
		tmp = x - ((t_3 * (t_2 * (9.0 * t_4))) - ((fmax(a, b) * (27.0 * fmin(a, b))) + x))
	else:
		tmp = x - ((t_4 * t_3) * (9.0 * t_2))
	return tmp
function code(x, y, z, t, a, b)
	t_1 = fmax(fmin(y, z), t)
	t_2 = fmin(fmax(y, z), t_1)
	t_3 = fmax(fmax(y, z), t_1)
	t_4 = fmin(fmin(y, z), t)
	tmp = 0.0
	if (Float64(Float64(t_4 * 9.0) * t_2) <= 5e+288)
		tmp = Float64(x - Float64(Float64(t_3 * Float64(t_2 * Float64(9.0 * t_4))) - Float64(Float64(fmax(a, b) * Float64(27.0 * fmin(a, b))) + x)));
	else
		tmp = Float64(x - Float64(Float64(t_4 * t_3) * Float64(9.0 * t_2)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = max(min(y, z), t);
	t_2 = min(max(y, z), t_1);
	t_3 = max(max(y, z), t_1);
	t_4 = min(min(y, z), t);
	tmp = 0.0;
	if (((t_4 * 9.0) * t_2) <= 5e+288)
		tmp = x - ((t_3 * (t_2 * (9.0 * t_4))) - ((max(a, b) * (27.0 * min(a, b))) + x));
	else
		tmp = x - ((t_4 * t_3) * (9.0 * t_2));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Max[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$4 = N[Min[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, If[LessEqual[N[(N[(t$95$4 * 9), $MachinePrecision] * t$95$2), $MachinePrecision], 5000000000000000308639167639335784434971861554815056291550264252694066882698357794712695854722323983471552292257456306551729539271697808586910576768349361427712955105458094109306737151690687681363669298012313862249742312894517401540770056211835210095606628791592565251804447546056630075392], N[(x - N[(N[(t$95$3 * N[(t$95$2 * N[(9 * t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[Max[a, b], $MachinePrecision] * N[(27 * N[Min[a, b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(t$95$4 * t$95$3), $MachinePrecision] * N[(9 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_4 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\
\mathbf{if}\;\left(t\_4 \cdot 9\right) \cdot t\_2 \leq 5000000000000000308639167639335784434971861554815056291550264252694066882698357794712695854722323983471552292257456306551729539271697808586910576768349361427712955105458094109306737151690687681363669298012313862249742312894517401540770056211835210095606628791592565251804447546056630075392:\\
\;\;\;\;x - \left(t\_3 \cdot \left(t\_2 \cdot \left(9 \cdot t\_4\right)\right) - \left(\mathsf{max}\left(a, b\right) \cdot \left(27 \cdot \mathsf{min}\left(a, b\right)\right) + x\right)\right)\\

\mathbf{else}:\\
\;\;\;\;x - \left(t\_4 \cdot t\_3\right) \cdot \left(9 \cdot t\_2\right)\\


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

    1. Initial program 94.4%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000003e288 < (*.f64 (*.f64 y #s(literal 9 binary64)) z)

    1. Initial program 94.4%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x - \color{blue}{-1 \cdot x} \]
    5. Step-by-step derivation
      1. lower-*.f6429.9%

        \[\leadsto x - -1 \cdot \color{blue}{x} \]
    6. Applied rewrites29.9%

      \[\leadsto x - \color{blue}{-1 \cdot x} \]
    7. Taylor expanded in y around inf

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

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

        \[\leadsto x - 9 \cdot \left(t \cdot \color{blue}{\left(y \cdot z\right)}\right) \]
      3. lower-*.f6440.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 96.9% accurate, 0.0× speedup?

\[\begin{array}{l} t_1 := \mathsf{max}\left(z, \mathsf{max}\left(y, t\right)\right)\\ t_2 := \mathsf{min}\left(z, \mathsf{max}\left(y, t\right)\right)\\ \mathbf{if}\;\left(\mathsf{min}\left(y, t\right) \cdot 9\right) \cdot t\_2 \leq 5000000000000000308639167639335784434971861554815056291550264252694066882698357794712695854722323983471552292257456306551729539271697808586910576768349361427712955105458094109306737151690687681363669298012313862249742312894517401540770056211835210095606628791592565251804447546056630075392:\\ \;\;\;\;\left(\left(t\_1 \cdot -9\right) \cdot \left(t\_2 \cdot \mathsf{min}\left(y, t\right)\right) + \left(\mathsf{max}\left(a, b\right) \cdot \left(27 \cdot \mathsf{min}\left(a, b\right)\right) + x\right)\right) + x\\ \mathbf{else}:\\ \;\;\;\;x - \left(\mathsf{min}\left(y, t\right) \cdot t\_1\right) \cdot \left(9 \cdot t\_2\right)\\ \end{array} \]
(FPCore (x y z t a b)
  :precision binary64
  (let* ((t_1 (fmax z (fmax y t))) (t_2 (fmin z (fmax y t))))
  (if (<=
       (* (* (fmin y t) 9) t_2)
       5000000000000000308639167639335784434971861554815056291550264252694066882698357794712695854722323983471552292257456306551729539271697808586910576768349361427712955105458094109306737151690687681363669298012313862249742312894517401540770056211835210095606628791592565251804447546056630075392)
    (+
     (+
      (* (* t_1 -9) (* t_2 (fmin y t)))
      (+ (* (fmax a b) (* 27 (fmin a b))) x))
     x)
    (- x (* (* (fmin y t) t_1) (* 9 t_2))))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = fmax(z, fmax(y, t));
	double t_2 = fmin(z, fmax(y, t));
	double tmp;
	if (((fmin(y, t) * 9.0) * t_2) <= 5e+288) {
		tmp = (((t_1 * -9.0) * (t_2 * fmin(y, t))) + ((fmax(a, b) * (27.0 * fmin(a, b))) + x)) + x;
	} else {
		tmp = x - ((fmin(y, t) * t_1) * (9.0 * 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)
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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = fmax(z, fmax(y, t))
    t_2 = fmin(z, fmax(y, t))
    if (((fmin(y, t) * 9.0d0) * t_2) <= 5d+288) then
        tmp = (((t_1 * (-9.0d0)) * (t_2 * fmin(y, t))) + ((fmax(a, b) * (27.0d0 * fmin(a, b))) + x)) + x
    else
        tmp = x - ((fmin(y, t) * t_1) * (9.0d0 * 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 t_1 = fmax(z, fmax(y, t));
	double t_2 = fmin(z, fmax(y, t));
	double tmp;
	if (((fmin(y, t) * 9.0) * t_2) <= 5e+288) {
		tmp = (((t_1 * -9.0) * (t_2 * fmin(y, t))) + ((fmax(a, b) * (27.0 * fmin(a, b))) + x)) + x;
	} else {
		tmp = x - ((fmin(y, t) * t_1) * (9.0 * t_2));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = fmax(z, fmax(y, t))
	t_2 = fmin(z, fmax(y, t))
	tmp = 0
	if ((fmin(y, t) * 9.0) * t_2) <= 5e+288:
		tmp = (((t_1 * -9.0) * (t_2 * fmin(y, t))) + ((fmax(a, b) * (27.0 * fmin(a, b))) + x)) + x
	else:
		tmp = x - ((fmin(y, t) * t_1) * (9.0 * t_2))
	return tmp
function code(x, y, z, t, a, b)
	t_1 = fmax(z, fmax(y, t))
	t_2 = fmin(z, fmax(y, t))
	tmp = 0.0
	if (Float64(Float64(fmin(y, t) * 9.0) * t_2) <= 5e+288)
		tmp = Float64(Float64(Float64(Float64(t_1 * -9.0) * Float64(t_2 * fmin(y, t))) + Float64(Float64(fmax(a, b) * Float64(27.0 * fmin(a, b))) + x)) + x);
	else
		tmp = Float64(x - Float64(Float64(fmin(y, t) * t_1) * Float64(9.0 * t_2)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = max(z, max(y, t));
	t_2 = min(z, max(y, t));
	tmp = 0.0;
	if (((min(y, t) * 9.0) * t_2) <= 5e+288)
		tmp = (((t_1 * -9.0) * (t_2 * min(y, t))) + ((max(a, b) * (27.0 * min(a, b))) + x)) + x;
	else
		tmp = x - ((min(y, t) * t_1) * (9.0 * t_2));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Max[z, N[Max[y, t], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Min[z, N[Max[y, t], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(N[Min[y, t], $MachinePrecision] * 9), $MachinePrecision] * t$95$2), $MachinePrecision], 5000000000000000308639167639335784434971861554815056291550264252694066882698357794712695854722323983471552292257456306551729539271697808586910576768349361427712955105458094109306737151690687681363669298012313862249742312894517401540770056211835210095606628791592565251804447546056630075392], N[(N[(N[(N[(t$95$1 * -9), $MachinePrecision] * N[(t$95$2 * N[Min[y, t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Max[a, b], $MachinePrecision] * N[(27 * N[Min[a, b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(x - N[(N[(N[Min[y, t], $MachinePrecision] * t$95$1), $MachinePrecision] * N[(9 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(z, \mathsf{max}\left(y, t\right)\right)\\
t_2 := \mathsf{min}\left(z, \mathsf{max}\left(y, t\right)\right)\\
\mathbf{if}\;\left(\mathsf{min}\left(y, t\right) \cdot 9\right) \cdot t\_2 \leq 5000000000000000308639167639335784434971861554815056291550264252694066882698357794712695854722323983471552292257456306551729539271697808586910576768349361427712955105458094109306737151690687681363669298012313862249742312894517401540770056211835210095606628791592565251804447546056630075392:\\
\;\;\;\;\left(\left(t\_1 \cdot -9\right) \cdot \left(t\_2 \cdot \mathsf{min}\left(y, t\right)\right) + \left(\mathsf{max}\left(a, b\right) \cdot \left(27 \cdot \mathsf{min}\left(a, b\right)\right) + x\right)\right) + x\\

\mathbf{else}:\\
\;\;\;\;x - \left(\mathsf{min}\left(y, t\right) \cdot t\_1\right) \cdot \left(9 \cdot t\_2\right)\\


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

    1. Initial program 94.4%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + \left(\left(a \cdot 27\right) \cdot b + x\right)\right) + x} \]
    3. Applied rewrites94.5%

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

    if 5.0000000000000003e288 < (*.f64 (*.f64 y #s(literal 9 binary64)) z)

    1. Initial program 94.4%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x - \color{blue}{-1 \cdot x} \]
    5. Step-by-step derivation
      1. lower-*.f6429.9%

        \[\leadsto x - -1 \cdot \color{blue}{x} \]
    6. Applied rewrites29.9%

      \[\leadsto x - \color{blue}{-1 \cdot x} \]
    7. Taylor expanded in y around inf

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

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

        \[\leadsto x - 9 \cdot \left(t \cdot \color{blue}{\left(y \cdot z\right)}\right) \]
      3. lower-*.f6440.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 86.4% accurate, 0.0× speedup?

\[\begin{array}{l} t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\ t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\ t_3 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\ t_4 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\ t_5 := \left(\left(t\_4 \cdot 9\right) \cdot t\_2\right) \cdot t\_3\\ \mathbf{if}\;t\_5 \leq \frac{-6805647338418769}{340282366920938463463374607431768211456}:\\ \;\;\;\;-9 \cdot \left(\left(t\_2 \cdot t\_3\right) \cdot t\_4\right) + \left(\mathsf{min}\left(a, b\right) \cdot 27\right) \cdot \mathsf{max}\left(a, b\right)\\ \mathbf{elif}\;t\_5 \leq 200000000000000015259539682183774006589929941893120:\\ \;\;\;\;x - \left(\left(-27 \cdot \mathsf{max}\left(a, b\right)\right) \cdot \mathsf{min}\left(a, b\right) - x\right)\\ \mathbf{else}:\\ \;\;\;\;27 \cdot \left(\mathsf{min}\left(a, b\right) \cdot \mathsf{max}\left(a, b\right)\right) - 9 \cdot \left(t\_3 \cdot \left(t\_4 \cdot t\_2\right)\right)\\ \end{array} \]
(FPCore (x y z t a b)
  :precision binary64
  (let* ((t_1 (fmax (fmin y z) t))
       (t_2 (fmin (fmax y z) t_1))
       (t_3 (fmax (fmax y z) t_1))
       (t_4 (fmin (fmin y z) t))
       (t_5 (* (* (* t_4 9) t_2) t_3)))
  (if (<=
       t_5
       -6805647338418769/340282366920938463463374607431768211456)
    (+ (* -9 (* (* t_2 t_3) t_4)) (* (* (fmin a b) 27) (fmax a b)))
    (if (<= t_5 200000000000000015259539682183774006589929941893120)
      (- x (- (* (* -27 (fmax a b)) (fmin a b)) x))
      (-
       (* 27 (* (fmin a b) (fmax a b)))
       (* 9 (* t_3 (* t_4 t_2))))))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = fmax(fmin(y, z), t);
	double t_2 = fmin(fmax(y, z), t_1);
	double t_3 = fmax(fmax(y, z), t_1);
	double t_4 = fmin(fmin(y, z), t);
	double t_5 = ((t_4 * 9.0) * t_2) * t_3;
	double tmp;
	if (t_5 <= -2e-23) {
		tmp = (-9.0 * ((t_2 * t_3) * t_4)) + ((fmin(a, b) * 27.0) * fmax(a, b));
	} else if (t_5 <= 2e+50) {
		tmp = x - (((-27.0 * fmax(a, b)) * fmin(a, b)) - x);
	} else {
		tmp = (27.0 * (fmin(a, b) * fmax(a, b))) - (9.0 * (t_3 * (t_4 * 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)
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) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: t_5
    real(8) :: tmp
    t_1 = fmax(fmin(y, z), t)
    t_2 = fmin(fmax(y, z), t_1)
    t_3 = fmax(fmax(y, z), t_1)
    t_4 = fmin(fmin(y, z), t)
    t_5 = ((t_4 * 9.0d0) * t_2) * t_3
    if (t_5 <= (-2d-23)) then
        tmp = ((-9.0d0) * ((t_2 * t_3) * t_4)) + ((fmin(a, b) * 27.0d0) * fmax(a, b))
    else if (t_5 <= 2d+50) then
        tmp = x - ((((-27.0d0) * fmax(a, b)) * fmin(a, b)) - x)
    else
        tmp = (27.0d0 * (fmin(a, b) * fmax(a, b))) - (9.0d0 * (t_3 * (t_4 * 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 t_1 = fmax(fmin(y, z), t);
	double t_2 = fmin(fmax(y, z), t_1);
	double t_3 = fmax(fmax(y, z), t_1);
	double t_4 = fmin(fmin(y, z), t);
	double t_5 = ((t_4 * 9.0) * t_2) * t_3;
	double tmp;
	if (t_5 <= -2e-23) {
		tmp = (-9.0 * ((t_2 * t_3) * t_4)) + ((fmin(a, b) * 27.0) * fmax(a, b));
	} else if (t_5 <= 2e+50) {
		tmp = x - (((-27.0 * fmax(a, b)) * fmin(a, b)) - x);
	} else {
		tmp = (27.0 * (fmin(a, b) * fmax(a, b))) - (9.0 * (t_3 * (t_4 * t_2)));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = fmax(fmin(y, z), t)
	t_2 = fmin(fmax(y, z), t_1)
	t_3 = fmax(fmax(y, z), t_1)
	t_4 = fmin(fmin(y, z), t)
	t_5 = ((t_4 * 9.0) * t_2) * t_3
	tmp = 0
	if t_5 <= -2e-23:
		tmp = (-9.0 * ((t_2 * t_3) * t_4)) + ((fmin(a, b) * 27.0) * fmax(a, b))
	elif t_5 <= 2e+50:
		tmp = x - (((-27.0 * fmax(a, b)) * fmin(a, b)) - x)
	else:
		tmp = (27.0 * (fmin(a, b) * fmax(a, b))) - (9.0 * (t_3 * (t_4 * t_2)))
	return tmp
function code(x, y, z, t, a, b)
	t_1 = fmax(fmin(y, z), t)
	t_2 = fmin(fmax(y, z), t_1)
	t_3 = fmax(fmax(y, z), t_1)
	t_4 = fmin(fmin(y, z), t)
	t_5 = Float64(Float64(Float64(t_4 * 9.0) * t_2) * t_3)
	tmp = 0.0
	if (t_5 <= -2e-23)
		tmp = Float64(Float64(-9.0 * Float64(Float64(t_2 * t_3) * t_4)) + Float64(Float64(fmin(a, b) * 27.0) * fmax(a, b)));
	elseif (t_5 <= 2e+50)
		tmp = Float64(x - Float64(Float64(Float64(-27.0 * fmax(a, b)) * fmin(a, b)) - x));
	else
		tmp = Float64(Float64(27.0 * Float64(fmin(a, b) * fmax(a, b))) - Float64(9.0 * Float64(t_3 * Float64(t_4 * t_2))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = max(min(y, z), t);
	t_2 = min(max(y, z), t_1);
	t_3 = max(max(y, z), t_1);
	t_4 = min(min(y, z), t);
	t_5 = ((t_4 * 9.0) * t_2) * t_3;
	tmp = 0.0;
	if (t_5 <= -2e-23)
		tmp = (-9.0 * ((t_2 * t_3) * t_4)) + ((min(a, b) * 27.0) * max(a, b));
	elseif (t_5 <= 2e+50)
		tmp = x - (((-27.0 * max(a, b)) * min(a, b)) - x);
	else
		tmp = (27.0 * (min(a, b) * max(a, b))) - (9.0 * (t_3 * (t_4 * t_2)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Max[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$4 = N[Min[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[(t$95$4 * 9), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$3), $MachinePrecision]}, If[LessEqual[t$95$5, -6805647338418769/340282366920938463463374607431768211456], N[(N[(-9 * N[(N[(t$95$2 * t$95$3), $MachinePrecision] * t$95$4), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Min[a, b], $MachinePrecision] * 27), $MachinePrecision] * N[Max[a, b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 200000000000000015259539682183774006589929941893120], N[(x - N[(N[(N[(-27 * N[Max[a, b], $MachinePrecision]), $MachinePrecision] * N[Min[a, b], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], N[(N[(27 * N[(N[Min[a, b], $MachinePrecision] * N[Max[a, b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(9 * N[(t$95$3 * N[(t$95$4 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_4 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_5 := \left(\left(t\_4 \cdot 9\right) \cdot t\_2\right) \cdot t\_3\\
\mathbf{if}\;t\_5 \leq \frac{-6805647338418769}{340282366920938463463374607431768211456}:\\
\;\;\;\;-9 \cdot \left(\left(t\_2 \cdot t\_3\right) \cdot t\_4\right) + \left(\mathsf{min}\left(a, b\right) \cdot 27\right) \cdot \mathsf{max}\left(a, b\right)\\

\mathbf{elif}\;t\_5 \leq 200000000000000015259539682183774006589929941893120:\\
\;\;\;\;x - \left(\left(-27 \cdot \mathsf{max}\left(a, b\right)\right) \cdot \mathsf{min}\left(a, b\right) - x\right)\\

\mathbf{else}:\\
\;\;\;\;27 \cdot \left(\mathsf{min}\left(a, b\right) \cdot \mathsf{max}\left(a, b\right)\right) - 9 \cdot \left(t\_3 \cdot \left(t\_4 \cdot t\_2\right)\right)\\


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

    1. Initial program 94.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto -9 \cdot \left(\left(t \cdot y\right) \cdot z\right) + \left(a \cdot 27\right) \cdot b \]
      5. lower-*.f6467.2%

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

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

        \[\leadsto -9 \cdot \left(\left(y \cdot t\right) \cdot z\right) + \left(a \cdot 27\right) \cdot b \]
      8. lower-*.f6467.2%

        \[\leadsto -9 \cdot \left(\left(y \cdot t\right) \cdot z\right) + \left(a \cdot 27\right) \cdot b \]
    6. Applied rewrites67.2%

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

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

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

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

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

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

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

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

        \[\leadsto -9 \cdot \left(\left(z \cdot t\right) \cdot y\right) + \left(a \cdot 27\right) \cdot b \]
      9. lower-*.f6466.8%

        \[\leadsto -9 \cdot \left(\left(z \cdot t\right) \cdot y\right) + \left(a \cdot 27\right) \cdot b \]
    8. Applied rewrites66.8%

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

    if -1.9999999999999999e-23 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 2.0000000000000002e50

    1. Initial program 94.4%

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

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

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

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

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

        \[\leadsto 2 \cdot x + 27 \cdot \left(a \cdot \color{blue}{b}\right) \]
    4. Applied rewrites64.1%

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

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

        \[\leadsto 2 \cdot x + \color{blue}{27} \cdot \left(a \cdot b\right) \]
      3. count-2-revN/A

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

        \[\leadsto \left(x + x\right) + 27 \cdot \color{blue}{\left(a \cdot b\right)} \]
      5. lift-*.f64N/A

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

        \[\leadsto \left(x + x\right) + \left(27 \cdot a\right) \cdot \color{blue}{b} \]
      7. lift-*.f64N/A

        \[\leadsto \left(x + x\right) + \left(27 \cdot a\right) \cdot b \]
      8. *-commutativeN/A

        \[\leadsto \left(x + x\right) + b \cdot \color{blue}{\left(27 \cdot a\right)} \]
      9. lift-*.f64N/A

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

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

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

        \[\leadsto x + \left(b \cdot \left(27 \cdot a\right) + \color{blue}{x}\right) \]
      13. add-flipN/A

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

        \[\leadsto x - \color{blue}{\left(\mathsf{neg}\left(\left(b \cdot \left(27 \cdot a\right) + x\right)\right)\right)} \]
      15. lift-+.f64N/A

        \[\leadsto x - \left(\mathsf{neg}\left(\left(b \cdot \left(27 \cdot a\right) + x\right)\right)\right) \]
      16. distribute-neg-inN/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(b \cdot \left(27 \cdot a\right)\right)\right) + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right) \]
      17. lift-*.f64N/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(b \cdot \left(27 \cdot a\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      18. *-commutativeN/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(b \cdot \left(a \cdot 27\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      19. lift-*.f64N/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(b \cdot \left(a \cdot 27\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      20. lower-*.f64N/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(b \cdot \left(a \cdot 27\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      21. *-commutativeN/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(\left(a \cdot 27\right) \cdot b\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      22. lift-*.f64N/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(\left(a \cdot 27\right) \cdot b\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      23. sub-flip-reverseN/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(\left(a \cdot 27\right) \cdot b\right)\right) - \color{blue}{x}\right) \]
      24. lower--.f64N/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(\left(a \cdot 27\right) \cdot b\right)\right) - \color{blue}{x}\right) \]
    6. Applied rewrites64.1%

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

        \[\leadsto x - \left(-27 \cdot \left(a \cdot b\right) - x\right) \]
      2. lift-*.f64N/A

        \[\leadsto x - \left(-27 \cdot \left(a \cdot b\right) - x\right) \]
      3. *-commutativeN/A

        \[\leadsto x - \left(-27 \cdot \left(b \cdot a\right) - x\right) \]
      4. associate-*r*N/A

        \[\leadsto x - \left(\left(-27 \cdot b\right) \cdot a - x\right) \]
      5. lower-*.f64N/A

        \[\leadsto x - \left(\left(-27 \cdot b\right) \cdot a - x\right) \]
      6. lower-*.f6464.0%

        \[\leadsto x - \left(\left(-27 \cdot b\right) \cdot a - x\right) \]
    8. Applied rewrites64.0%

      \[\leadsto x - \left(\left(-27 \cdot b\right) \cdot a - x\right) \]

    if 2.0000000000000002e50 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t)

    1. Initial program 94.4%

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

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

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

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

        \[\leadsto 27 \cdot \left(a \cdot b\right) - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right) \]
      4. lower-*.f64N/A

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

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

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

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

Alternative 6: 86.3% accurate, 0.0× speedup?

\[\begin{array}{l} t_1 := \mathsf{max}\left(z, \mathsf{max}\left(y, t\right)\right)\\ t_2 := \mathsf{min}\left(z, \mathsf{max}\left(y, t\right)\right)\\ t_3 := 27 \cdot \left(\mathsf{min}\left(a, b\right) \cdot \mathsf{max}\left(a, b\right)\right) - 9 \cdot \left(t\_1 \cdot \left(\mathsf{min}\left(y, t\right) \cdot t\_2\right)\right)\\ t_4 := \left(\left(\mathsf{min}\left(y, t\right) \cdot 9\right) \cdot t\_2\right) \cdot t\_1\\ \mathbf{if}\;t\_4 \leq \frac{-6805647338418769}{340282366920938463463374607431768211456}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;t\_4 \leq 200000000000000015259539682183774006589929941893120:\\ \;\;\;\;x - \left(\left(-27 \cdot \mathsf{max}\left(a, b\right)\right) \cdot \mathsf{min}\left(a, b\right) - x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \end{array} \]
(FPCore (x y z t a b)
  :precision binary64
  (let* ((t_1 (fmax z (fmax y t)))
       (t_2 (fmin z (fmax y t)))
       (t_3
        (-
         (* 27 (* (fmin a b) (fmax a b)))
         (* 9 (* t_1 (* (fmin y t) t_2)))))
       (t_4 (* (* (* (fmin y t) 9) t_2) t_1)))
  (if (<=
       t_4
       -6805647338418769/340282366920938463463374607431768211456)
    t_3
    (if (<= t_4 200000000000000015259539682183774006589929941893120)
      (- x (- (* (* -27 (fmax a b)) (fmin a b)) x))
      t_3))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = fmax(z, fmax(y, t));
	double t_2 = fmin(z, fmax(y, t));
	double t_3 = (27.0 * (fmin(a, b) * fmax(a, b))) - (9.0 * (t_1 * (fmin(y, t) * t_2)));
	double t_4 = ((fmin(y, t) * 9.0) * t_2) * t_1;
	double tmp;
	if (t_4 <= -2e-23) {
		tmp = t_3;
	} else if (t_4 <= 2e+50) {
		tmp = x - (((-27.0 * fmax(a, b)) * fmin(a, b)) - x);
	} else {
		tmp = t_3;
	}
	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)
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) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: tmp
    t_1 = fmax(z, fmax(y, t))
    t_2 = fmin(z, fmax(y, t))
    t_3 = (27.0d0 * (fmin(a, b) * fmax(a, b))) - (9.0d0 * (t_1 * (fmin(y, t) * t_2)))
    t_4 = ((fmin(y, t) * 9.0d0) * t_2) * t_1
    if (t_4 <= (-2d-23)) then
        tmp = t_3
    else if (t_4 <= 2d+50) then
        tmp = x - ((((-27.0d0) * fmax(a, b)) * fmin(a, b)) - x)
    else
        tmp = t_3
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = fmax(z, fmax(y, t));
	double t_2 = fmin(z, fmax(y, t));
	double t_3 = (27.0 * (fmin(a, b) * fmax(a, b))) - (9.0 * (t_1 * (fmin(y, t) * t_2)));
	double t_4 = ((fmin(y, t) * 9.0) * t_2) * t_1;
	double tmp;
	if (t_4 <= -2e-23) {
		tmp = t_3;
	} else if (t_4 <= 2e+50) {
		tmp = x - (((-27.0 * fmax(a, b)) * fmin(a, b)) - x);
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = fmax(z, fmax(y, t))
	t_2 = fmin(z, fmax(y, t))
	t_3 = (27.0 * (fmin(a, b) * fmax(a, b))) - (9.0 * (t_1 * (fmin(y, t) * t_2)))
	t_4 = ((fmin(y, t) * 9.0) * t_2) * t_1
	tmp = 0
	if t_4 <= -2e-23:
		tmp = t_3
	elif t_4 <= 2e+50:
		tmp = x - (((-27.0 * fmax(a, b)) * fmin(a, b)) - x)
	else:
		tmp = t_3
	return tmp
function code(x, y, z, t, a, b)
	t_1 = fmax(z, fmax(y, t))
	t_2 = fmin(z, fmax(y, t))
	t_3 = Float64(Float64(27.0 * Float64(fmin(a, b) * fmax(a, b))) - Float64(9.0 * Float64(t_1 * Float64(fmin(y, t) * t_2))))
	t_4 = Float64(Float64(Float64(fmin(y, t) * 9.0) * t_2) * t_1)
	tmp = 0.0
	if (t_4 <= -2e-23)
		tmp = t_3;
	elseif (t_4 <= 2e+50)
		tmp = Float64(x - Float64(Float64(Float64(-27.0 * fmax(a, b)) * fmin(a, b)) - x));
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = max(z, max(y, t));
	t_2 = min(z, max(y, t));
	t_3 = (27.0 * (min(a, b) * max(a, b))) - (9.0 * (t_1 * (min(y, t) * t_2)));
	t_4 = ((min(y, t) * 9.0) * t_2) * t_1;
	tmp = 0.0;
	if (t_4 <= -2e-23)
		tmp = t_3;
	elseif (t_4 <= 2e+50)
		tmp = x - (((-27.0 * max(a, b)) * min(a, b)) - x);
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Max[z, N[Max[y, t], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Min[z, N[Max[y, t], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[(27 * N[(N[Min[a, b], $MachinePrecision] * N[Max[a, b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(9 * N[(t$95$1 * N[(N[Min[y, t], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[(N[Min[y, t], $MachinePrecision] * 9), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[t$95$4, -6805647338418769/340282366920938463463374607431768211456], t$95$3, If[LessEqual[t$95$4, 200000000000000015259539682183774006589929941893120], N[(x - N[(N[(N[(-27 * N[Max[a, b], $MachinePrecision]), $MachinePrecision] * N[Min[a, b], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(z, \mathsf{max}\left(y, t\right)\right)\\
t_2 := \mathsf{min}\left(z, \mathsf{max}\left(y, t\right)\right)\\
t_3 := 27 \cdot \left(\mathsf{min}\left(a, b\right) \cdot \mathsf{max}\left(a, b\right)\right) - 9 \cdot \left(t\_1 \cdot \left(\mathsf{min}\left(y, t\right) \cdot t\_2\right)\right)\\
t_4 := \left(\left(\mathsf{min}\left(y, t\right) \cdot 9\right) \cdot t\_2\right) \cdot t\_1\\
\mathbf{if}\;t\_4 \leq \frac{-6805647338418769}{340282366920938463463374607431768211456}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;t\_4 \leq 200000000000000015259539682183774006589929941893120:\\
\;\;\;\;x - \left(\left(-27 \cdot \mathsf{max}\left(a, b\right)\right) \cdot \mathsf{min}\left(a, b\right) - x\right)\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -1.9999999999999999e-23 or 2.0000000000000002e50 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t)

    1. Initial program 94.4%

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

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

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

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

        \[\leadsto 27 \cdot \left(a \cdot b\right) - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right) \]
      4. lower-*.f64N/A

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

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

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

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

    if -1.9999999999999999e-23 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 2.0000000000000002e50

    1. Initial program 94.4%

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

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

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

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

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

        \[\leadsto 2 \cdot x + 27 \cdot \left(a \cdot \color{blue}{b}\right) \]
    4. Applied rewrites64.1%

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

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

        \[\leadsto 2 \cdot x + \color{blue}{27} \cdot \left(a \cdot b\right) \]
      3. count-2-revN/A

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

        \[\leadsto \left(x + x\right) + 27 \cdot \color{blue}{\left(a \cdot b\right)} \]
      5. lift-*.f64N/A

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

        \[\leadsto \left(x + x\right) + \left(27 \cdot a\right) \cdot \color{blue}{b} \]
      7. lift-*.f64N/A

        \[\leadsto \left(x + x\right) + \left(27 \cdot a\right) \cdot b \]
      8. *-commutativeN/A

        \[\leadsto \left(x + x\right) + b \cdot \color{blue}{\left(27 \cdot a\right)} \]
      9. lift-*.f64N/A

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

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

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

        \[\leadsto x + \left(b \cdot \left(27 \cdot a\right) + \color{blue}{x}\right) \]
      13. add-flipN/A

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

        \[\leadsto x - \color{blue}{\left(\mathsf{neg}\left(\left(b \cdot \left(27 \cdot a\right) + x\right)\right)\right)} \]
      15. lift-+.f64N/A

        \[\leadsto x - \left(\mathsf{neg}\left(\left(b \cdot \left(27 \cdot a\right) + x\right)\right)\right) \]
      16. distribute-neg-inN/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(b \cdot \left(27 \cdot a\right)\right)\right) + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right) \]
      17. lift-*.f64N/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(b \cdot \left(27 \cdot a\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      18. *-commutativeN/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(b \cdot \left(a \cdot 27\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      19. lift-*.f64N/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(b \cdot \left(a \cdot 27\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      20. lower-*.f64N/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(b \cdot \left(a \cdot 27\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      21. *-commutativeN/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(\left(a \cdot 27\right) \cdot b\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      22. lift-*.f64N/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(\left(a \cdot 27\right) \cdot b\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      23. sub-flip-reverseN/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(\left(a \cdot 27\right) \cdot b\right)\right) - \color{blue}{x}\right) \]
      24. lower--.f64N/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(\left(a \cdot 27\right) \cdot b\right)\right) - \color{blue}{x}\right) \]
    6. Applied rewrites64.1%

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

        \[\leadsto x - \left(-27 \cdot \left(a \cdot b\right) - x\right) \]
      2. lift-*.f64N/A

        \[\leadsto x - \left(-27 \cdot \left(a \cdot b\right) - x\right) \]
      3. *-commutativeN/A

        \[\leadsto x - \left(-27 \cdot \left(b \cdot a\right) - x\right) \]
      4. associate-*r*N/A

        \[\leadsto x - \left(\left(-27 \cdot b\right) \cdot a - x\right) \]
      5. lower-*.f64N/A

        \[\leadsto x - \left(\left(-27 \cdot b\right) \cdot a - x\right) \]
      6. lower-*.f6464.0%

        \[\leadsto x - \left(\left(-27 \cdot b\right) \cdot a - x\right) \]
    8. Applied rewrites64.0%

      \[\leadsto x - \left(\left(-27 \cdot b\right) \cdot a - x\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 83.2% accurate, 0.1× speedup?

\[\begin{array}{l} t_1 := x - \left(9 \cdot \left(\mathsf{max}\left(y, t\right) \cdot \left(\mathsf{min}\left(y, t\right) \cdot z\right)\right) - x\right)\\ t_2 := \left(\left(\mathsf{min}\left(y, t\right) \cdot 9\right) \cdot z\right) \cdot \mathsf{max}\left(y, t\right)\\ \mathbf{if}\;t\_2 \leq \frac{-6805647338418769}{340282366920938463463374607431768211456}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq \frac{336999333339383}{3369993333393829974333376885877453834204643052817571560137951281152}:\\ \;\;\;\;x - \left(\left(-27 \cdot \mathsf{max}\left(a, b\right)\right) \cdot \mathsf{min}\left(a, b\right) - x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
(FPCore (x y z t a b)
  :precision binary64
  (let* ((t_1 (- x (- (* 9 (* (fmax y t) (* (fmin y t) z))) x)))
       (t_2 (* (* (* (fmin y t) 9) z) (fmax y t))))
  (if (<=
       t_2
       -6805647338418769/340282366920938463463374607431768211456)
    t_1
    (if (<=
         t_2
         336999333339383/3369993333393829974333376885877453834204643052817571560137951281152)
      (- x (- (* (* -27 (fmax a b)) (fmin a b)) x))
      t_1))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = x - ((9.0 * (fmax(y, t) * (fmin(y, t) * z))) - x);
	double t_2 = ((fmin(y, t) * 9.0) * z) * fmax(y, t);
	double tmp;
	if (t_2 <= -2e-23) {
		tmp = t_1;
	} else if (t_2 <= 1e-52) {
		tmp = x - (((-27.0 * fmax(a, b)) * fmin(a, b)) - x);
	} 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)
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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = x - ((9.0d0 * (fmax(y, t) * (fmin(y, t) * z))) - x)
    t_2 = ((fmin(y, t) * 9.0d0) * z) * fmax(y, t)
    if (t_2 <= (-2d-23)) then
        tmp = t_1
    else if (t_2 <= 1d-52) then
        tmp = x - ((((-27.0d0) * fmax(a, b)) * fmin(a, b)) - x)
    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 t_1 = x - ((9.0 * (fmax(y, t) * (fmin(y, t) * z))) - x);
	double t_2 = ((fmin(y, t) * 9.0) * z) * fmax(y, t);
	double tmp;
	if (t_2 <= -2e-23) {
		tmp = t_1;
	} else if (t_2 <= 1e-52) {
		tmp = x - (((-27.0 * fmax(a, b)) * fmin(a, b)) - x);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = x - ((9.0 * (fmax(y, t) * (fmin(y, t) * z))) - x)
	t_2 = ((fmin(y, t) * 9.0) * z) * fmax(y, t)
	tmp = 0
	if t_2 <= -2e-23:
		tmp = t_1
	elif t_2 <= 1e-52:
		tmp = x - (((-27.0 * fmax(a, b)) * fmin(a, b)) - x)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(x - Float64(Float64(9.0 * Float64(fmax(y, t) * Float64(fmin(y, t) * z))) - x))
	t_2 = Float64(Float64(Float64(fmin(y, t) * 9.0) * z) * fmax(y, t))
	tmp = 0.0
	if (t_2 <= -2e-23)
		tmp = t_1;
	elseif (t_2 <= 1e-52)
		tmp = Float64(x - Float64(Float64(Float64(-27.0 * fmax(a, b)) * fmin(a, b)) - x));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = x - ((9.0 * (max(y, t) * (min(y, t) * z))) - x);
	t_2 = ((min(y, t) * 9.0) * z) * max(y, t);
	tmp = 0.0;
	if (t_2 <= -2e-23)
		tmp = t_1;
	elseif (t_2 <= 1e-52)
		tmp = x - (((-27.0 * max(a, b)) * min(a, b)) - x);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x - N[(N[(9 * N[(N[Max[y, t], $MachinePrecision] * N[(N[Min[y, t], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[Min[y, t], $MachinePrecision] * 9), $MachinePrecision] * z), $MachinePrecision] * N[Max[y, t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -6805647338418769/340282366920938463463374607431768211456], t$95$1, If[LessEqual[t$95$2, 336999333339383/3369993333393829974333376885877453834204643052817571560137951281152], N[(x - N[(N[(N[(-27 * N[Max[a, b], $MachinePrecision]), $MachinePrecision] * N[Min[a, b], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := x - \left(9 \cdot \left(\mathsf{max}\left(y, t\right) \cdot \left(\mathsf{min}\left(y, t\right) \cdot z\right)\right) - x\right)\\
t_2 := \left(\left(\mathsf{min}\left(y, t\right) \cdot 9\right) \cdot z\right) \cdot \mathsf{max}\left(y, t\right)\\
\mathbf{if}\;t\_2 \leq \frac{-6805647338418769}{340282366920938463463374607431768211456}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq \frac{336999333339383}{3369993333393829974333376885877453834204643052817571560137951281152}:\\
\;\;\;\;x - \left(\left(-27 \cdot \mathsf{max}\left(a, b\right)\right) \cdot \mathsf{min}\left(a, b\right) - x\right)\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -1.9999999999999999e-23 or 1e-52 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t)

    1. Initial program 94.4%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x - \color{blue}{-1 \cdot x} \]
    5. Step-by-step derivation
      1. lower-*.f6429.9%

        \[\leadsto x - -1 \cdot \color{blue}{x} \]
    6. Applied rewrites29.9%

      \[\leadsto x - \color{blue}{-1 \cdot x} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto x - -1 \cdot \color{blue}{x} \]
      2. mul-1-negN/A

        \[\leadsto x - \left(\mathsf{neg}\left(x\right)\right) \]
      3. lower-neg.f6429.9%

        \[\leadsto x - \left(-x\right) \]
    8. Applied rewrites29.9%

      \[\leadsto x - \left(-x\right) \]
    9. Taylor expanded in a around 0

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

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

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

        \[\leadsto x - \left(9 \cdot \left(t \cdot \left(y \cdot z\right)\right) - x\right) \]
      4. lower-*.f6463.2%

        \[\leadsto x - \left(9 \cdot \left(t \cdot \left(y \cdot z\right)\right) - x\right) \]
    11. Applied rewrites63.2%

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

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

    1. Initial program 94.4%

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

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

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

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

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

        \[\leadsto 2 \cdot x + 27 \cdot \left(a \cdot \color{blue}{b}\right) \]
    4. Applied rewrites64.1%

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

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

        \[\leadsto 2 \cdot x + \color{blue}{27} \cdot \left(a \cdot b\right) \]
      3. count-2-revN/A

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

        \[\leadsto \left(x + x\right) + 27 \cdot \color{blue}{\left(a \cdot b\right)} \]
      5. lift-*.f64N/A

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

        \[\leadsto \left(x + x\right) + \left(27 \cdot a\right) \cdot \color{blue}{b} \]
      7. lift-*.f64N/A

        \[\leadsto \left(x + x\right) + \left(27 \cdot a\right) \cdot b \]
      8. *-commutativeN/A

        \[\leadsto \left(x + x\right) + b \cdot \color{blue}{\left(27 \cdot a\right)} \]
      9. lift-*.f64N/A

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

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

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

        \[\leadsto x + \left(b \cdot \left(27 \cdot a\right) + \color{blue}{x}\right) \]
      13. add-flipN/A

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

        \[\leadsto x - \color{blue}{\left(\mathsf{neg}\left(\left(b \cdot \left(27 \cdot a\right) + x\right)\right)\right)} \]
      15. lift-+.f64N/A

        \[\leadsto x - \left(\mathsf{neg}\left(\left(b \cdot \left(27 \cdot a\right) + x\right)\right)\right) \]
      16. distribute-neg-inN/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(b \cdot \left(27 \cdot a\right)\right)\right) + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right) \]
      17. lift-*.f64N/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(b \cdot \left(27 \cdot a\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      18. *-commutativeN/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(b \cdot \left(a \cdot 27\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      19. lift-*.f64N/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(b \cdot \left(a \cdot 27\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      20. lower-*.f64N/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(b \cdot \left(a \cdot 27\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      21. *-commutativeN/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(\left(a \cdot 27\right) \cdot b\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      22. lift-*.f64N/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(\left(a \cdot 27\right) \cdot b\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      23. sub-flip-reverseN/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(\left(a \cdot 27\right) \cdot b\right)\right) - \color{blue}{x}\right) \]
      24. lower--.f64N/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(\left(a \cdot 27\right) \cdot b\right)\right) - \color{blue}{x}\right) \]
    6. Applied rewrites64.1%

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

        \[\leadsto x - \left(-27 \cdot \left(a \cdot b\right) - x\right) \]
      2. lift-*.f64N/A

        \[\leadsto x - \left(-27 \cdot \left(a \cdot b\right) - x\right) \]
      3. *-commutativeN/A

        \[\leadsto x - \left(-27 \cdot \left(b \cdot a\right) - x\right) \]
      4. associate-*r*N/A

        \[\leadsto x - \left(\left(-27 \cdot b\right) \cdot a - x\right) \]
      5. lower-*.f64N/A

        \[\leadsto x - \left(\left(-27 \cdot b\right) \cdot a - x\right) \]
      6. lower-*.f6464.0%

        \[\leadsto x - \left(\left(-27 \cdot b\right) \cdot a - x\right) \]
    8. Applied rewrites64.0%

      \[\leadsto x - \left(\left(-27 \cdot b\right) \cdot a - x\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 8: 82.7% accurate, 0.0× speedup?

\[\begin{array}{l} t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\ t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\ t_3 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\ t_4 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\ t_5 := \left(\left(t\_4 \cdot 9\right) \cdot t\_2\right) \cdot t\_3\\ \mathbf{if}\;t\_5 \leq -499999999999999964227111724318263497804707306223243456268197521522525585749208789151208295153553467188676004711794318067127242311470730588919109020314930679307514026089293096804165265079253323065443524458327730161833343975424:\\ \;\;\;\;\left(\left(-9 \cdot t\_2\right) \cdot t\_3\right) \cdot t\_4\\ \mathbf{elif}\;t\_5 \leq 199999999999999998950733150383609864631589220901364351243883389463816617076615690273685504:\\ \;\;\;\;x - \left(-27 \cdot \left(a \cdot b\right) - x\right)\\ \mathbf{else}:\\ \;\;\;\;x - 9 \cdot \left(t\_3 \cdot \left(t\_4 \cdot t\_2\right)\right)\\ \end{array} \]
(FPCore (x y z t a b)
  :precision binary64
  (let* ((t_1 (fmax (fmin y z) t))
       (t_2 (fmin (fmax y z) t_1))
       (t_3 (fmax (fmax y z) t_1))
       (t_4 (fmin (fmin y z) t))
       (t_5 (* (* (* t_4 9) t_2) t_3)))
  (if (<=
       t_5
       -499999999999999964227111724318263497804707306223243456268197521522525585749208789151208295153553467188676004711794318067127242311470730588919109020314930679307514026089293096804165265079253323065443524458327730161833343975424)
    (* (* (* -9 t_2) t_3) t_4)
    (if (<=
         t_5
         199999999999999998950733150383609864631589220901364351243883389463816617076615690273685504)
      (- x (- (* -27 (* a b)) x))
      (- x (* 9 (* t_3 (* t_4 t_2))))))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = fmax(fmin(y, z), t);
	double t_2 = fmin(fmax(y, z), t_1);
	double t_3 = fmax(fmax(y, z), t_1);
	double t_4 = fmin(fmin(y, z), t);
	double t_5 = ((t_4 * 9.0) * t_2) * t_3;
	double tmp;
	if (t_5 <= -5e+224) {
		tmp = ((-9.0 * t_2) * t_3) * t_4;
	} else if (t_5 <= 2e+89) {
		tmp = x - ((-27.0 * (a * b)) - x);
	} else {
		tmp = x - (9.0 * (t_3 * (t_4 * 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)
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) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: t_5
    real(8) :: tmp
    t_1 = fmax(fmin(y, z), t)
    t_2 = fmin(fmax(y, z), t_1)
    t_3 = fmax(fmax(y, z), t_1)
    t_4 = fmin(fmin(y, z), t)
    t_5 = ((t_4 * 9.0d0) * t_2) * t_3
    if (t_5 <= (-5d+224)) then
        tmp = (((-9.0d0) * t_2) * t_3) * t_4
    else if (t_5 <= 2d+89) then
        tmp = x - (((-27.0d0) * (a * b)) - x)
    else
        tmp = x - (9.0d0 * (t_3 * (t_4 * 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 t_1 = fmax(fmin(y, z), t);
	double t_2 = fmin(fmax(y, z), t_1);
	double t_3 = fmax(fmax(y, z), t_1);
	double t_4 = fmin(fmin(y, z), t);
	double t_5 = ((t_4 * 9.0) * t_2) * t_3;
	double tmp;
	if (t_5 <= -5e+224) {
		tmp = ((-9.0 * t_2) * t_3) * t_4;
	} else if (t_5 <= 2e+89) {
		tmp = x - ((-27.0 * (a * b)) - x);
	} else {
		tmp = x - (9.0 * (t_3 * (t_4 * t_2)));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = fmax(fmin(y, z), t)
	t_2 = fmin(fmax(y, z), t_1)
	t_3 = fmax(fmax(y, z), t_1)
	t_4 = fmin(fmin(y, z), t)
	t_5 = ((t_4 * 9.0) * t_2) * t_3
	tmp = 0
	if t_5 <= -5e+224:
		tmp = ((-9.0 * t_2) * t_3) * t_4
	elif t_5 <= 2e+89:
		tmp = x - ((-27.0 * (a * b)) - x)
	else:
		tmp = x - (9.0 * (t_3 * (t_4 * t_2)))
	return tmp
function code(x, y, z, t, a, b)
	t_1 = fmax(fmin(y, z), t)
	t_2 = fmin(fmax(y, z), t_1)
	t_3 = fmax(fmax(y, z), t_1)
	t_4 = fmin(fmin(y, z), t)
	t_5 = Float64(Float64(Float64(t_4 * 9.0) * t_2) * t_3)
	tmp = 0.0
	if (t_5 <= -5e+224)
		tmp = Float64(Float64(Float64(-9.0 * t_2) * t_3) * t_4);
	elseif (t_5 <= 2e+89)
		tmp = Float64(x - Float64(Float64(-27.0 * Float64(a * b)) - x));
	else
		tmp = Float64(x - Float64(9.0 * Float64(t_3 * Float64(t_4 * t_2))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = max(min(y, z), t);
	t_2 = min(max(y, z), t_1);
	t_3 = max(max(y, z), t_1);
	t_4 = min(min(y, z), t);
	t_5 = ((t_4 * 9.0) * t_2) * t_3;
	tmp = 0.0;
	if (t_5 <= -5e+224)
		tmp = ((-9.0 * t_2) * t_3) * t_4;
	elseif (t_5 <= 2e+89)
		tmp = x - ((-27.0 * (a * b)) - x);
	else
		tmp = x - (9.0 * (t_3 * (t_4 * t_2)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Max[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$4 = N[Min[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[(t$95$4 * 9), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$3), $MachinePrecision]}, If[LessEqual[t$95$5, -499999999999999964227111724318263497804707306223243456268197521522525585749208789151208295153553467188676004711794318067127242311470730588919109020314930679307514026089293096804165265079253323065443524458327730161833343975424], N[(N[(N[(-9 * t$95$2), $MachinePrecision] * t$95$3), $MachinePrecision] * t$95$4), $MachinePrecision], If[LessEqual[t$95$5, 199999999999999998950733150383609864631589220901364351243883389463816617076615690273685504], N[(x - N[(N[(-27 * N[(a * b), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], N[(x - N[(9 * N[(t$95$3 * N[(t$95$4 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_4 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_5 := \left(\left(t\_4 \cdot 9\right) \cdot t\_2\right) \cdot t\_3\\
\mathbf{if}\;t\_5 \leq -499999999999999964227111724318263497804707306223243456268197521522525585749208789151208295153553467188676004711794318067127242311470730588919109020314930679307514026089293096804165265079253323065443524458327730161833343975424:\\
\;\;\;\;\left(\left(-9 \cdot t\_2\right) \cdot t\_3\right) \cdot t\_4\\

\mathbf{elif}\;t\_5 \leq 199999999999999998950733150383609864631589220901364351243883389463816617076615690273685504:\\
\;\;\;\;x - \left(-27 \cdot \left(a \cdot b\right) - x\right)\\

\mathbf{else}:\\
\;\;\;\;x - 9 \cdot \left(t\_3 \cdot \left(t\_4 \cdot t\_2\right)\right)\\


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

    1. Initial program 94.4%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \left(-9 \cdot \left(t \cdot z\right)\right) \]
    9. Applied rewrites36.1%

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

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

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

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

        \[\leadsto \left(-9 \cdot \left(t \cdot z\right)\right) \cdot y \]
      5. lift-*.f64N/A

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

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

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

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

        \[\leadsto \left(\left(z \cdot -9\right) \cdot t\right) \cdot y \]
      10. lower-*.f6436.1%

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

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

        \[\leadsto \left(\left(-9 \cdot z\right) \cdot t\right) \cdot y \]
      13. lower-*.f6436.1%

        \[\leadsto \left(\left(-9 \cdot z\right) \cdot t\right) \cdot y \]
    11. Applied rewrites36.1%

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

    if -4.9999999999999996e224 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 2e89

    1. Initial program 94.4%

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

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

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

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

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

        \[\leadsto 2 \cdot x + 27 \cdot \left(a \cdot \color{blue}{b}\right) \]
    4. Applied rewrites64.1%

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

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

        \[\leadsto 2 \cdot x + \color{blue}{27} \cdot \left(a \cdot b\right) \]
      3. count-2-revN/A

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

        \[\leadsto \left(x + x\right) + 27 \cdot \color{blue}{\left(a \cdot b\right)} \]
      5. lift-*.f64N/A

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

        \[\leadsto \left(x + x\right) + \left(27 \cdot a\right) \cdot \color{blue}{b} \]
      7. lift-*.f64N/A

        \[\leadsto \left(x + x\right) + \left(27 \cdot a\right) \cdot b \]
      8. *-commutativeN/A

        \[\leadsto \left(x + x\right) + b \cdot \color{blue}{\left(27 \cdot a\right)} \]
      9. lift-*.f64N/A

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

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

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

        \[\leadsto x + \left(b \cdot \left(27 \cdot a\right) + \color{blue}{x}\right) \]
      13. add-flipN/A

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

        \[\leadsto x - \color{blue}{\left(\mathsf{neg}\left(\left(b \cdot \left(27 \cdot a\right) + x\right)\right)\right)} \]
      15. lift-+.f64N/A

        \[\leadsto x - \left(\mathsf{neg}\left(\left(b \cdot \left(27 \cdot a\right) + x\right)\right)\right) \]
      16. distribute-neg-inN/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(b \cdot \left(27 \cdot a\right)\right)\right) + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right) \]
      17. lift-*.f64N/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(b \cdot \left(27 \cdot a\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      18. *-commutativeN/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(b \cdot \left(a \cdot 27\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      19. lift-*.f64N/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(b \cdot \left(a \cdot 27\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      20. lower-*.f64N/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(b \cdot \left(a \cdot 27\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      21. *-commutativeN/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(\left(a \cdot 27\right) \cdot b\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      22. lift-*.f64N/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(\left(a \cdot 27\right) \cdot b\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      23. sub-flip-reverseN/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(\left(a \cdot 27\right) \cdot b\right)\right) - \color{blue}{x}\right) \]
      24. lower--.f64N/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(\left(a \cdot 27\right) \cdot b\right)\right) - \color{blue}{x}\right) \]
    6. Applied rewrites64.1%

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

    if 2e89 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t)

    1. Initial program 94.4%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x - \color{blue}{-1 \cdot x} \]
    5. Step-by-step derivation
      1. lower-*.f6429.9%

        \[\leadsto x - -1 \cdot \color{blue}{x} \]
    6. Applied rewrites29.9%

      \[\leadsto x - \color{blue}{-1 \cdot x} \]
    7. Taylor expanded in y around inf

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

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

        \[\leadsto x - 9 \cdot \left(t \cdot \color{blue}{\left(y \cdot z\right)}\right) \]
      3. lower-*.f6440.6%

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

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

Alternative 9: 82.4% accurate, 0.0× speedup?

\[\begin{array}{l} t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\ t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\ t_3 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\ t_4 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\ t_5 := \left(\left(t\_4 \cdot 9\right) \cdot t\_2\right) \cdot t\_3\\ \mathbf{if}\;t\_5 \leq -499999999999999964227111724318263497804707306223243456268197521522525585749208789151208295153553467188676004711794318067127242311470730588919109020314930679307514026089293096804165265079253323065443524458327730161833343975424:\\ \;\;\;\;\left(\left(-9 \cdot t\_2\right) \cdot t\_3\right) \cdot t\_4\\ \mathbf{elif}\;t\_5 \leq 50000000000000001010943956357797349428804816160717887056888842810400200249908215467934891376640:\\ \;\;\;\;x - \left(-27 \cdot \left(a \cdot b\right) - x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_4 \cdot \left(-9 \cdot \left(t\_3 \cdot t\_2\right)\right)\\ \end{array} \]
(FPCore (x y z t a b)
  :precision binary64
  (let* ((t_1 (fmax (fmin y z) t))
       (t_2 (fmin (fmax y z) t_1))
       (t_3 (fmax (fmax y z) t_1))
       (t_4 (fmin (fmin y z) t))
       (t_5 (* (* (* t_4 9) t_2) t_3)))
  (if (<=
       t_5
       -499999999999999964227111724318263497804707306223243456268197521522525585749208789151208295153553467188676004711794318067127242311470730588919109020314930679307514026089293096804165265079253323065443524458327730161833343975424)
    (* (* (* -9 t_2) t_3) t_4)
    (if (<=
         t_5
         50000000000000001010943956357797349428804816160717887056888842810400200249908215467934891376640)
      (- x (- (* -27 (* a b)) x))
      (* t_4 (* -9 (* t_3 t_2)))))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = fmax(fmin(y, z), t);
	double t_2 = fmin(fmax(y, z), t_1);
	double t_3 = fmax(fmax(y, z), t_1);
	double t_4 = fmin(fmin(y, z), t);
	double t_5 = ((t_4 * 9.0) * t_2) * t_3;
	double tmp;
	if (t_5 <= -5e+224) {
		tmp = ((-9.0 * t_2) * t_3) * t_4;
	} else if (t_5 <= 5e+94) {
		tmp = x - ((-27.0 * (a * b)) - x);
	} else {
		tmp = t_4 * (-9.0 * (t_3 * 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)
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) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: t_5
    real(8) :: tmp
    t_1 = fmax(fmin(y, z), t)
    t_2 = fmin(fmax(y, z), t_1)
    t_3 = fmax(fmax(y, z), t_1)
    t_4 = fmin(fmin(y, z), t)
    t_5 = ((t_4 * 9.0d0) * t_2) * t_3
    if (t_5 <= (-5d+224)) then
        tmp = (((-9.0d0) * t_2) * t_3) * t_4
    else if (t_5 <= 5d+94) then
        tmp = x - (((-27.0d0) * (a * b)) - x)
    else
        tmp = t_4 * ((-9.0d0) * (t_3 * 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 t_1 = fmax(fmin(y, z), t);
	double t_2 = fmin(fmax(y, z), t_1);
	double t_3 = fmax(fmax(y, z), t_1);
	double t_4 = fmin(fmin(y, z), t);
	double t_5 = ((t_4 * 9.0) * t_2) * t_3;
	double tmp;
	if (t_5 <= -5e+224) {
		tmp = ((-9.0 * t_2) * t_3) * t_4;
	} else if (t_5 <= 5e+94) {
		tmp = x - ((-27.0 * (a * b)) - x);
	} else {
		tmp = t_4 * (-9.0 * (t_3 * t_2));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = fmax(fmin(y, z), t)
	t_2 = fmin(fmax(y, z), t_1)
	t_3 = fmax(fmax(y, z), t_1)
	t_4 = fmin(fmin(y, z), t)
	t_5 = ((t_4 * 9.0) * t_2) * t_3
	tmp = 0
	if t_5 <= -5e+224:
		tmp = ((-9.0 * t_2) * t_3) * t_4
	elif t_5 <= 5e+94:
		tmp = x - ((-27.0 * (a * b)) - x)
	else:
		tmp = t_4 * (-9.0 * (t_3 * t_2))
	return tmp
function code(x, y, z, t, a, b)
	t_1 = fmax(fmin(y, z), t)
	t_2 = fmin(fmax(y, z), t_1)
	t_3 = fmax(fmax(y, z), t_1)
	t_4 = fmin(fmin(y, z), t)
	t_5 = Float64(Float64(Float64(t_4 * 9.0) * t_2) * t_3)
	tmp = 0.0
	if (t_5 <= -5e+224)
		tmp = Float64(Float64(Float64(-9.0 * t_2) * t_3) * t_4);
	elseif (t_5 <= 5e+94)
		tmp = Float64(x - Float64(Float64(-27.0 * Float64(a * b)) - x));
	else
		tmp = Float64(t_4 * Float64(-9.0 * Float64(t_3 * t_2)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = max(min(y, z), t);
	t_2 = min(max(y, z), t_1);
	t_3 = max(max(y, z), t_1);
	t_4 = min(min(y, z), t);
	t_5 = ((t_4 * 9.0) * t_2) * t_3;
	tmp = 0.0;
	if (t_5 <= -5e+224)
		tmp = ((-9.0 * t_2) * t_3) * t_4;
	elseif (t_5 <= 5e+94)
		tmp = x - ((-27.0 * (a * b)) - x);
	else
		tmp = t_4 * (-9.0 * (t_3 * t_2));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Max[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$4 = N[Min[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[(t$95$4 * 9), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$3), $MachinePrecision]}, If[LessEqual[t$95$5, -499999999999999964227111724318263497804707306223243456268197521522525585749208789151208295153553467188676004711794318067127242311470730588919109020314930679307514026089293096804165265079253323065443524458327730161833343975424], N[(N[(N[(-9 * t$95$2), $MachinePrecision] * t$95$3), $MachinePrecision] * t$95$4), $MachinePrecision], If[LessEqual[t$95$5, 50000000000000001010943956357797349428804816160717887056888842810400200249908215467934891376640], N[(x - N[(N[(-27 * N[(a * b), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], N[(t$95$4 * N[(-9 * N[(t$95$3 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_4 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_5 := \left(\left(t\_4 \cdot 9\right) \cdot t\_2\right) \cdot t\_3\\
\mathbf{if}\;t\_5 \leq -499999999999999964227111724318263497804707306223243456268197521522525585749208789151208295153553467188676004711794318067127242311470730588919109020314930679307514026089293096804165265079253323065443524458327730161833343975424:\\
\;\;\;\;\left(\left(-9 \cdot t\_2\right) \cdot t\_3\right) \cdot t\_4\\

\mathbf{elif}\;t\_5 \leq 50000000000000001010943956357797349428804816160717887056888842810400200249908215467934891376640:\\
\;\;\;\;x - \left(-27 \cdot \left(a \cdot b\right) - x\right)\\

\mathbf{else}:\\
\;\;\;\;t\_4 \cdot \left(-9 \cdot \left(t\_3 \cdot t\_2\right)\right)\\


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

    1. Initial program 94.4%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \left(-9 \cdot \left(t \cdot z\right)\right) \]
    9. Applied rewrites36.1%

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

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

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

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

        \[\leadsto \left(-9 \cdot \left(t \cdot z\right)\right) \cdot y \]
      5. lift-*.f64N/A

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

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

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

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

        \[\leadsto \left(\left(z \cdot -9\right) \cdot t\right) \cdot y \]
      10. lower-*.f6436.1%

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

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

        \[\leadsto \left(\left(-9 \cdot z\right) \cdot t\right) \cdot y \]
      13. lower-*.f6436.1%

        \[\leadsto \left(\left(-9 \cdot z\right) \cdot t\right) \cdot y \]
    11. Applied rewrites36.1%

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

    if -4.9999999999999996e224 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 5.0000000000000001e94

    1. Initial program 94.4%

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

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

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

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

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

        \[\leadsto 2 \cdot x + 27 \cdot \left(a \cdot \color{blue}{b}\right) \]
    4. Applied rewrites64.1%

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

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

        \[\leadsto 2 \cdot x + \color{blue}{27} \cdot \left(a \cdot b\right) \]
      3. count-2-revN/A

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

        \[\leadsto \left(x + x\right) + 27 \cdot \color{blue}{\left(a \cdot b\right)} \]
      5. lift-*.f64N/A

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

        \[\leadsto \left(x + x\right) + \left(27 \cdot a\right) \cdot \color{blue}{b} \]
      7. lift-*.f64N/A

        \[\leadsto \left(x + x\right) + \left(27 \cdot a\right) \cdot b \]
      8. *-commutativeN/A

        \[\leadsto \left(x + x\right) + b \cdot \color{blue}{\left(27 \cdot a\right)} \]
      9. lift-*.f64N/A

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

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

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

        \[\leadsto x + \left(b \cdot \left(27 \cdot a\right) + \color{blue}{x}\right) \]
      13. add-flipN/A

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

        \[\leadsto x - \color{blue}{\left(\mathsf{neg}\left(\left(b \cdot \left(27 \cdot a\right) + x\right)\right)\right)} \]
      15. lift-+.f64N/A

        \[\leadsto x - \left(\mathsf{neg}\left(\left(b \cdot \left(27 \cdot a\right) + x\right)\right)\right) \]
      16. distribute-neg-inN/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(b \cdot \left(27 \cdot a\right)\right)\right) + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right) \]
      17. lift-*.f64N/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(b \cdot \left(27 \cdot a\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      18. *-commutativeN/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(b \cdot \left(a \cdot 27\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      19. lift-*.f64N/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(b \cdot \left(a \cdot 27\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      20. lower-*.f64N/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(b \cdot \left(a \cdot 27\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      21. *-commutativeN/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(\left(a \cdot 27\right) \cdot b\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      22. lift-*.f64N/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(\left(a \cdot 27\right) \cdot b\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      23. sub-flip-reverseN/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(\left(a \cdot 27\right) \cdot b\right)\right) - \color{blue}{x}\right) \]
      24. lower--.f64N/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(\left(a \cdot 27\right) \cdot b\right)\right) - \color{blue}{x}\right) \]
    6. Applied rewrites64.1%

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

    if 5.0000000000000001e94 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t)

    1. Initial program 94.4%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \left(-9 \cdot \left(t \cdot z\right)\right) \]
    9. Applied rewrites36.1%

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

Alternative 10: 81.8% accurate, 0.0× speedup?

\[\begin{array}{l} t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\ t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\ t_3 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\ t_4 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\ t_5 := \left(\left(t\_4 \cdot 9\right) \cdot t\_2\right) \cdot t\_3\\ \mathbf{if}\;t\_5 \leq -499999999999999964227111724318263497804707306223243456268197521522525585749208789151208295153553467188676004711794318067127242311470730588919109020314930679307514026089293096804165265079253323065443524458327730161833343975424:\\ \;\;\;\;\left(\left(-9 \cdot t\_2\right) \cdot t\_3\right) \cdot t\_4\\ \mathbf{elif}\;t\_5 \leq 200000000000000015259539682183774006589929941893120:\\ \;\;\;\;\left(x + x\right) + \left(27 \cdot b\right) \cdot a\\ \mathbf{else}:\\ \;\;\;\;t\_4 \cdot \left(-9 \cdot \left(t\_3 \cdot t\_2\right)\right)\\ \end{array} \]
(FPCore (x y z t a b)
  :precision binary64
  (let* ((t_1 (fmax (fmin y z) t))
       (t_2 (fmin (fmax y z) t_1))
       (t_3 (fmax (fmax y z) t_1))
       (t_4 (fmin (fmin y z) t))
       (t_5 (* (* (* t_4 9) t_2) t_3)))
  (if (<=
       t_5
       -499999999999999964227111724318263497804707306223243456268197521522525585749208789151208295153553467188676004711794318067127242311470730588919109020314930679307514026089293096804165265079253323065443524458327730161833343975424)
    (* (* (* -9 t_2) t_3) t_4)
    (if (<= t_5 200000000000000015259539682183774006589929941893120)
      (+ (+ x x) (* (* 27 b) a))
      (* t_4 (* -9 (* t_3 t_2)))))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = fmax(fmin(y, z), t);
	double t_2 = fmin(fmax(y, z), t_1);
	double t_3 = fmax(fmax(y, z), t_1);
	double t_4 = fmin(fmin(y, z), t);
	double t_5 = ((t_4 * 9.0) * t_2) * t_3;
	double tmp;
	if (t_5 <= -5e+224) {
		tmp = ((-9.0 * t_2) * t_3) * t_4;
	} else if (t_5 <= 2e+50) {
		tmp = (x + x) + ((27.0 * b) * a);
	} else {
		tmp = t_4 * (-9.0 * (t_3 * 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)
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) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: t_5
    real(8) :: tmp
    t_1 = fmax(fmin(y, z), t)
    t_2 = fmin(fmax(y, z), t_1)
    t_3 = fmax(fmax(y, z), t_1)
    t_4 = fmin(fmin(y, z), t)
    t_5 = ((t_4 * 9.0d0) * t_2) * t_3
    if (t_5 <= (-5d+224)) then
        tmp = (((-9.0d0) * t_2) * t_3) * t_4
    else if (t_5 <= 2d+50) then
        tmp = (x + x) + ((27.0d0 * b) * a)
    else
        tmp = t_4 * ((-9.0d0) * (t_3 * 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 t_1 = fmax(fmin(y, z), t);
	double t_2 = fmin(fmax(y, z), t_1);
	double t_3 = fmax(fmax(y, z), t_1);
	double t_4 = fmin(fmin(y, z), t);
	double t_5 = ((t_4 * 9.0) * t_2) * t_3;
	double tmp;
	if (t_5 <= -5e+224) {
		tmp = ((-9.0 * t_2) * t_3) * t_4;
	} else if (t_5 <= 2e+50) {
		tmp = (x + x) + ((27.0 * b) * a);
	} else {
		tmp = t_4 * (-9.0 * (t_3 * t_2));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = fmax(fmin(y, z), t)
	t_2 = fmin(fmax(y, z), t_1)
	t_3 = fmax(fmax(y, z), t_1)
	t_4 = fmin(fmin(y, z), t)
	t_5 = ((t_4 * 9.0) * t_2) * t_3
	tmp = 0
	if t_5 <= -5e+224:
		tmp = ((-9.0 * t_2) * t_3) * t_4
	elif t_5 <= 2e+50:
		tmp = (x + x) + ((27.0 * b) * a)
	else:
		tmp = t_4 * (-9.0 * (t_3 * t_2))
	return tmp
function code(x, y, z, t, a, b)
	t_1 = fmax(fmin(y, z), t)
	t_2 = fmin(fmax(y, z), t_1)
	t_3 = fmax(fmax(y, z), t_1)
	t_4 = fmin(fmin(y, z), t)
	t_5 = Float64(Float64(Float64(t_4 * 9.0) * t_2) * t_3)
	tmp = 0.0
	if (t_5 <= -5e+224)
		tmp = Float64(Float64(Float64(-9.0 * t_2) * t_3) * t_4);
	elseif (t_5 <= 2e+50)
		tmp = Float64(Float64(x + x) + Float64(Float64(27.0 * b) * a));
	else
		tmp = Float64(t_4 * Float64(-9.0 * Float64(t_3 * t_2)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = max(min(y, z), t);
	t_2 = min(max(y, z), t_1);
	t_3 = max(max(y, z), t_1);
	t_4 = min(min(y, z), t);
	t_5 = ((t_4 * 9.0) * t_2) * t_3;
	tmp = 0.0;
	if (t_5 <= -5e+224)
		tmp = ((-9.0 * t_2) * t_3) * t_4;
	elseif (t_5 <= 2e+50)
		tmp = (x + x) + ((27.0 * b) * a);
	else
		tmp = t_4 * (-9.0 * (t_3 * t_2));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Max[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$4 = N[Min[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[(t$95$4 * 9), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$3), $MachinePrecision]}, If[LessEqual[t$95$5, -499999999999999964227111724318263497804707306223243456268197521522525585749208789151208295153553467188676004711794318067127242311470730588919109020314930679307514026089293096804165265079253323065443524458327730161833343975424], N[(N[(N[(-9 * t$95$2), $MachinePrecision] * t$95$3), $MachinePrecision] * t$95$4), $MachinePrecision], If[LessEqual[t$95$5, 200000000000000015259539682183774006589929941893120], N[(N[(x + x), $MachinePrecision] + N[(N[(27 * b), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(t$95$4 * N[(-9 * N[(t$95$3 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_4 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_5 := \left(\left(t\_4 \cdot 9\right) \cdot t\_2\right) \cdot t\_3\\
\mathbf{if}\;t\_5 \leq -499999999999999964227111724318263497804707306223243456268197521522525585749208789151208295153553467188676004711794318067127242311470730588919109020314930679307514026089293096804165265079253323065443524458327730161833343975424:\\
\;\;\;\;\left(\left(-9 \cdot t\_2\right) \cdot t\_3\right) \cdot t\_4\\

\mathbf{elif}\;t\_5 \leq 200000000000000015259539682183774006589929941893120:\\
\;\;\;\;\left(x + x\right) + \left(27 \cdot b\right) \cdot a\\

\mathbf{else}:\\
\;\;\;\;t\_4 \cdot \left(-9 \cdot \left(t\_3 \cdot t\_2\right)\right)\\


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

    1. Initial program 94.4%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \left(-9 \cdot \left(t \cdot z\right)\right) \]
    9. Applied rewrites36.1%

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

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

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

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

        \[\leadsto \left(-9 \cdot \left(t \cdot z\right)\right) \cdot y \]
      5. lift-*.f64N/A

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

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

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

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

        \[\leadsto \left(\left(z \cdot -9\right) \cdot t\right) \cdot y \]
      10. lower-*.f6436.1%

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

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

        \[\leadsto \left(\left(-9 \cdot z\right) \cdot t\right) \cdot y \]
      13. lower-*.f6436.1%

        \[\leadsto \left(\left(-9 \cdot z\right) \cdot t\right) \cdot y \]
    11. Applied rewrites36.1%

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

    if -4.9999999999999996e224 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 2.0000000000000002e50

    1. Initial program 94.4%

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

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

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

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

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

        \[\leadsto 2 \cdot x + 27 \cdot \left(a \cdot \color{blue}{b}\right) \]
    4. Applied rewrites64.1%

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

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

        \[\leadsto \left(x + x\right) + \color{blue}{27} \cdot \left(a \cdot b\right) \]
      3. lower-+.f6464.1%

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

        \[\leadsto \left(x + x\right) + 27 \cdot \color{blue}{\left(a \cdot b\right)} \]
      5. lift-*.f64N/A

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

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

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

        \[\leadsto \left(x + x\right) + \left(b \cdot 27\right) \cdot a \]
      9. lift-*.f64N/A

        \[\leadsto \left(x + x\right) + \left(b \cdot 27\right) \cdot a \]
      10. lift-*.f6464.0%

        \[\leadsto \left(x + x\right) + \left(b \cdot 27\right) \cdot \color{blue}{a} \]
      11. lift-*.f64N/A

        \[\leadsto \left(x + x\right) + \left(b \cdot 27\right) \cdot a \]
      12. *-commutativeN/A

        \[\leadsto \left(x + x\right) + \left(27 \cdot b\right) \cdot a \]
      13. lower-*.f6464.0%

        \[\leadsto \left(x + x\right) + \left(27 \cdot b\right) \cdot a \]
    6. Applied rewrites64.0%

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

    if 2.0000000000000002e50 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t)

    1. Initial program 94.4%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \left(-9 \cdot \left(t \cdot z\right)\right) \]
    9. Applied rewrites36.1%

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

Alternative 11: 59.9% accurate, 0.0× speedup?

\[\begin{array}{l} t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\ t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\ t_3 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\ t_4 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\ t_5 := \left(\left(t\_4 \cdot 9\right) \cdot t\_2\right) \cdot t\_3\\ \mathbf{if}\;t\_5 \leq \frac{-6805647338418769}{340282366920938463463374607431768211456}:\\ \;\;\;\;t\_4 \cdot \left(\left(-9 \cdot t\_3\right) \cdot t\_2\right)\\ \mathbf{elif}\;t\_5 \leq \frac{6304320991423117}{630432099142311667396464641602297820881275828327447146687172694467931548343955369782628260078158650252906047844909056}:\\ \;\;\;\;x - -27 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;t\_5 \leq 200000000000000015259539682183774006589929941893120:\\ \;\;\;\;x - \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_4 \cdot \left(-9 \cdot \left(t\_3 \cdot t\_2\right)\right)\\ \end{array} \]
(FPCore (x y z t a b)
  :precision binary64
  (let* ((t_1 (fmax (fmin y z) t))
       (t_2 (fmin (fmax y z) t_1))
       (t_3 (fmax (fmax y z) t_1))
       (t_4 (fmin (fmin y z) t))
       (t_5 (* (* (* t_4 9) t_2) t_3)))
  (if (<=
       t_5
       -6805647338418769/340282366920938463463374607431768211456)
    (* t_4 (* (* -9 t_3) t_2))
    (if (<=
         t_5
         6304320991423117/630432099142311667396464641602297820881275828327447146687172694467931548343955369782628260078158650252906047844909056)
      (- x (* -27 (* a b)))
      (if (<= t_5 200000000000000015259539682183774006589929941893120)
        (- x (- x))
        (* t_4 (* -9 (* t_3 t_2))))))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = fmax(fmin(y, z), t);
	double t_2 = fmin(fmax(y, z), t_1);
	double t_3 = fmax(fmax(y, z), t_1);
	double t_4 = fmin(fmin(y, z), t);
	double t_5 = ((t_4 * 9.0) * t_2) * t_3;
	double tmp;
	if (t_5 <= -2e-23) {
		tmp = t_4 * ((-9.0 * t_3) * t_2);
	} else if (t_5 <= 1e-101) {
		tmp = x - (-27.0 * (a * b));
	} else if (t_5 <= 2e+50) {
		tmp = x - -x;
	} else {
		tmp = t_4 * (-9.0 * (t_3 * 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)
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) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: t_5
    real(8) :: tmp
    t_1 = fmax(fmin(y, z), t)
    t_2 = fmin(fmax(y, z), t_1)
    t_3 = fmax(fmax(y, z), t_1)
    t_4 = fmin(fmin(y, z), t)
    t_5 = ((t_4 * 9.0d0) * t_2) * t_3
    if (t_5 <= (-2d-23)) then
        tmp = t_4 * (((-9.0d0) * t_3) * t_2)
    else if (t_5 <= 1d-101) then
        tmp = x - ((-27.0d0) * (a * b))
    else if (t_5 <= 2d+50) then
        tmp = x - -x
    else
        tmp = t_4 * ((-9.0d0) * (t_3 * 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 t_1 = fmax(fmin(y, z), t);
	double t_2 = fmin(fmax(y, z), t_1);
	double t_3 = fmax(fmax(y, z), t_1);
	double t_4 = fmin(fmin(y, z), t);
	double t_5 = ((t_4 * 9.0) * t_2) * t_3;
	double tmp;
	if (t_5 <= -2e-23) {
		tmp = t_4 * ((-9.0 * t_3) * t_2);
	} else if (t_5 <= 1e-101) {
		tmp = x - (-27.0 * (a * b));
	} else if (t_5 <= 2e+50) {
		tmp = x - -x;
	} else {
		tmp = t_4 * (-9.0 * (t_3 * t_2));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = fmax(fmin(y, z), t)
	t_2 = fmin(fmax(y, z), t_1)
	t_3 = fmax(fmax(y, z), t_1)
	t_4 = fmin(fmin(y, z), t)
	t_5 = ((t_4 * 9.0) * t_2) * t_3
	tmp = 0
	if t_5 <= -2e-23:
		tmp = t_4 * ((-9.0 * t_3) * t_2)
	elif t_5 <= 1e-101:
		tmp = x - (-27.0 * (a * b))
	elif t_5 <= 2e+50:
		tmp = x - -x
	else:
		tmp = t_4 * (-9.0 * (t_3 * t_2))
	return tmp
function code(x, y, z, t, a, b)
	t_1 = fmax(fmin(y, z), t)
	t_2 = fmin(fmax(y, z), t_1)
	t_3 = fmax(fmax(y, z), t_1)
	t_4 = fmin(fmin(y, z), t)
	t_5 = Float64(Float64(Float64(t_4 * 9.0) * t_2) * t_3)
	tmp = 0.0
	if (t_5 <= -2e-23)
		tmp = Float64(t_4 * Float64(Float64(-9.0 * t_3) * t_2));
	elseif (t_5 <= 1e-101)
		tmp = Float64(x - Float64(-27.0 * Float64(a * b)));
	elseif (t_5 <= 2e+50)
		tmp = Float64(x - Float64(-x));
	else
		tmp = Float64(t_4 * Float64(-9.0 * Float64(t_3 * t_2)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = max(min(y, z), t);
	t_2 = min(max(y, z), t_1);
	t_3 = max(max(y, z), t_1);
	t_4 = min(min(y, z), t);
	t_5 = ((t_4 * 9.0) * t_2) * t_3;
	tmp = 0.0;
	if (t_5 <= -2e-23)
		tmp = t_4 * ((-9.0 * t_3) * t_2);
	elseif (t_5 <= 1e-101)
		tmp = x - (-27.0 * (a * b));
	elseif (t_5 <= 2e+50)
		tmp = x - -x;
	else
		tmp = t_4 * (-9.0 * (t_3 * t_2));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Max[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$4 = N[Min[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[(t$95$4 * 9), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$3), $MachinePrecision]}, If[LessEqual[t$95$5, -6805647338418769/340282366920938463463374607431768211456], N[(t$95$4 * N[(N[(-9 * t$95$3), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 6304320991423117/630432099142311667396464641602297820881275828327447146687172694467931548343955369782628260078158650252906047844909056], N[(x - N[(-27 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 200000000000000015259539682183774006589929941893120], N[(x - (-x)), $MachinePrecision], N[(t$95$4 * N[(-9 * N[(t$95$3 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_4 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_5 := \left(\left(t\_4 \cdot 9\right) \cdot t\_2\right) \cdot t\_3\\
\mathbf{if}\;t\_5 \leq \frac{-6805647338418769}{340282366920938463463374607431768211456}:\\
\;\;\;\;t\_4 \cdot \left(\left(-9 \cdot t\_3\right) \cdot t\_2\right)\\

\mathbf{elif}\;t\_5 \leq \frac{6304320991423117}{630432099142311667396464641602297820881275828327447146687172694467931548343955369782628260078158650252906047844909056}:\\
\;\;\;\;x - -27 \cdot \left(a \cdot b\right)\\

\mathbf{elif}\;t\_5 \leq 200000000000000015259539682183774006589929941893120:\\
\;\;\;\;x - \left(-x\right)\\

\mathbf{else}:\\
\;\;\;\;t\_4 \cdot \left(-9 \cdot \left(t\_3 \cdot t\_2\right)\right)\\


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

    1. Initial program 94.4%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \left(-9 \cdot \left(t \cdot z\right)\right) \]
    9. Applied rewrites36.1%

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

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

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

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

        \[\leadsto y \cdot \left(\left(-9 \cdot t\right) \cdot z\right) \]
      5. lower-*.f6436.1%

        \[\leadsto y \cdot \left(\left(-9 \cdot t\right) \cdot z\right) \]
    11. Applied rewrites36.1%

      \[\leadsto y \cdot \left(\left(-9 \cdot t\right) \cdot z\right) \]

    if -1.9999999999999999e-23 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 1.0000000000000001e-101

    1. Initial program 94.4%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.0000000000000001e-101 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 2.0000000000000002e50

    1. Initial program 94.4%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x - \color{blue}{-1 \cdot x} \]
    5. Step-by-step derivation
      1. lower-*.f6429.9%

        \[\leadsto x - -1 \cdot \color{blue}{x} \]
    6. Applied rewrites29.9%

      \[\leadsto x - \color{blue}{-1 \cdot x} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto x - -1 \cdot \color{blue}{x} \]
      2. mul-1-negN/A

        \[\leadsto x - \left(\mathsf{neg}\left(x\right)\right) \]
      3. lower-neg.f6429.9%

        \[\leadsto x - \left(-x\right) \]
    8. Applied rewrites29.9%

      \[\leadsto x - \left(-x\right) \]

    if 2.0000000000000002e50 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t)

    1. Initial program 94.4%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \left(-9 \cdot \left(t \cdot z\right)\right) \]
    9. Applied rewrites36.1%

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

Alternative 12: 59.9% accurate, 0.0× speedup?

\[\begin{array}{l} t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\ t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\ t_3 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\ t_4 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\ t_5 := t\_4 \cdot \left(-9 \cdot \left(t\_3 \cdot t\_2\right)\right)\\ t_6 := \left(\left(t\_4 \cdot 9\right) \cdot t\_2\right) \cdot t\_3\\ \mathbf{if}\;t\_6 \leq \frac{-6805647338418769}{340282366920938463463374607431768211456}:\\ \;\;\;\;t\_5\\ \mathbf{elif}\;t\_6 \leq \frac{6304320991423117}{630432099142311667396464641602297820881275828327447146687172694467931548343955369782628260078158650252906047844909056}:\\ \;\;\;\;x - -27 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;t\_6 \leq 200000000000000015259539682183774006589929941893120:\\ \;\;\;\;x - \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_5\\ \end{array} \]
(FPCore (x y z t a b)
  :precision binary64
  (let* ((t_1 (fmax (fmin y z) t))
       (t_2 (fmin (fmax y z) t_1))
       (t_3 (fmax (fmax y z) t_1))
       (t_4 (fmin (fmin y z) t))
       (t_5 (* t_4 (* -9 (* t_3 t_2))))
       (t_6 (* (* (* t_4 9) t_2) t_3)))
  (if (<=
       t_6
       -6805647338418769/340282366920938463463374607431768211456)
    t_5
    (if (<=
         t_6
         6304320991423117/630432099142311667396464641602297820881275828327447146687172694467931548343955369782628260078158650252906047844909056)
      (- x (* -27 (* a b)))
      (if (<= t_6 200000000000000015259539682183774006589929941893120)
        (- x (- x))
        t_5)))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = fmax(fmin(y, z), t);
	double t_2 = fmin(fmax(y, z), t_1);
	double t_3 = fmax(fmax(y, z), t_1);
	double t_4 = fmin(fmin(y, z), t);
	double t_5 = t_4 * (-9.0 * (t_3 * t_2));
	double t_6 = ((t_4 * 9.0) * t_2) * t_3;
	double tmp;
	if (t_6 <= -2e-23) {
		tmp = t_5;
	} else if (t_6 <= 1e-101) {
		tmp = x - (-27.0 * (a * b));
	} else if (t_6 <= 2e+50) {
		tmp = x - -x;
	} else {
		tmp = t_5;
	}
	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)
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) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: t_5
    real(8) :: t_6
    real(8) :: tmp
    t_1 = fmax(fmin(y, z), t)
    t_2 = fmin(fmax(y, z), t_1)
    t_3 = fmax(fmax(y, z), t_1)
    t_4 = fmin(fmin(y, z), t)
    t_5 = t_4 * ((-9.0d0) * (t_3 * t_2))
    t_6 = ((t_4 * 9.0d0) * t_2) * t_3
    if (t_6 <= (-2d-23)) then
        tmp = t_5
    else if (t_6 <= 1d-101) then
        tmp = x - ((-27.0d0) * (a * b))
    else if (t_6 <= 2d+50) then
        tmp = x - -x
    else
        tmp = t_5
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = fmax(fmin(y, z), t);
	double t_2 = fmin(fmax(y, z), t_1);
	double t_3 = fmax(fmax(y, z), t_1);
	double t_4 = fmin(fmin(y, z), t);
	double t_5 = t_4 * (-9.0 * (t_3 * t_2));
	double t_6 = ((t_4 * 9.0) * t_2) * t_3;
	double tmp;
	if (t_6 <= -2e-23) {
		tmp = t_5;
	} else if (t_6 <= 1e-101) {
		tmp = x - (-27.0 * (a * b));
	} else if (t_6 <= 2e+50) {
		tmp = x - -x;
	} else {
		tmp = t_5;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = fmax(fmin(y, z), t)
	t_2 = fmin(fmax(y, z), t_1)
	t_3 = fmax(fmax(y, z), t_1)
	t_4 = fmin(fmin(y, z), t)
	t_5 = t_4 * (-9.0 * (t_3 * t_2))
	t_6 = ((t_4 * 9.0) * t_2) * t_3
	tmp = 0
	if t_6 <= -2e-23:
		tmp = t_5
	elif t_6 <= 1e-101:
		tmp = x - (-27.0 * (a * b))
	elif t_6 <= 2e+50:
		tmp = x - -x
	else:
		tmp = t_5
	return tmp
function code(x, y, z, t, a, b)
	t_1 = fmax(fmin(y, z), t)
	t_2 = fmin(fmax(y, z), t_1)
	t_3 = fmax(fmax(y, z), t_1)
	t_4 = fmin(fmin(y, z), t)
	t_5 = Float64(t_4 * Float64(-9.0 * Float64(t_3 * t_2)))
	t_6 = Float64(Float64(Float64(t_4 * 9.0) * t_2) * t_3)
	tmp = 0.0
	if (t_6 <= -2e-23)
		tmp = t_5;
	elseif (t_6 <= 1e-101)
		tmp = Float64(x - Float64(-27.0 * Float64(a * b)));
	elseif (t_6 <= 2e+50)
		tmp = Float64(x - Float64(-x));
	else
		tmp = t_5;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = max(min(y, z), t);
	t_2 = min(max(y, z), t_1);
	t_3 = max(max(y, z), t_1);
	t_4 = min(min(y, z), t);
	t_5 = t_4 * (-9.0 * (t_3 * t_2));
	t_6 = ((t_4 * 9.0) * t_2) * t_3;
	tmp = 0.0;
	if (t_6 <= -2e-23)
		tmp = t_5;
	elseif (t_6 <= 1e-101)
		tmp = x - (-27.0 * (a * b));
	elseif (t_6 <= 2e+50)
		tmp = x - -x;
	else
		tmp = t_5;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Max[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$4 = N[Min[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$5 = N[(t$95$4 * N[(-9 * N[(t$95$3 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(N[(N[(t$95$4 * 9), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$3), $MachinePrecision]}, If[LessEqual[t$95$6, -6805647338418769/340282366920938463463374607431768211456], t$95$5, If[LessEqual[t$95$6, 6304320991423117/630432099142311667396464641602297820881275828327447146687172694467931548343955369782628260078158650252906047844909056], N[(x - N[(-27 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$6, 200000000000000015259539682183774006589929941893120], N[(x - (-x)), $MachinePrecision], t$95$5]]]]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_4 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_5 := t\_4 \cdot \left(-9 \cdot \left(t\_3 \cdot t\_2\right)\right)\\
t_6 := \left(\left(t\_4 \cdot 9\right) \cdot t\_2\right) \cdot t\_3\\
\mathbf{if}\;t\_6 \leq \frac{-6805647338418769}{340282366920938463463374607431768211456}:\\
\;\;\;\;t\_5\\

\mathbf{elif}\;t\_6 \leq \frac{6304320991423117}{630432099142311667396464641602297820881275828327447146687172694467931548343955369782628260078158650252906047844909056}:\\
\;\;\;\;x - -27 \cdot \left(a \cdot b\right)\\

\mathbf{elif}\;t\_6 \leq 200000000000000015259539682183774006589929941893120:\\
\;\;\;\;x - \left(-x\right)\\

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


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -1.9999999999999999e-23 or 2.0000000000000002e50 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t)

    1. Initial program 94.4%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \left(-9 \cdot \left(t \cdot z\right)\right) \]
    9. Applied rewrites36.1%

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

    if -1.9999999999999999e-23 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 1.0000000000000001e-101

    1. Initial program 94.4%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.0000000000000001e-101 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 2.0000000000000002e50

    1. Initial program 94.4%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x - \color{blue}{-1 \cdot x} \]
    5. Step-by-step derivation
      1. lower-*.f6429.9%

        \[\leadsto x - -1 \cdot \color{blue}{x} \]
    6. Applied rewrites29.9%

      \[\leadsto x - \color{blue}{-1 \cdot x} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto x - -1 \cdot \color{blue}{x} \]
      2. mul-1-negN/A

        \[\leadsto x - \left(\mathsf{neg}\left(x\right)\right) \]
      3. lower-neg.f6429.9%

        \[\leadsto x - \left(-x\right) \]
    8. Applied rewrites29.9%

      \[\leadsto x - \left(-x\right) \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 13: 53.8% accurate, 0.8× speedup?

\[\begin{array}{l} t_1 := \left(a \cdot 27\right) \cdot b\\ t_2 := x - -27 \cdot \left(a \cdot b\right)\\ \mathbf{if}\;t\_1 \leq -2000000000000:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq \frac{4789048565205903}{95780971304118053647396689196894323976171195136475136}:\\ \;\;\;\;x - \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \]
(FPCore (x y z t a b)
  :precision binary64
  (let* ((t_1 (* (* a 27) b)) (t_2 (- x (* -27 (* a b)))))
  (if (<= t_1 -2000000000000)
    t_2
    (if (<=
         t_1
         4789048565205903/95780971304118053647396689196894323976171195136475136)
      (- x (- x))
      t_2))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (a * 27.0) * b;
	double t_2 = x - (-27.0 * (a * b));
	double tmp;
	if (t_1 <= -2000000000000.0) {
		tmp = t_2;
	} else if (t_1 <= 5e-38) {
		tmp = x - -x;
	} 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)
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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (a * 27.0d0) * b
    t_2 = x - ((-27.0d0) * (a * b))
    if (t_1 <= (-2000000000000.0d0)) then
        tmp = t_2
    else if (t_1 <= 5d-38) then
        tmp = x - -x
    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 t_1 = (a * 27.0) * b;
	double t_2 = x - (-27.0 * (a * b));
	double tmp;
	if (t_1 <= -2000000000000.0) {
		tmp = t_2;
	} else if (t_1 <= 5e-38) {
		tmp = x - -x;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = (a * 27.0) * b
	t_2 = x - (-27.0 * (a * b))
	tmp = 0
	if t_1 <= -2000000000000.0:
		tmp = t_2
	elif t_1 <= 5e-38:
		tmp = x - -x
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(a * 27.0) * b)
	t_2 = Float64(x - Float64(-27.0 * Float64(a * b)))
	tmp = 0.0
	if (t_1 <= -2000000000000.0)
		tmp = t_2;
	elseif (t_1 <= 5e-38)
		tmp = Float64(x - Float64(-x));
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = (a * 27.0) * b;
	t_2 = x - (-27.0 * (a * b));
	tmp = 0.0;
	if (t_1 <= -2000000000000.0)
		tmp = t_2;
	elseif (t_1 <= 5e-38)
		tmp = x - -x;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * 27), $MachinePrecision] * b), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(-27 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2000000000000], t$95$2, If[LessEqual[t$95$1, 4789048565205903/95780971304118053647396689196894323976171195136475136], N[(x - (-x)), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
t_1 := \left(a \cdot 27\right) \cdot b\\
t_2 := x - -27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;t\_1 \leq -2000000000000:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_1 \leq \frac{4789048565205903}{95780971304118053647396689196894323976171195136475136}:\\
\;\;\;\;x - \left(-x\right)\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 a #s(literal 27 binary64)) b) < -2e12 or 5.0000000000000003e-38 < (*.f64 (*.f64 a #s(literal 27 binary64)) b)

    1. Initial program 94.4%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2e12 < (*.f64 (*.f64 a #s(literal 27 binary64)) b) < 5.0000000000000003e-38

    1. Initial program 94.4%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x - \color{blue}{-1 \cdot x} \]
    5. Step-by-step derivation
      1. lower-*.f6429.9%

        \[\leadsto x - -1 \cdot \color{blue}{x} \]
    6. Applied rewrites29.9%

      \[\leadsto x - \color{blue}{-1 \cdot x} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto x - -1 \cdot \color{blue}{x} \]
      2. mul-1-negN/A

        \[\leadsto x - \left(\mathsf{neg}\left(x\right)\right) \]
      3. lower-neg.f6429.9%

        \[\leadsto x - \left(-x\right) \]
    8. Applied rewrites29.9%

      \[\leadsto x - \left(-x\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 14: 52.6% accurate, 0.9× speedup?

\[\begin{array}{l} t_1 := \left(a \cdot 27\right) \cdot b\\ t_2 := 27 \cdot \left(a \cdot b\right)\\ \mathbf{if}\;t\_1 \leq -10000000000000000905969664:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq \frac{5021681388309345}{50216813883093446110686315385661331328818843555712276103168}:\\ \;\;\;\;x - \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \]
(FPCore (x y z t a b)
  :precision binary64
  (let* ((t_1 (* (* a 27) b)) (t_2 (* 27 (* a b))))
  (if (<= t_1 -10000000000000000905969664)
    t_2
    (if (<=
         t_1
         5021681388309345/50216813883093446110686315385661331328818843555712276103168)
      (- x (- x))
      t_2))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (a * 27.0) * b;
	double t_2 = 27.0 * (a * b);
	double tmp;
	if (t_1 <= -1e+25) {
		tmp = t_2;
	} else if (t_1 <= 1e-43) {
		tmp = x - -x;
	} 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)
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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (a * 27.0d0) * b
    t_2 = 27.0d0 * (a * b)
    if (t_1 <= (-1d+25)) then
        tmp = t_2
    else if (t_1 <= 1d-43) then
        tmp = x - -x
    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 t_1 = (a * 27.0) * b;
	double t_2 = 27.0 * (a * b);
	double tmp;
	if (t_1 <= -1e+25) {
		tmp = t_2;
	} else if (t_1 <= 1e-43) {
		tmp = x - -x;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = (a * 27.0) * b
	t_2 = 27.0 * (a * b)
	tmp = 0
	if t_1 <= -1e+25:
		tmp = t_2
	elif t_1 <= 1e-43:
		tmp = x - -x
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(a * 27.0) * b)
	t_2 = Float64(27.0 * Float64(a * b))
	tmp = 0.0
	if (t_1 <= -1e+25)
		tmp = t_2;
	elseif (t_1 <= 1e-43)
		tmp = Float64(x - Float64(-x));
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = (a * 27.0) * b;
	t_2 = 27.0 * (a * b);
	tmp = 0.0;
	if (t_1 <= -1e+25)
		tmp = t_2;
	elseif (t_1 <= 1e-43)
		tmp = x - -x;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * 27), $MachinePrecision] * b), $MachinePrecision]}, Block[{t$95$2 = N[(27 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -10000000000000000905969664], t$95$2, If[LessEqual[t$95$1, 5021681388309345/50216813883093446110686315385661331328818843555712276103168], N[(x - (-x)), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
t_1 := \left(a \cdot 27\right) \cdot b\\
t_2 := 27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;t\_1 \leq -10000000000000000905969664:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_1 \leq \frac{5021681388309345}{50216813883093446110686315385661331328818843555712276103168}:\\
\;\;\;\;x - \left(-x\right)\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 a #s(literal 27 binary64)) b) < -1.0000000000000001e25 or 1.0000000000000001e-43 < (*.f64 (*.f64 a #s(literal 27 binary64)) b)

    1. Initial program 94.4%

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

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

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

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

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

        \[\leadsto 2 \cdot x + 27 \cdot \left(a \cdot \color{blue}{b}\right) \]
    4. Applied rewrites64.1%

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

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

        \[\leadsto 2 \cdot x + \color{blue}{27} \cdot \left(a \cdot b\right) \]
      3. count-2-revN/A

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

        \[\leadsto \left(x + x\right) + 27 \cdot \color{blue}{\left(a \cdot b\right)} \]
      5. lift-*.f64N/A

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

        \[\leadsto \left(x + x\right) + \left(27 \cdot a\right) \cdot \color{blue}{b} \]
      7. lift-*.f64N/A

        \[\leadsto \left(x + x\right) + \left(27 \cdot a\right) \cdot b \]
      8. *-commutativeN/A

        \[\leadsto \left(x + x\right) + b \cdot \color{blue}{\left(27 \cdot a\right)} \]
      9. lift-*.f64N/A

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

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

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

        \[\leadsto x + \left(b \cdot \left(27 \cdot a\right) + \color{blue}{x}\right) \]
      13. add-flipN/A

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

        \[\leadsto x - \color{blue}{\left(\mathsf{neg}\left(\left(b \cdot \left(27 \cdot a\right) + x\right)\right)\right)} \]
      15. lift-+.f64N/A

        \[\leadsto x - \left(\mathsf{neg}\left(\left(b \cdot \left(27 \cdot a\right) + x\right)\right)\right) \]
      16. distribute-neg-inN/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(b \cdot \left(27 \cdot a\right)\right)\right) + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right) \]
      17. lift-*.f64N/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(b \cdot \left(27 \cdot a\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      18. *-commutativeN/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(b \cdot \left(a \cdot 27\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      19. lift-*.f64N/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(b \cdot \left(a \cdot 27\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      20. lower-*.f64N/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(b \cdot \left(a \cdot 27\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      21. *-commutativeN/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(\left(a \cdot 27\right) \cdot b\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      22. lift-*.f64N/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(\left(a \cdot 27\right) \cdot b\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right) \]
      23. sub-flip-reverseN/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(\left(a \cdot 27\right) \cdot b\right)\right) - \color{blue}{x}\right) \]
      24. lower--.f64N/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(\left(a \cdot 27\right) \cdot b\right)\right) - \color{blue}{x}\right) \]
    6. Applied rewrites64.1%

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

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

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

        \[\leadsto 27 \cdot \left(a \cdot b\right) \]
    9. Applied rewrites36.2%

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

    if -1.0000000000000001e25 < (*.f64 (*.f64 a #s(literal 27 binary64)) b) < 1.0000000000000001e-43

    1. Initial program 94.4%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x - \color{blue}{-1 \cdot x} \]
    5. Step-by-step derivation
      1. lower-*.f6429.9%

        \[\leadsto x - -1 \cdot \color{blue}{x} \]
    6. Applied rewrites29.9%

      \[\leadsto x - \color{blue}{-1 \cdot x} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto x - -1 \cdot \color{blue}{x} \]
      2. mul-1-negN/A

        \[\leadsto x - \left(\mathsf{neg}\left(x\right)\right) \]
      3. lower-neg.f6429.9%

        \[\leadsto x - \left(-x\right) \]
    8. Applied rewrites29.9%

      \[\leadsto x - \left(-x\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 15: 29.9% accurate, 6.2× speedup?

\[x - \left(-x\right) \]
(FPCore (x y z t a b)
  :precision binary64
  (- x (- x)))
double code(double x, double y, double z, double t, double a, double b) {
	return x - -x;
}
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)
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
    code = x - -x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return x - -x;
}
def code(x, y, z, t, a, b):
	return x - -x
function code(x, y, z, t, a, b)
	return Float64(x - Float64(-x))
end
function tmp = code(x, y, z, t, a, b)
	tmp = x - -x;
end
code[x_, y_, z_, t_, a_, b_] := N[(x - (-x)), $MachinePrecision]
x - \left(-x\right)
Derivation
  1. Initial program 94.4%

    \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
  2. Step-by-step derivation
    1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto x - \color{blue}{-1 \cdot x} \]
  5. Step-by-step derivation
    1. lower-*.f6429.9%

      \[\leadsto x - -1 \cdot \color{blue}{x} \]
  6. Applied rewrites29.9%

    \[\leadsto x - \color{blue}{-1 \cdot x} \]
  7. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto x - -1 \cdot \color{blue}{x} \]
    2. mul-1-negN/A

      \[\leadsto x - \left(\mathsf{neg}\left(x\right)\right) \]
    3. lower-neg.f6429.9%

      \[\leadsto x - \left(-x\right) \]
  8. Applied rewrites29.9%

    \[\leadsto x - \left(-x\right) \]
  9. Add Preprocessing

Reproduce

?
herbie shell --seed 2025271 -o generate:evaluate
(FPCore (x y z t a b)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, A"
  :precision binary64
  (+ (- (* x 2) (* (* (* y 9) z) t)) (* (* a 27) b)))